Quote:
Originally Posted by Bugsy
Not sure if this will fix it but try ExecuteHam( Ham_CS_RoundRespawn , id )
|
Where is the best place to insert that?
Players being transferred to spec from a team, and then assigned to a team are not experiencing any problems.
It's when you are already in spec, and then transferred to a team that this issue occurs.
Note that there is a line preventing spectators from being moved to spec, so this is not the issue.
Thank you.
Code:
public balance(id, level, cid)
{
if (!cmd_access(id, level, cid, 2))
{
return PLUGIN_HANDLED
}
new arg1[4]
read_argv(1, arg1, charsmax(arg1))
randPercent = str_to_num(arg1)
new players[32]
new playercount
get_players(players, playercount)
SortCustom1D(players, playercount, "compareByKD")
new i
for (i = 0; i < playercount; i++)
{
new id = players[i]
if (!is_user_hltv(id) && cs_get_user_team(id) != CS_TEAM_SPECTATOR)
{
cs_set_user_team(id, CS_TEAM_SPECTATOR)
new data[2]
data[0] = id
data[1] = i
set_task((1.0 * i) + 4.0, "assignUserTeam", _, data, sizeof(data))
}
}
set_task((1.0 * i) + 4.0, "restartRound")
return PLUGIN_CONTINUE
}
public restartRound()
{
console_cmd(0, "sv_restart 1")
}
public assignUserTeam(data[])
{
new id = data[0]
new order = data[1]
cs_set_user_team(id, order % 2 == 0 ? CS_TEAM_CT : CS_TEAM_T)
new name[40]
get_user_name(id, name, 40)
console_cmd(0,"say %s has a kill / death ratio of: %f", name, getKD(id))
}
__________________