SA-MP Forums Archive
OnPlayerDeath animation help - 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: OnPlayerDeath animation help (/showthread.php?tid=345509)



OnPlayerDeath animation help - Makaveli93 - 25.05.2012

Everything else works fine, except for the animation and TooglePlayerControllable. I mean, the player needs to be frozen and in /fall animation, but instead after death he can move/run around like normal.

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    if(pCriticallyInjured[playerid] == 1)
    {
        pCriticallyInjured[playerid] = 0;
        pCalledEMS[playerid] = 0;
        SetSpawnInfo(playerid, 0, PlayerInfo[playerid][pSkin],1243.8531,330.9526,19.5547,337.3759,0,0,0,0,0,0);
        SpawnPlayer(playerid);
        SetPlayerHealth(playerid, 75);
        return 1;
    }
   
    if(pCriticallyInjured[playerid] == 0)
    {
        GetPlayerPos(playerid, pDeathLocation[playerid][0], pDeathLocation[playerid][1], pDeathLocation[playerid][2]);
        SetSpawnInfo(playerid, 0, PlayerInfo[playerid][pSkin],pDeathLocation[playerid][0],pDeathLocation[playerid][1],pDeathLocation[playerid][2],180,0,0,0,0,0,0);
        SpawnPlayer(playerid);
        SetPlayerHealth(playerid, 10);
        pCriticallyInjured[playerid] = 1;
        pCalledEMS[playerid] = 1;
        SendClientMessage(playerid, COLOR_YELLOW, "[SERVER:] You have been critically injured. Use /serviceEMS or /acceptdeath.");
       
        SetTimerEx("SetPlayerDeathAnim", 50, false, "i", playerid);
        return 1;
    }
           
    return 1;
}
pawn Код:
public SetPlayerDeathAnim(playerid)
{
    ApplyAnimation(playerid,"PED","KO_skid_front",4.1,0,1,1,1,0,1);
    ApplyAnimation(playerid,"PED","KO_skid_front",4.1,0,1,1,1,0,1);
    TogglePlayerControllable(playerid, 1);
    return 1;
}