SA-MP Forums Archive
Detect dead player? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Detect dead player? (/showthread.php?tid=473291)



Detect dead player? - ajwar - 02.11.2013

My server saves ammo for player when he disconnects and also resets ammo when player dyes. The problem is that when the player dyes and disconnects in same second his ammo won't be reseted. The gamemode won't even detect that the player has health <= 0. Is it possible to detect player death with animations or something like that?


Re: Detect dead player? - RowdyrideR - 02.11.2013

Is that's it?

Код:
new IsDead[MAX_PLAYERS];

public OnPlayerDeath(playerid, killerid, reason)
{
    IsDead[playerid]=1;
    return 1;
}

public OnPlayerSpawn(playerid)
{
    IsDead[playerid]=0;
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
if(IsDead[playerid] == 1)
{
//leaving while dead
}
return 1;
}