General > Developers Corner
a "who" modification (Updated)
(1/1)
Sloth Armstronk:
Hi, I posted a thread a while ago about this and the script worked like I wanted it too but I want to change the chat output to chat.AddText or something like that instead of printmessage, but whenever I do that it says nothing.
--- Code: ---function ulx.staff( calling_ply )
for k, ply in pairs( player.GetAll() ) do
if ULib.ucl.query( ply, "is_staff" ) then
local id = tostring( ply:UserID() )
local nick = ply:Nick()
local group = ply:GetUserGroup()
local group = string.gsub(" "..group, "%W%l", string.upper):sub(2)
calling_ply:PrintMessage( 3, "" .. nick .. ": " .. group )
end
end
end
local staff = ulx.command( CATEGORY_NAME, "ulx staff", ulx.staff, "!staff" )
staff:defaultAccess( ULib.ACCESS_ALL )
staff:help( "See information about currently online staff members." )
--- End code ---
Timmy:
You're trying to run a client-side function (chat.AddText) on the server-side.
Here's what you can do instead:
Use ULib to dispatch your message
ULib contains some useful functions that can handle messaging for you!
See: https://ulyssesmod.net/docs/files/lua/ulib/shared/messages-lua.html
Use the Net Library to dispatch your message
Net messages can be used to trigger a bit of client-side code from the server.
See: https://wiki.garrysmod.com/page/Net_Library_Usage
JamminR:
*cringe*
I hate chat clutter.
Bite That Apple:
--- Quote from: JamminR on November 10, 2015, 03:49:30 PM ---*cringe*
I hate chat clutter.
--- End quote ---
But you hate like everything.. this is just one of your many other hates.
Navigation
[0] Message Index
Go to full version