Ulysses
General => Developers Corner => Topic started by: Sloth Armstronk on November 10, 2015, 12:06:03 PM
-
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.
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." )
-
You're trying to run a client-side function (chat.AddText (https://wiki.garrysmod.com/page/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 (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 (https://wiki.garrysmod.com/page/Net_Library_Usage)
-
*cringe*
I hate chat clutter.
-
*cringe*
I hate chat clutter.
But you hate like everything.. this is just one of your many other hates.