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 i = 0, len = sizeof(AnimLibs); i < len; i++)
{
ApplyAnimation(id, AnimLibs[i], "null", 0.0, 0, 0, 0, 0, 0, 0);
}
}
// 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?