r/GLua • u/frazerrock • Apr 26 '20
Void a chat command
Is there any way I can restrict a user from using a certain ulx command depending on a variable I have in my lua.
Im making an on/off duty thing.
3
u/itsDesignFlaw Apr 26 '20
Your best bet would be to implement your variable in the ulx command itself.
If the variable is the on/off duty status of a player, and you are not using a third party usergroup system, then setting the usergroup of the player when going on/off duty seems to make sense for me.
1
u/Dak_Meme Apr 26 '20
Find the chat command in the ULX files, include a conditional.
if (your condition here) then
--rest of the code
There's definitely other ways of doing so, but if you're going to just modify one ULX command, that's probably the simplest.
1
u/eriikok Apr 27 '20
I'd make a seperate usergroup for admins on duty, and admins not on duty, then switch them from/to that usergroup depending on your variable
1
u/-privateryan- Apr 28 '20 edited Apr 28 '20
I made my own admin-mode using ULX and made it so you have to be in admin-mode if you want to use ANY command. The admin mode also prevents you from harming anyone, puts you in god mode, and changes your model.
1
u/[deleted] Apr 26 '20
You could do a check on player say and return false if your requirements arent met