Why this code won't work? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Why this code won't work? (
/showthread.php?tid=575148)
Why this code won't work? -
Blackazur - 24.05.2015
Hello, why this code won't work? just the first line works the others not.
Код:
if(playerOnline >= 2 && GetTeamPlayersAlive(TEAM_RED) == 0) TeamRedSwitch();
else if(playerOnline >= 4 && GetTeamPlayersAlive(TEAM_RED) == 1) TeamRedSwitch();
else if(playerOnline >= 6 && GetTeamPlayersAlive(TEAM_RED) == 2) TeamRedSwitch();
else if(playerOnline >= 8 && GetTeamPlayersAlive(TEAM_RED) == 3) TeamRedSwitch();
Stock TeamRedSwitch:
Код:
stock TeamRedSwitch()
{
new count = 0;
new Random = Iter_Random(Player);
foreach(Player, i)
{
if(team[i] == TEAM_BLUE) count++;
if(count == Iter_Count(Player))
{
SetPlayerTeam(playerid,TEAM_RED);
}
}
return 1;
}