Recent Posts

Pages: [1] 2 3 ... 10
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.

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:SetText(file.Read("textbox_contents.txt", "GAME"))


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?
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
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.
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.
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.
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 )
Developers Corner / Custom Echo Text Colors
« Last post by Darkblizzard on July 14, 2018, 01:17:44 PM »
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 )
format = "[Admin Request] #P: #s"    --I WANT TO CHANGE THIS

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 )

ulx.fancyLog( players, format, calling_ply, message )
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.
Developers Corner / Re: What would this line do
« Last post by iViscosity on July 13, 2018, 02:07:07 PM »
I don't know what the _ulx_physgun field on the player is, but if I had to guess, it makes it so when a player spawns if that field is not nil, it sets their location to _ulx_physgun.p and then freezes them (MOVETYPE_NONE means no moving)

So in the context of the add-on, I'd guess that it prevents people from killing themselves to get out of being frozen by resetting their position after spawning.
Pages: [1] 2 3 ... 10