SRB2 Message Board  

Go Back   SRB2 Message Board > Sonic Robo Blast 2 > Editing > Editing Help

Reply
 
Thread Tools Search this Thread
Old 02-26-2020   #1
Icezer
 
Icezer's Avatar
Default 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.
__________________
That guy who likes King Dedede.
Icezer is offline   Reply With Quote
Old 02-26-2020   #2
Rapidgame7
bzzzzzzzzzzzzzzzzzzzzz
 
Rapidgame7's Avatar
Default

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.
__________________

NOTICE: Game must be restarted to record statistics.

Last edited by Rapidgame7; 02-26-2020 at 10:55 PM.
Rapidgame7 is offline   Reply With Quote
Old 02-26-2020   #3
Icezer
 
Icezer's Avatar
Default

Quote:
Originally Posted by Rapidgame7 View Post
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.
__________________
That guy who likes King Dedede.
Icezer is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 10:36 PM.


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