Recent Posts

Pages: [1] 2 3 ... 10
1
The cl/motdmenu.lua writes text to a local /data file on the client side.
You can't easily display client side text from a server file without writing to one first using client side lua.

There are other ways, but that is the least complicated and usually less resource intensive.

Wouldn't there also be sort of a "FastDL" method as well? By this I mean the client grabbing text from a web page.

Anyways, after extensive research I found my solution using "file.Write" in the clientside lua file. Thanks for the reply.
2
The cl/motdmenu.lua writes text to a local /data file on the client side.
You can't easily display client side text from a server file without writing to one first using client side lua.

There are other ways, but that is the least complicated and usually less resource intensive.

3
My addon has a command, i.e. !open_textbox, that will open a textbox for the client and display some text. The problem is that it will only display the text if the client has the file locally. But I want it to be like the !motd command, so the text displayed in the (motd) box is obtained from the server (the ulx_motd.txt file on the server).

I looked in the "menus.lua" file found in "addons\ulx\lua\ulx\modules\sh" and the "motdmenu.lua" file found in "addons\ulx\lua\ulx\modules\cl" for reference but didn't have much luck.
I understand that the ulx addon is much more complicated than what I'm trying to do, but I hope there's some simple LUA code that can accomplish this as I don't know much about LUA.

My addon's "open_textbox.lua" file is in autorun/client and contains these lines:

Code: [Select]
...
text:SetTextColor(Color(255, 255, 255))
text:SetDisabled(true)
text:SetMultiline(true)
text:SetVerticalScrollbarEnabled(true)
text:SetText(file.Read("textbox_contents.txt", "GAME"))

end)

The key here being the "SetText" line, this only reads the text in "textbox_contents.txt" if the client has that file. How can I make it read the server's custom text like in the !motd command?
4
Developers Corner / Re: Custom Echo Text Colors
« Last post by JamminR on July 14, 2018, 03:27:38 PM »
There is no easy way to make commands that use ulx.fancyLog have partial color changes.
The ulx.fancyLog command colors the entire string of text using ULib.tsayColor
5
Developers Corner / Re: Custom Echo Text Colors
« Last post by Timmy on July 14, 2018, 03:25:25 PM »
I’m not aware of a simpler way.

The underlying logic that applies text coloring is abstracted away.
6
General Chat & Help and Support / Re: My ULX command is appearing as uncategorized
« Last post by Timmy on July 14, 2018, 03:20:19 PM »
Make sure to instantiate your command on both the server and the client so that XGUI can pick up on it as well.
7
Developers Corner / Re: Custom Echo Text Colors
« Last post by Darkblizzard on July 14, 2018, 02:58:24 PM »
Is there no simpler way? I just want to color one piece of text in the string.
8
Developers Corner / Re: Custom Echo Text Colors
« Last post by Timmy on July 14, 2018, 02:43:41 PM »
The ulx.fancyLog function takes care of text coloring for you. You can specify the colors in XGUI ("Settings" tab > "Server" tab > Select "ULX Command/Event Echoes" option).



You can use ULib.tsayColor if you want to use custom colors for a specific ULX command. Note that this function does not accept a formatted string like ulx.fancyLog or ulx.fancyLogAdmin. You have to format the string yourself.
Code: [Select]
ULib.tsayColor( players, true, Color( 0, 255, 0), "Timmy typed a message" )
You will also have to log the event manually with ulx.logString.
Code: [Select]
ulx.logString( "Timmy typed a message", true )
9
Developers Corner / Custom Echo Text Colors
« Last post by Darkblizzard on July 14, 2018, 01:17:44 PM »
Hello,
I was wondering if I wanted to do a custom string with color such as for the format between else and end. Where or how could I make a certain text from the formal string be colored? Majority of the Garry's Mod Functions are based on adding the text with the color, but here it just needs the color. Just trying to make the text "[Admin Request]" color green, and that's it.


Code: [Select]
function ulx.asay( calling_ply, message )
local format
local me = "/me "
if message:sub( 1, me:len() ) == me then
format = "(ADMINS) *** #P #s"
message = message:sub( me:len() + 1 )
else
format = "[Admin Request] #P: #s"    --I WANT TO CHANGE THIS
end

local players = player.GetAll()
for i=#players, 1, -1 do
local v = players[ i ]
if not ULib.ucl.query( v, seeasayAccess ) and v ~= calling_ply then -- Calling player always gets to see the echo
table.remove( players, i )
end
end

ulx.fancyLog( players, format, calling_ply, message )
end
10
Off-Topic / Re: Weird glitch in ULX
« Last post by JamminR on July 14, 2018, 06:56:47 AM »
It seems you're trying to fix something (that may not really be an issue?) by removing a command that as a "superadmin" group you need?
How would you administer your server?

From what I understand, you have a user named "admin" and a user named "superadmin" in some possibly fake groups that have no elevated access?
Simply use "ulx removeuser"
ulx removeuser admin
ulx removeuser superadmin
That won't touch your actual "groups" named those, it only removes players from groups.

 o ulx removeuser <player> - Permanently removes a user's access.
 
Pages: [1] 2 3 ... 10