new Injured[MAX_PLAYERS];
if (Injured[playerid] == 1 && GetPlayerAnimationIndex(playerid) != 386) { ApplyAnimation(playerid, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 1, 0, 1); SendEMSQueue(playerid,1); }
if (Injured[playerid] == 0) { new Float:x, Float:y, Float:z; new Float:angle; Injured[playerid] = 1; GetPlayerPos(playerid, x, y, z); GetPlayerFacingAngle(playerid, angle); } else if (Injured[playerid] == 1) { KillTimer(LoseHealthTimer[playerid]); KillEMSQueue(playerid); if(GetPVarInt(playerid, "activesling") > 0) { DeletePVar(playerid, "activesling"); } }
if (Injured[playerid] == 1 && GetPlayerAnimationIndex(playerid) != 386) { ApplyAnimation(playerid, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 1, 0, 1); }
new Injured[MAX_PLAYERS]; //Top of your script
new Float:X, Float:Y, Float:Z, Float:A; //Storing the coordinates and angle when a player dies. Again on top.
new interior; //In case you want to store the interior too.
public OnPlayerDeath(playerid, killerid, reason)
{
Injured[playerid] = 1;
GetPlayerPos(playerid, X, Y, Z);
GetPlayerFacingAngle(playerid, A);
GetPlayerInterior(interior); //In case you add the interior too
return 1;
}
public OnPlayerSpawn(playerid)
{
if(Injured[playerid] == 1) //Here it checks if the player died is injured
{
SetPlayerInterior(playerid, interior);
SetPlayerPos(playerid, X, Y, Z);
SetPlayerFacingAngle(playerid, A);
TogglePlayerControllable(playerid, 0); //Freezes the player so he can't use anything.
ApplyAnimation(playerid, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 1, 0, 1);
SendEMSQueue(playerid,1);
}
return 1;
}
The one I've given you is an example, the player will just stay there in an injured position as that's what I've understood from the post you did. What else do you need, a command to help the downed player up? A way for the player to accept the death and get spawned to the hospital? A good system like this would also have a way to track if a player has been shot, maybe make a timer and check if the player has been shot or just died in a brawl, if there are gunshot wounds registered then after the timer ending you can make him spawn in a hospital and if there were no gsw, just make him get up back onto his feet. The problem with the script I made for you is that, upon a player dying he's always having his Injured[playerid] set to 1, hence you not leaving the hospital or not getting there at all.
|