SA-MP Forums Archive
Death System bug. - 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: Death System bug. (/showthread.php?tid=588975)



Death System bug. - Matical - 14.09.2015

well when a player dies it never does the animation it only makes them stand-up i have got the anim to work once before but it was only for the player, aswell when a player gets killed they tp to the airport then to the death spot, i want them to fall right away as they die.

here is my system,

Код:
public OnPlayerDeath(playerid, killerid, reason)
{
	SetNormalColor(playerid);
	ResetVariables(playerid);
	FullResetPlayerWeapons(playerid);
	FullResetPlayerClothes(playerid);
	CheckPlayerCurrentCall(playerid);
	RemovePlayerMask(playerid);
	OnAnim{playerid} = true;
	ApplyAnimation(playerid,"WUZI","CS_Dead_Guy",4.1,0,1,1,1,1);
	ApplyAnimation(playerid,"WUZI","CS_Dead_Guy",4.1,0,1,1,1,1);
	if(!isAdminDuty(playerid))
	{
		MakePlayerWounded(playerid);
	}
	SetHunger(playerid, 100.0);
  	return 1;
}
Код:
stock MakePlayerWounded(playerid)
{
	if(PlayerInfo[playerid][pJailed] == 0)
	{
	    SetIntVar(playerid, "JustDied", 1);
	    SavePlayerPos(playerid);
	}
	return 1;
}
Код:
public CheckWounded(playerid)
{
	if(GetIntVar(playerid, "JustDied") == 1)
	{
		ApplyAnimation(playerid,"WUZI","CS_Dead_Guy",4.1,0,1,1,1,1);
		ApplyAnimation(playerid,"WUZI","CS_Dead_Guy",4.1,0,1,1,1,1);
		PutPlayer(playerid,PlayerInfo[playerid][pPosX],PlayerInfo[playerid][pPosY],PlayerInfo[playerid][pPosZ]);
		SetInterior(playerid, PlayerInfo[playerid][pInt]);
		SetWorld(playerid, PlayerInfo[playerid][pWorld]);
		SetPlayerCameraPos(playerid,PlayerInfo[playerid][pPosX]+3,PlayerInfo[playerid][pPosY]+3,PlayerInfo[playerid][pPosZ]+3);
		SetPlayerCameraLookAt(playerid,PlayerInfo[playerid][pPosX],PlayerInfo[playerid][pPosY],PlayerInfo[playerid][pPosZ]);
		SetPlayerHealth(playerid, 25.0);
		GiveCash(playerid, -500);
		GameTextForPlayer(playerid, "~b~Brutally Wounded", 5000, 3);
    	SCM(playerid, COLOR_PINK, "EMT: Your Medical Bills are $500");
    	SCM(playerid, COLOR_LIGHTRED, "You are Brutally Wounded. If a medic or anyone else doesn't save you, you will die.");
    	SCM(playerid, COLOR_LIGHTRED, "To accept death type /acceptdeath");
		FreezePlayer(playerid);
	}
}



Re: Death System bug. - Matical - 14.09.2015

Bump


Re: Death System bug. - itsCody - 14.09.2015

You have to preload the animation.

PHP код:
// Somewhere in your script
static const AnimLibs[][] =
{
    
"WUZI"
};
PreloadAnimLibFor(id)
{
    for(new 
0len sizeof(AnimLibs); leni++)
    {
        
ApplyAnimation(idAnimLibs[i], "null"0.0000000);
    }
}
// OnPlayerConnect
PreloadAnimLibFor(playerid); 
Might be a better way of preloading but I use this way.

Just put the lib in new lines.. "WUZI", "ect"
and remove the double ApplyAnimations in your script


Re: Death System bug. - Matical - 14.09.2015

Alright thank you and how about the player tping away and then to the death spot? Any Idea?


Re: Death System bug. - Matical - 15.09.2015

bump


Re: Death System bug. - itsCody - 15.09.2015

Freeze the player?