12.05.2013, 13:28
It should be something as this:
pawn Код:
new
gLastVW [MAX_PLAYERS],
gLastInt [MAX_PLAYERS],
Float:gLastPos [MAX_PLAYERS][3],
bool:gDead [MAX_PLAYERS]
;
public OnPlayerDeath(playerid) {
if (!gDead[playerid]) {
gDead[playerid] = true;
gLastInt[playerid] = GetPlayerInterior(playerid);
gLastVW[playerid] = GetPlayerVirtualWorld(playerid);
GetPlayerPos(playerid, gLastPos[playerid][0], gLastPos[playerid][1], gLastPos[playerid][2]);
}
return 1;
}
public OnPlayerSpawn(playerid) {
if (gDead[playerid]) {
SetPlayerInterior(playerid, gLastInt[playerid]);
SetPlayerVirtualWorld(playerid, gLastVW[playerid]);
SetPlayerPos(playerid, gLastPos[playerid][0], gLastPos[playerid][1], gLastPos[playerid][2]);
/* Animations, etc. there */
SendClientMessage(playerid, -1, "Use /acceptdeath to rest in peace.");
} else {
/* He accepted the death, send him to the hospital or somewhere. */
}
return 1;
}
COMMAND:acceptdeath(playerid, params[]) {
if (!gDead[playerid])
return SendClientMessage(playerid, -1, "You're not dead my man!!!");
gDead[playerid] = false;
SetPlayerHealth(playerid, 0.0);
SendClientMessage(playerid, "You just accepted the death.");
return 1;
}
/* NOTE: if paramedics manage to save him, just set gDead to false */