Host exclusive commands?

Icezer

Local Ice Cube Frien. Robotic Hedgehog Enthusiast.
Hey so, I recently thought i finished my latest script/command, but I realized the host check I had implemented didn't really work.


My goal is to make it so the command my next script contains is only usable by the server host, meaning that if anyone except the host tries to use it they'll get a message saying they need host privileges. This also means that not only will they get this message, but they also won't be able to set the variable of the command.

As of this moment, everything works aside from my host check. At best, I can get the console to display the "host only" message, but other players can still set the variable.

Help would be very appreciated, and script details can be given if asked for.
 
Are you talking about commands or CVars?

For CVars, you need to apply the CV_NETVAR flag for it to become admin-only.
For commands, giving the COM_ADMIN flag to the third argument of COM_AddCommand will make the command admin-only. (This is not documented on the wiki yet)

If you are making the command host only, check that the command executor is server. server is always the host.
 
Last edited:
Are you talking about commands or CVars?

For CVars, you need to apply the CV_NETVAR flag for it to become admin-only.
For commands, giving the COM_ADMIN flag to the third argument of COM_AddCommand will make the command admin-only. (This is not documented on the wiki yet)

If you are making the command host only, check that the command executor is server. server is always the host.


Tried putting a check including server at the start and it works perfectly now. Don't know why I didn't think of using that argument myself, to be honest. Thanks for the help, it's always appreciated.
 

Who is viewing this thread (Total: 1, Members: 0, Guests: 1)

Back
Top