Any way to stop spectating?

Pikaspoop

Judge
Judge
Hey, I have a unique problem of players switching to spectate mode to pass on the role of tagger to someone else, it's so out of hand that the beginning of every match is a big game of either hot potato or chicken. I've tried looking for console variables or addons that could help, but no luck.
Is there any known way to prevent players from entering spectator mode?
 
Slightly more advanced, but if you are comfortable scripting in lua, you can also use a TeamSwitch hook to prevent the player from spectating once the game has already started.
 
Slightly more advanced, but if you are comfortable scripting in lua, you can also use a TeamSwitch hook to prevent the player from spectating once the game has already started.
The problem is that switching to spectator before the game starts allows players to remove the responsibility of being it, spectating afterwards isn't as much of an issue.
If it's possible, I could only apply the hook to players in the "It" team.
 
I've been wondering if there was a way to do that, disable spectating but when the countdown is happening, you can join or spectate
 
The problem is that switching to spectator before the game starts allows players to remove the responsibility of being it, spectating afterwards isn't as much of an issue.
If it's possible, I could only apply the hook to players in the "It" team.

Yes, you could add a check for whether the player is "IT" or not -- the game signifies this using the pflag "PF_TAGIT", e.g. if (player.pflags & PF_TAGIT) then return false end
 
Yes, you'll need to refer to the wiki for the proper syntax; but in short, you create a lua script that has a TeamSwitch hook, and in that hook you return false if the player has the PF_TAGIT pflag. This will prevent the `changeteam` action from going through if the player is tagged.

In the hook, you can also reference the hidetime console variable i.e. CV_FindVar('hidetime').value to make sure it doesn't happen during pre-round hide time.
 
Thank you so much for the suggestion! I ended up making a lua script much more complicated than I expected to be doing!
I had a lot of fun doing it though, I might even try submitting it to the addons page.
Thanks again clairebun!
 
Yes, you'll need to refer to the wiki for the proper syntax; but in short, you create a lua script that has a TeamSwitch hook, and in that hook you return false if the player has the PF_TAGIT pflag. This will prevent the `changeteam` action from going through if the player is tagged.

In the hook, you can also reference the hidetime console variable i.e. CV_FindVar('hidetime').value to make sure it doesn't happen during pre-round hide time.
Alright, thanks!
 

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

Back
Top