SA-MP Forums Archive
Spawn where you last died in a forced animation - 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: Spawn where you last died in a forced animation (/showthread.php?tid=612836)



Spawn where you last died in a forced animation - cs_waller - 22.07.2016

Hello, I've tried creating a script where when you die, you spawn in a forced animation, frozen and you can accept death with a command straight away, the problem is when the chose player dies, they are teleported under some farm in Blueberry, and if they kill themselves with a command, they teleport where they last died as CJ skin, fall on the ground with the animation I've chosen but after they fall, after a second or two they get up, frozen and still as CJ, upon dying again when in the death screen the same thing happens. I'm desperately in need of help as I ran out of ideas on what to do, thank you in advance.
PHP код:
new Float:X;
new 
Float:Y;
new 
Float:Z;
new 
injured;
public 
OnPlayerSpawn(playerid)
{
    
SetPlayerSkillLevel(playeridWEAPONSKILL_PISTOL1);
    
SetPlayerSkillLevel(playeridWEAPONSKILL_SAWNOFF_SHOTGUN1);
    
SetPlayerSkillLevel(playeridWEAPONSKILL_MICRO_UZI1);
    if(
injured == 1)
    {
    
SetPlayerPos(playeridXYZ);
    
SetPlayerHealth(playerid20);
    
TogglePlayerControllable(playerid0);
    
ApplyAnimation(playerid"KNIFE""KILL_Knife_Ped_Die"4.1011001);
    
Create3DTextLabel("DEAD BODY"COLOR_REDXYZ20.000);
    
SendClientMessage(playeridCOLOR_GREEN"You have been resurrected to see another day, enjoy it...peasant");
    return 
1;
    }
    return 
1;
}
public 
OnPlayerDeath(playeridkilleridreason)
{
    
injured 1;
    
GetPlayerPos(playeridXYZ);
    
SendClientMessage(playeridCOLOR_RED"You have been slaughtered, not even god could help you");
    return 
1;
}
public 
OnPlayerCommandText(playeridcmdtext[])
{
    if(
strcmp("/accept",cmdtext,true) == 0)
    {
        
injured 0;
        
SpawnPlayer(playerid);
        
SendClientMessage(playerid,0xAA3333AA,"You died because you accepted your death");
        return 
1;
       } 



Re: Spawn where you last died in a forced animation - cs_waller - 22.07.2016

Edit, I've fixed the script a bit but now the animation is still bugged, it doesn't want to stay on the ground, he just falls and then gets up, frozen.