Quote:
Originally Posted by Sn!ff3r
better than this is
PHP Code:
set_cvar_num("sv_restartround",1)
|
It is better with pcvar if you use that way.
Here is the script :
PHP Code:
#include <amxmodx>
#include <cstrike>
new round_count, sv_restartround
new cvar_maxrounds
public plugin_init()
{
register_plugin("Auto Team Switcher", "0.1", "RazaR")
register_logevent("event_round_end", 2, "1=Round_End")
cvar_maxrounds = register_cvar("amx_maxrounds", "15")
sv_restartround = get_cvar_pointer("sv_restartround")
}
public event_round_end()
{
round_count++
if ( round_count >= get_pcvar_num(cvar_maxrounds) )
{
round_count = 0
client_print(0, print_chat, "[Zombie Swarm] Round limit reached, switching teams...")
new num, players[32]
get_players(players, num, "h")
for (new i = 0; i <= num; i++)
{
if (!is_user_connected(players[i]))
continue
if (cs_get_user_team(players[i]) == CS_TEAM_UNASSIGNED || cs_get_user_team(players[i]) == CS_TEAM_SPECTATOR)
continue
if (cs_get_user_team(players[i]) == CS_TEAM_T)
cs_set_user_team(players[i], CS_TEAM_CT)
else
cs_set_user_team(players[i], CS_TEAM_T)
}
set_pcvar_string(sv_restartround, "1")
}
}
__________________