• Admin only console output
    5 replies, posted
Hello, I've been working on a simple game mode and for debug and security reasons I was wondering how to output into console but only an admin or up can see? I was just trying to think how this could be done but have not figured it out yet. If it's not something novice level to do just let me know at some point i'll figure it out once I learn more.
[code] for k,v in pairs( player.GetAll() ) do if v:IsAdmin() then print("stuff") end end [/code]
-_- ahaha Thanks so much I figured it was something I was over thinking a bit.
[QUOTE=Ivef;42278753][code] for k,v in pairs( player.GetAll() ) do if v:IsAdmin() then print("stuff") end end [/code][/QUOTE] that will just print to the server/client's console once for every admin. instead of print, you would want to use Player:PrintMessage serverside. [code] for k,v in pairs( player.GetAll() ) do if v:IsAdmin() then v:PrintMessage(HUD_PRINTCONSOLE, "print this for all admins in their console"); end end [/code]
Didn't see this until now... So you're saying print is just going to post to the client and not technically to the actual server console but I will still be getting the same output just serverside.
If you ran that serverside, it will print "stuff" n times, where n is the number of admins in the server console. But using PrintMessage will send it to a client.
Sorry, you need to Log In to post a reply to this thread.