You must write it like this:
PHP код:
//global in the script:
new Float:DeathX[MAX_PLAYERS],Float:DeathY[MAX_PLAYERS],Float:DeathZ[MAX_PLAYERS],bool:death[MAX_PLAYERS];
public OnPlayerDeath(playerid, killerid, reason)
{
death[playerid] = true;
GetPlayerPos(playerid,DeathX[playerid],DeathY[playerid],DeathZ[playerid]);
if(killerid != INVALID_PLAYER_ID)
{
SetPlayerScore(killerid, GetPlayerScore(killerid) + 1);
SendClientMessage(killerid,COLOR_LIGHTBLUE,"Good Job +1 For killing that enemy");
PlayerInfo[killerid][pKills]++;
}
PlayerInfo[playerid][pDeaths]++;
PlayerPlaySound(playerid,4804,0.0, 0.0, 10.0);
return 1;
}
public OnPlayerSpawn(playerid)
{
if(death[playerid] == true)
{
SetPlayerPos(playerid,DeathX[playerid],DeathY[playerid],DeathZ[playerid]);
ApplyAnimation(playerid, "PED", "KO_shot_front",4.1,1,1,1,1,1);
}
return 1;
}
After OnPlayerDeath is OnPlayerSpawn called and you will be spawn after you are death. So you need an boolean (a variable) to set a value that you are death and spawn you back in OnPlayerSpawn.
My english is bad, but I hope you understand me.