24.05.2015, 02:10
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
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?
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(playerid, reason)
{
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(toplayer, pname, sizeof(pname));
TeleportAllowed[toplayer] = 1;
SetPlayerPos(toplayer, 255.2078,86.6854,1002.4453);
SetPlayerInterior(toplayer, 6);
SetPlayerFacingAngle(toplayer, 90);
format(string, sizeof(string), "%s (%d) has been Released from Jail.", pname, toplayer);
SendClientMessageToAll(0xFFFFFFFF, string);
jailed2[toplayer] = 0;
pInfo[toplayer][pJailed] = 0;
}
return 1;
}
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?