30.07.2018, 17:55
Quote:
new Float:RandomSpawnSWAT[6][3]
new Float:RandomSpawnSWAT[4][3] Try it ? I dont know this will be work or not because I'm newbie too XD |
The error is in the logic where you check the team of the player.
The functions return 1 when the player is in that specific team (eg. FBI), however you compare them with the actual Team ID of the player:
Код:
if(gTeam[playerid] == Army(GetPlayerSkin(playerid)))
Код:
if(Army(GetPlayerSkin(playerid)))
If you falsely compare it with the Team of the player, a player of team 0 cannot get any of these spawns.
You could either check the Team of a player, or the Skin. But don't compare these with each other because that doesn't make sense.
Код:
if(PoliceTeam(GetPlayerSkin(playerid)) || FBII(GetPlayerSkin(playerid))) { new RandomSpawnP = random(sizeof(RandomSpawnPolice)); SetPlayerPos(playerid, RandomSpawnPolice[RandomSpawnP][0], RandomSpawnPolice[RandomSpawnP][1], RandomSpawnPolice[RandomSpawnP][2]); SetPlayerFacingAngle(playerid, RandomSpawnPolice[RandomSpawnP][3]); } if(CIA(GetPlayerSkin(playerid))) { new RandomSpawnC = random(sizeof(RandomSpawnCIA)); SetPlayerPos(playerid, RandomSpawnCIA[RandomSpawnC][0], RandomSpawnCIA[RandomSpawnC][1], RandomSpawnCIA[RandomSpawnC][2]); SetPlayerFacingAngle(playerid, RandomSpawnCIA[RandomSpawnC][3]); } if(Army(GetPlayerSkin(playerid))) { new RandomSpawnA = random(sizeof(RandomSpawnArmy)); SetPlayerPos(playerid, RandomSpawnArmy[RandomSpawnA][0], RandomSpawnArmy[RandomSpawnA][1], RandomSpawnArmy[RandomSpawnA][2]); SetPlayerFacingAngle(playerid, RandomSpawnArmy[RandomSpawnA][3]); } if(SWAT(GetPlayerSkin(playerid))) { new RandomSpawnS = random(sizeof(RandomSpawnSWAT)); SetPlayerPos(playerid, RandomSpawnSWAT[RandomSpawnS][0], RandomSpawnSWAT[RandomSpawnS][1], RandomSpawnSWAT[RandomSpawnS][2]); SetPlayerFacingAngle(playerid, RandomSpawnSWAT[RandomSpawnS][3]); }
You could however make this whole thing a bit better and easier. Instead of comparing each skin seperately, you could use ONE function to determine the team by skin and then get the player's Team ID and set their spawn accordingly.
eg.
Код:
#define TEAM_ARMY 1 #define TEAM_COPS 2 #define TEAM_SOMETHING 3 GetPlayerTeamBySkin(playerid) { switch(GetPlayerSkin(playerid) { case 289: return TEAM_ARMY; // Not the actual IDs, just examples case 285: return TEAM_COPS; case 260, 261, 262: return TEAM_SOMETHING; } return 0; }