I think the problem is that you didn't use any brackets in the code and just wrote it all in one line. That's not how checks are done.
After an IF statement, the code will execute lines up to the first semicolon and that will be considered your block of code for the statement. You can avoid this by using commas or brackets, to indicate blocks of code to execute.
You currently have:
PHP код:
if(PlayerInfo[playerid][pTeam] == TEAM_USA) rnd = random(sizeof(USASpawns)); SetPlayerPos(playerid,USASpawns[rnd][0],USASpawns[rnd][1],USASpawns[rnd][2]); SetPlayerFacingAngle(playerid, USASpawns[rnd][3]);
Which is executed as:
PHP код:
if(PlayerInfo[playerid][pTeam] == TEAM_USA)
{
rnd = random(sizeof(USASpawns));
}
SetPlayerPos(playerid,USASpawns[rnd][0],USASpawns[rnd][1],USASpawns[rnd][2]);
SetPlayerFacingAngle(playerid, USASpawns[rnd][3]);
What happens is that your code checks the team, if the team is correct, generates the random number and then uses it for all the SetPlayerPos and FacingAngle lines. Eventually it reaches the last spawn point (India) and leaves the player there.
So two options:
Commas:
PHP код:
if(PlayerInfo[playerid][pTeam] == TEAM_USA)
rnd = random(sizeof(USASpawns)),
SetPlayerPos(playerid,USASpawns[rnd][0],USASpawns[rnd][1],USASpawns[rnd][2]),
SetPlayerFacingAngle(playerid, USASpawns[rnd][3]);
or brackets (recommended for clarity's sake):
PHP код:
if(PlayerInfo[playerid][pTeam] == TEAM_USA)
{
rnd = random(sizeof(USASpawns));
SetPlayerPos(playerid,USASpawns[rnd][0],USASpawns[rnd][1],USASpawns[rnd][2]);
SetPlayerFacingAngle(playerid, USASpawns[rnd][3]);
}
Hope I didn't mess up and this helps