If you remove the switchdelay someone can crash your server.
@Zappa: He use the SH server so the switchdelay cvar works.
This is the script to switch the player:
main:
while(1)
{
wait 0.02
local.switch_player = getcvar "switch"
if(local.switch_player != "")
{
for(local.i = 1;local.i <= $player.size;local.i++)
{
local.player = $player[local.i]
if(local.player == NULL)
end
if(local.player.entnum == int(local.switch_player))
{
local.player iprint "You have been forced to switch teams!"
if(local.player.dmteam == "allies")
{
local.player join_team axis
}
else if (local.player.dmteam == "axis")
{
local.player join_team allies
}
setcvar switch ""
}
}
}
}
end
Use the command like this: