03.06.2014, 13:13 
	(
 Последний раз редактировалось AnonScripter; 05.06.2014 в 17:25.
)
	
	
		Removed
	
	
	
	
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;
}
| 
 
					Originally Posted by SA-MP WIKI 
You MUST check whether 'killerid' is valid (not INVALID_PLAYER_ID) before using it in an array (or really anywhere), as it will cause the OnPlayerDeath script to crash (not the entire script). This is because INVALID_PLAYER_ID is defined as 65535, and if an array only has 'MAX_PLAYERS' elements, e.g. 500, you're trying to access an index that is above 499, which is out of bounds. 
 | 
public OnPlayerDeath(playerid, killerid, reason)
{
if(killerid != INVALID_PLAYER_ID)
{
if(IsCop[killerid] == true)
{
if(PlayerTeam[playerid] == TEAM_CIVILIANS && GetPlayerWantedLevel(playerid)>=4)
{
IncreaseScore(killerid,1);
SendPlayerToJail(playerid);
return 1;
}
}
}
return 1;
}
 Wanted Player
	| 
 Huh, just what i saw. You'd want to verify if the killerid is not INVALID_PLAYER_ID. Because: 
pawn Код: 
  |