[unsolved] Works on local server, but not on main :S
#1

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:

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);
}
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..
Reply
#2

Hmmm its weird if it works on your local server it should work on your normal server to .
And the code is good to for as far i can see.
Sorry i wish i could help you more maybey some other guys will come along to help you.

/Artix
Reply
#3

So.. Anybody can help me? It's really weird, but I really need to fix this.. :S
Reply
#4

what bug in your normal server ?
i mean what dosen't work in ur normal server ?
Reply
#5

Quote:
Originally Posted by ► James_Alex
what bug in your normal server ?
i mean what dosen't work in ur normal server ?
Yes.. Then I die it spawns instantly with 1 health.. Instead of being in hospital..
Reply
#6

Quote:
Originally Posted by Justas [SiJ
]
Yes.. Then I die it spawns instantly with 1 health.. Instead of being in hospital..
Did you setted 'Dead' variable to 0 when player connects or disconnects?
Reply
#7

Quote:
Originally Posted by Don Correlli
Quote:
Originally Posted by Justas [SiJ
]
Yes.. Then I die it spawns instantly with 1 health.. Instead of being in hospital..
Did you setted 'Dead' variable to 0 when player connects or disconnects?
Yes.. And I just found out that it only doesn't work for ID one on main server..
It seems that it works for some players, and for some doesn't work.. :\
Reply
#8

I still hope that somebody can help me...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)