09.01.2016, 17:48
https://www.youtube.com/watch?v=0r5gDs2SdrU
When a player dies he tp aways for a second and then comes to his death point, i want the player to go to the animation right as they die.
When a player dies he tp aways for a second and then comes to his death point, i want the player to go to the animation right as they die.
Код:
public OnPlayerDeath(playerid, killerid, reason)
{
SetNormalColor(playerid);
ResetVariables(playerid);
FullResetPlayerWeapons(playerid);
FullResetPlayerClothes(playerid);
CheckPlayerCurrentCall(playerid);
RemovePlayerMask(playerid);
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)
{
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, 1000.0);
SCM(playerid, COLOR_LIGHTRED, "(( THIS PLAYER IS BRUTALLY WOUNDED ))");
DeathReason[playerid] = Create3DTextLabel("(( THIS PLAYER IS BRUTALLY WOUNDED ))", COLOR_LIGHTRED, 30.0, 40.0, 50.0, 10.0, 0, 0);
Attach3DTextLabelToPlayer(DeathReason[playerid], playerid, 0.0, 0.0, 0.0);
GameTextForPlayer(playerid, "~b~Brutally Wounded", 5000, 3);
GiveCash(playerid, -500);
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);
OnAnim{playerid} = true;
ApplyAnimation(playerid,"WUZI","CS_Dead_Guy",3.5,0,0,0,1,0);
}
}

