11.08.2009, 15:22
Hey,
I got this code which I tried on my local server (running from my computer) - it worked fine.. but when I put it on my normal server (and I play alone) it doesn't work normally.. Difference between those servers - none (same FSs, everything is same... )
So here's the code:
And when player dies he gets inside the hospital (for like 1sec) and then goes outside the hospital with health of 1.0.
** - I tried debuging, and everytime I died, it printed that line into console..
Remember: This code works perfectly in my local server..
I got this code which I tried on my local server (running from my computer) - it worked fine.. but when I put it on my normal server (and I play alone) it doesn't work normally.. Difference between those servers - none (same FSs, everything is same... )
So here's the code:
pawn Code:
public OnPlayerDeath(playerid, killerid, reason)
{
Dead[playerid] = 1;
}
//I'll skip returns after all callbacks cause I'm no copying whole codes..
public OnPlayerSpawn(playerid)
{
if (Dead[playerid] == 1)
{
SetPlayerHealth(playerid,1.0);
SetPlayerFacingAngle(playerid,180.4984);
SetPlayerPos(playerid,-2664.9727,651.3477,14.4531);
HospitalTimer[playerid] = SetTimerEx("hospital", 300, 1, "d", playerid);
GameTextForPlayer(playerid,"~w~To Exit Hospital Press ~g~ ~k~~VEHICLE_ENTER_EXIT~",5000,3);
TogglePlayerControllable(playerid,0);
}
}
public hospital(playerid)
{
InHospital[playerid] = 1;
if(Dead[playerid] == 1)
{
new Float:health;
GetPlayerHealth(playerid,health);
if(health < 99)
{
SetPlayerHealth(playerid,health+1);
}
else
{
SetTimerEx("ExitHospital",500,0,"d",playerid);
KillTimer(HospitalTimer[playerid]);
print("Hospital timer stoped cause player health has more than 99 health!"); // Tried debuging**
}
}
else
{
KillTimer(HospitalTimer[playerid]);
}
}
//This is called then player press Return key: SetTimerEx("ExitHospital",100,0,"d",playerid);
public ExitHospital(playerid)
{
if(InHospital[playerid] == 1)
{
KillTimer(HospitalTimer[playerid]);
InHospital[playerid] = 0;
Dead[playerid] = 0;
TogglePlayerControllable(playerid,1);
SetPlayerFacingAngle(playerid,183.1189);
SetPlayerPos(playerid,-2664.9727,636.3477,14.4531);
SetPlayerVirtualWorld(playerid, 0);
SetPlayerInterior(playerid, 0);
SetCameraBehindPlayer(playerid);
}
** - I tried debuging, and everytime I died, it printed that line into console..
Remember: This code works perfectly in my local server..