18.12.2011, 04:50
I have designed a system where if your health is below 5.0, it will make it so you can't move and you're stuck in an animation until you bleed out and die (or when OnPlayerDeath is called). So far, so good! Now, once OnPlayerDeath is called, it should set a PVar and then continue to the next step, where OnPlayerRequestClass is called. Okay, still going fine. Under OnPlayerRequestClass, I am trying to set the player's camera angle but it doesn't seem like it wants to do anything, it goes to the main screen when you first join a SA-MP server...
Here's my code:
Could anyone perhaps tell me why it doesn't set the player's camera pos/angle?
Here's my code:
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
stop InjuredTimer[playerid];
SetPVarInt(playerid, "JustDied", 1);
return 1;
}
public OnPlayerRequestClass(playerid, classid)
{
if(GetPVarInt(playerid, "JustDied") == 1)
{
ClearChat(playerid);
OOCEnabled[playerid] = 0;
SendClientMessage(playerid, COLOR_LRED, "You have been transported to the hospital and can't remember what happened to you.");
SetPlayerCameraLookAt(playerid, -2327.4072, 1357.9125, 334.0528);
defer HospitalTimer(playerid);
SetPVarInt(playerid, "INHOSP", 1);
DeletePVar(playerid, "JustDied");
return 0;
}
return 0;
}
timer HospitalTimer[15000](playerid)
{
SetSpawnInfo(playerid, -1, pStats[playerid][EP_SKIN], fHospSpawnX, fHospSpawnY, fHospSpawnZ, fHospSpawnR, -1, -1, -1, -1, -1, -1);
SpawnPlayer(playerid);
SendClientMessage(playerid, COLOR_WHITE, "You have been discharged from the hospital.");
DeletePVar(playerid, "INHOSP");
}