11.07.2011, 02:59
i made this code,
the problem is when i spawned with team terrorsit and spawned, then i want to change team, so i pressed f4 and used command kill, but when i wanted to spawn with Kopassus team, it said that it is full,,, why,,, i think my code is work,
sorry bad eng,, lol
Код:
new Team1 = 0 ; new Team2 = 0 ;
Код:
public OnPlayerRequestSpawn(playerid) { if(Team1 > Team2) { if(gTeam[playerid] == TEAM_RED ) { GameTextForPlayer(playerid, "~w~Team Kopassus is full", 600, 5); return 0; } return 1; } else if(Team2 > Team1) { if(gTeam[playerid] == TEAM_BLUE ) { GameTextForPlayer(playerid, "~w~Team Terrorist is full", 600, 5); return 0; } return 1; } else if(Team2 == Team1) { if(gTeam[playerid] == TEAM_BLUE && gTeam[playerid] == TEAM_RED ) { GameTextForPlayer(playerid, "~w~This Team is Available", 600, 5); } return 1; } return 1; }
Код:
public OnPlayerSpawn(playerid) { if(GetPlayerTeam(playerid) == TEAM_RED) { Team1++; } else if(GetPlayerTeam(playerid) == TEAM_BLUE) { Team2++; } return 1; }
Код:
public OnPlayerDeath(playerid, killerid, reason) { //Team Balance// if(gTeam[playerid] == TEAM_RED) { Team1--; } if(gTeam[playerid] == TEAM_BLUE) { Team2--; } return 1; }
sorry bad eng,, lol