SA-MP Forums Archive
[unsolved] Works on local server, but not on main :S - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [unsolved] Works on local server, but not on main :S (/showthread.php?tid=90961)



[unsolved] Works on local server, but not on main :S - SiJ - 11.08.2009

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..


Re: Works on local server, but not on main :S - Doppeyy - 11.08.2009

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


Re: Works on local server, but not on main :S - SiJ - 12.08.2009

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


Re: Works on local server, but not on main :S - James_Alex - 12.08.2009

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


Re: Works on local server, but not on main :S - SiJ - 12.08.2009

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..


Re: Works on local server, but not on main :S - Correlli - 12.08.2009

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?


Re: Works on local server, but not on main :S - SiJ - 12.08.2009

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.. :\


Re: Works on local server, but not on main :S - SiJ - 12.08.2009

I still hope that somebody can help me...