28.08.2012, 20:13
Here goes, by the way, this is not the right way to count how many players has a team, you should increase it on onplayerrequestclass and remove it on onplayerdisconnect instead of make this loop inside this callback.
pawn Код:
public OnPlayerSpawn(playerid);
{
if(Account[playerid][gTeam]==Cops)
{
print("Debug : Cops Random spawn called.");
new Random = random(sizeof(RandomSpawnsCops));
SetPlayerPos(playerid, RandomSpawnsCops[Random][0], RandomSpawnsCops[Random][1], RandomSpawnsCops[Random][2]);
SetPlayerFacingAngle(playerid, RandomSpawnsCops[Random][3]);
}
else if(Account[playerid][gTeam]==Terrorists)
{
print("Debug : Teorrists Random spawn called.");
new Random = random(sizeof(RandomSpawnsTerrorists));
SetPlayerPos(playerid, RandomSpawnsTerrorists[Random][0], RandomSpawnsTerrorists[Random][1], RandomSpawnsTerrorists[Random][2]);
SetPlayerFacingAngle(playerid, RandomSpawnsTerrorists[Random][3]);
}
static i = 0,u = MAX_PLAYERS;
for(; i < u; ++i)
{
if(Account[i][gTeam]==Terrorists) TerrorsCounter++;
else if(Account[i][gTeam]==Cops) CopsCounter++;
}
return 1;
}