public OnPlayerDeath(playerid, killerid, reason)
{
PlayerTextDrawHide(playerid, cSpeedo[4][playerid]);
KillTimer(StartCountKM[playerid]);
SetPlayerColor(playerid, 0xBBBBBB00);
ASI_SetPlayerHealth(playerid, 30);
PlayerTextDrawShow(playerid, Dead[0][playerid]);
PlayerTextDrawShow(playerid, Dead[1][playerid]);
PlayerTextDrawShow(playerid, Dead[2][playerid]);
SetTimerEx("UnrentVehTime", Seconds(1), 0, "i", playerid);
new deathreason[20], string[128];
if(killerid != INVALID_PLAYER_ID)
{
if(reason == 0) { deathreason = "Melee"; }
else if(reason == 36 || reason == 35 || reason == 40 || reason == 16) { deathreason = "Explosion"; }
else if(reason == 18 || reason == 37) { deathreason = "Fire"; }
else if(reason == 51) { deathreason = "Explosion"; }
else if(reason == 50) { deathreason = "Heli-Kill"; }
else { GetWeaponName(reason, deathreason, sizeof(deathreason)); }
format(string, sizeof(string), "[DEATH]: %s (%i) has been killed by %s (%i) - %s", GetPlayerNameEx(playerid), playerid, GetPlayerNameEx(killerid), killerid, deathreason);
SendAllAdminMessage(-1, string);
}
else
{
new text[30];
if(reason == 51) { text = "Explosion"; }
else if(reason == 53) { text = "Drowned"; }
else if(reason == 54) { text = "Collision"; }
else { text = "Death"; }
format(string, sizeof(string), "[DEATH]: %s (%i) has been killed by Server. (%s)", GetPlayerNameEx(playerid), playerid, text);
SendAllAdminMessage(-1, string);
}
TogglePlayerControllable(playerid, false);
SetTimerEx("AfterDeath", Seconds(15), false, "i", playerid);
return true;
}
forward AfterDeath(playerid);
public AfterDeath(playerid)
{
if(pInfo[playerid][LifeInsurance] != 1)
{
ASI_SetPlayerHealth(playerid, 30);
GameTextForPlayer(playerid, "~g~RELEASED FROM THE HOSPITAL", 5000, 4);
SCM(playerid, -1, "SMS: Hospital: You had no life insurance and we had to charge money from you for hospital bills. (1200$)");
SCM(playerid, -1, " "COLOR_HELP"HELP: You can buy Life Insurance in closest Insurance Agency!");
ASI_SetPlayerPos(playerid, 1173.0325, -1323.2419, 15.3973);
ASI_GiveCash(playerid, -1200);
ASI_SetPlayerInterior(playerid, 0);
ASI_SetPlayerVirtualWorld(playerid, 0);
SetPlayerFacingAngle(playerid, 268.14);
SetCameraBehindPlayer(playerid);
SetPlayerToTeamColor(playerid);
TogglePlayerControllable(playerid, true);
PlayerTextDrawHide(playerid, Dead[0][playerid]);
PlayerTextDrawHide(playerid, Dead[1][playerid]);
PlayerTextDrawHide(playerid, Dead[2][playerid]);
}
else
{
ASI_SetPlayerHealth(playerid, 30);
GameTextForPlayer(playerid, "~g~RELEASED FROM THE HOSPITAL", 5000, 4);
SCM(playerid, -1, "SMS: Hospital: We have recieved money from your life insurance for the hospital bills.");
ASI_SetPlayerPos(playerid, 1173.0325, -1323.2419, 15.3973);
ASI_SetPlayerInterior(playerid, 0);
ASI_SetPlayerVirtualWorld(playerid, 0);
SetPlayerFacingAngle(playerid, 268.14);
SetCameraBehindPlayer(playerid);
SetPlayerToTeamColor(playerid);
TogglePlayerControllable(playerid, true);
PlayerTextDrawHide(playerid, Dead[0][playerid]);
PlayerTextDrawHide(playerid, Dead[1][playerid]);
PlayerTextDrawHide(playerid, Dead[2][playerid]);
}
return true;
}
set a var that shows player is dead , then OnPlayerSpawn use it to set pos in anywhere you want and freeze
|
maybe maybe maybe it's because of this that written in OnPlayerDeath : ASI_SetPlayerHealth(playerid, 30);
don't set the health here , set it when player spawned |