pawn Code:
forward RecoverHospital(playerid);
public RecoverHospital(playerid)
{new str[56];
format(str, 56, "Recovering id %i from hospital (1/6)..", playerid);
SendClientMessageToAdmins(COLOR_LIGHTRED, str, 1);
SendClientMessage(playerid, -1, "You have to recover health at the hospital.");
SetPlayerHealth(playerid, 50);
}
forward RecoverHospital2(playerid);
public RecoverHospital2(playerid)
{new str[56];
format(str, 56, "Recovering id %i from hospital (2/6)..", playerid);
SendClientMessageToAdmins(COLOR_LIGHTRED, str, 1);
SetPlayerHealth(playerid, 60);
}
forward RecoverHospital3(playerid);
public RecoverHospital3(playerid)
{new str[56];
format(str, 56, "Recovering id %i from hospital (3/6)..", playerid);
SendClientMessageToAdmins(COLOR_LIGHTRED, str, 1);
SetPlayerHealth(playerid, 65);
}
forward RecoverHospital4(playerid);
public RecoverHospital4(playerid)
{new str[56];
format(str, 56, "Recovering id %i from hospital (4/6)..", playerid);
SendClientMessageToAdmins(COLOR_LIGHTRED, str, 1);
SetPlayerHealth(playerid, 70);
}
forward RecoverHospital5(playerid);
public RecoverHospital5(playerid)
{ new str[56];
format(str, 56, "Recovering id %i from hospital (5/6)..", playerid);
SendClientMessageToAdmins(COLOR_LIGHTRED, str, 1);
SetPlayerHealth(playerid, 75);
}
forward RecoverHospital6(playerid);
public RecoverHospital6(playerid)
{
new str[56];
format(str, 56, "Recovered and spawned id %i from hospital (6/6)..", playerid);
SendClientMessageToAdmins(COLOR_LIGHTRED, str, 1);
SetPlayerPos(playerid, 1178.4980,-1323.4543,14.1230);
SetPlayerFacingAngle(playerid, 271.3259);
SetPlayerHealth(playerid, 80);
TogglePlayerControllable(playerid, 1);
SetCameraBehindPlayer(playerid);
SetPVarInt(playerid, "Recovering", 0);
SendClientMessage(playerid, COLOR_LIGHTRED, "Hospital: The hospital bill came to $200. Buy an insurance for a cheaper bill.");
PlayerInfo[playerid][pCash] -= 100;
}
Ignore the recovering thingy. Thats just a debug I made to try to identify the problem.
pawn Code:
public OnPlayerDeath(playerid, killerid, reason)
{
if(GetPVarInt(playerid, "Injured") != 1)
{
new Float:ipx, Float:ipy, Float:ipz;
SetPVarInt(playerid, "Injured", 1);
PlayerInfo[playerid][pVW] = GetPlayerVirtualWorld(playerid);
PlayerInfo[playerid][pInt] = GetPlayerInterior(playerid);
GetPlayerPos(playerid, ipx, ipy, ipz);
SetSpawnInfo(playerid, 0, PlayerInfo[playerid][pSkin], ipx, ipy, ipz, 0, 0, 0, 0, 0, 0, 0);
// SendClientMessage(playerid, -1, "Entering injured state.");
}
else
{
new str[56];
SendClientMessage(playerid, -1, "The medics failed to revive you or you body was moved causing you to die.");
format(str, 56, "Sending id %i to hospital", playerid);
SendClientMessageToAdmins(COLOR_LIGHTRED, str, 1);
RecoverHospital(playerid);
SetTimer("RecoverHospital2", 6000, false);
SetTimer("RecoverHospital3", 8000, false);
SetTimer("RecoverHospital4", 10000, false);
SetTimer("RecoverHospital5", 12000, false);
SetTimer("RecoverHospital6", 14000, false);
SetSpawnInfo(playerid, 0, PlayerInfo[playerid][pSkin], 1178, -1324, 8.11, 0, 0, 0, 0, 0, 0, 0);
SetPVarInt(playerid, "Injured", 0);
SetPVarInt(playerid, "Recovering", 1);
SpawnPlayer(playerid);
PlayerInfo[killerid][pKills]++;
PlayerInfo[playerid][pDeaths]++;
return 1;
}
return 1;
}