03.06.2014, 13:34
I try to guess what the problem is. Let me explain.
You have under OnPlayerSpawn a function that set the player position to where it need's to be spawned. Like if he's a cop he will be spawned at the section, if he's a civilian he will be spawned at the airport etc. So OnPlayerDeath you put that player in jail, and OnPlayerSpawn you get that player out of jail. I would recommend you to make an array to save all the players that must be in jail, and OnPlayerSpawn you should put them there. Something like:
You have under OnPlayerSpawn a function that set the player position to where it need's to be spawned. Like if he's a cop he will be spawned at the section, if he's a civilian he will be spawned at the airport etc. So OnPlayerDeath you put that player in jail, and OnPlayerSpawn you get that player out of jail. I would recommend you to make an array to save all the players that must be in jail, and OnPlayerSpawn you should put them there. Something like:
pawn Код:
new PlayerJailed[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
PlayerJailed[playerid]=0; //reset the variables for each player connected.
}
public OnPlayerSpawn(playerid)
{
if(PlayerJailed[playerid]==1)
{
SendPlayerToJail(playerid);
}
else
{
//Spawn him normally
}
}
public OnPlayerDeath(playerid, killerid, reason)
{
if(IsCop[killerid] == true)
{
if(PlayerTeam[playerid] == TEAM_CIVILIANS && GetPlayerWantedLevel(playerid)>=4)
{
IncreaseScore(killerid,1);
PlayerJailed[playerid]=1;
return 1;
}
}
return 1;
}