kill timer bug
#1

Hey guys, i've been trying to kill my jail timer OnPlayerDisconnect, the reason for this is that when a player quits while in jail, the timer wont keep going once hes gone.

My problem is that when the player quits, it says "Player has Been Unjailed" right when they quit, it seems to be calling the timers function whenever i kill the timer.

the way i want to kill the timer is so that it's gone completely for that playerid, without leaving any kind of message.

here's my code

PHP код:
OnPlayerDisconnect(playeridreason)
{
KillTimer(UnJail2(playerid)); // not full code obviously, just the important part.
return 1;
}
public 
UnJail2(toplayer)
{
    if(
jailed2[toplayer] == 1)
        {
        new 
pname[MAX_PLAYER_NAME];
        new 
string[60];
        
GetPlayerName(toplayerpnamesizeof(pname));
        
TeleportAllowed[toplayer] = 1;
        
SetPlayerPos(toplayer255.2078,86.6854,1002.4453);
        
SetPlayerInterior(toplayer6);
        
SetPlayerFacingAngle(toplayer90);
        
format(stringsizeof(string), "%s (%d) has been Released from Jail."pnametoplayer);
        
SendClientMessageToAll(0xFFFFFFFFstring);
        
jailed2[toplayer] = 0;
        
pInfo[toplayer][pJailed] = 0;
    }
    return 
1;

if i don't kill the timer, when a player is in jail then quits, the timer still continues for that id, so then it says " (2) Has been Released from Jail."

if someone else joins before the timer ends (90 seconds) it says they've been unjailed, and if the person who originally was jailed, rejoins, it says they've been released from jail before they even login.

any idea whats up here?
Reply
#2

update: fixed it myself. /thread
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)