I'm trying to switch scores on the team but when it do it switch it for each player and I just want to do it once. So it switches the team score 3 times if it is 3 players on the server. Why?
Code:
register_logevent("event_EndRound",2,"1=Round_End");
Code:
public event_EndRound() {
new t, c
for(new x=1;x<=PL_MAX;x++) {
if(!is_user_connected(x)) continue;
if(get_user_team(x) == 1)
t = 1;
if(get_user_team(x) == 2)
c = 1;
}
if(c == 1 && t == 1) {
timer = -1;
format(randed,63,"");
new WinT;
for(new i=1; i <= PL_MAX; i++) {
if(is_user_alive(i) && get_user_team(i) == 1)
WinT = 1;
}
if(WinT){
// Do Nothing
}else{
cs_switch_teams();
cs_set_team_score(1, teamScores[CTS]);
cs_set_team_score(2, teamScores[TS]);
}
set_task(0.5,"displayHud",TASK_DISPHUD,"",_,"a",6);
}
}