Auto jail issue, when reconnects [Simple]
#1

I have a jail system, it cannot be evaded even if a player quits and come back. Theres a timer added under ongamemodeinit and it calls in every second to see if the player jailed variable is set 0 and if it is 0, the player will be released from the jail. The script is set to jail the player when they spawn after the quit and join back [anti evade]. But the problem here is when someone quits and connect back, the variable is set to 0 on OnPlayerConnect [remember the timer is running every second], until they login and within seconds it calls that the player isnt in jail with the varible set as 0 as they connect. Heres the code so that you would understand it much better

pawn Код:
//Ongamemodeinit
SetTimer("AutoUnjail",1020,1);


//AutoJail as this calls in every second
public AutoUnjail(player1){
    if(PlayerInfo[player1][Jailed] == 1){
        if (PlayerInfo[player1][LJailTime] > 0){
            PlayerInfo[player1][LJailTime] --;
            new jtime;
            new string[128];
            jtime = (PlayerInfo[player1][LJailTime]);
            format(string, sizeof(string), "~w~JAILTIME..~n~ %d",jtime);
            GameTextForPlayer(player1, string, 3000,6);
            JailTimeServed[player1] ++;}
        if (PlayerInfo[player1][LJailTime] == 0){
            new pname[24];
            GetPlayerName(player1, pname, 24);
            new string[128];
            SetPlayerInterior(player1,3);
            SetPlayerPos(player1,210.5272,146.3341,1003.0234);
            SetPlayerFacingAngle(player1,179.4662);
            SetCameraBehindPlayer(player1);
            cannotescapejail[player1] =0;
            SendClientMessage(player1,0x00C7FFAA,"You have been released from jail. You are free to leave the area.");
            format(string, sizeof(string), "%s(%d) has been released from jail. JailTime Served: %d Seconds",pname,player1,JailTimeServed[player1]);
            SendClientMessageToAll(0x00C7FFAA, string);
            PlayerInfo[player1][Jailed] = 0;
            JailTimer[player1] = -1;
            JailTimeServed[player1] =0;}}}
I cant think of anything to fix this, any ideas to how to fix it would be appreciated
Reply


Messages In This Thread
Auto jail issue, when reconnects [Simple] - by PundacheMakalae - 08.02.2018, 10:15
Re: Auto jail issue, when reconnects [Simple] - by Hrb - 08.02.2018, 10:41
Re: Auto jail issue, when reconnects [Simple] - by Mugala - 08.02.2018, 11:07

Forum Jump:


Users browsing this thread: 1 Guest(s)