SRB2 Message Board

SRB2 Message Board (https://mb.srb2.org/index.php)
-   Editing Help (https://mb.srb2.org/forumdisplay.php?f=64)
-   -   Host exclusive commands? (https://mb.srb2.org/showthread.php?t=46681)

Icezer 02-26-2020 07:55 PM

Host exclusive commands?
 
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.

Rapidgame7 02-26-2020 10:52 PM

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.

Icezer 02-26-2020 11:33 PM

Quote:

Originally Posted by Rapidgame7 (Post 817051)
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.


All times are GMT. The time now is 02:28 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2020, vBulletin Solutions, Inc.