27.08.2010, 17:03
When everyone is dead in 1 team, it should spec the enemy's.
My problem is: It doesn't spec, but it makes anyone respawn. While they shouldn't. :S
My problem is: It doesn't spec, but it makes anyone respawn. While they shouldn't. :S
pawn Код:
stock GetRandomTeamPlayerForPlayer(playerid)
{
new rand = -1;
new team = mTeam[playerid];
new Float:health;
while(rand == -1)
{
rand = random(MAX_PLAYERS);
if(!IsPlayerConnected(rand)) rand = -1;
if(TeamCounting[team] != 0 && team == mTeam[rand]) rand = -1;
GetPlayerHealth(rand, health);
if(health <= 0) rand = -1;
}
return rand;
}
pawn Код:
//onplayerdeath
GoSpec = GetRandomTeamPlayerForPlayer(playerid);
TogglePlayerSpectating(playerid,1);
PlayerSpectatePlayer(playerid,GoSpec);