Jailtimer problem
#1

Problem is, that when player is ajailed about 1 minute and if he then released from the ajail, its all okey. But after every 1 minute, server says "You have been released from ajail" and spawns player to the same position, as on the code.
Second problem is, when player log out, he have been released from jail. I looked GM and i my mind, it saves JailTime, but it isn't.

pawn Код:
public AjailTimer(playerid)
{
    new string[128];
    if(Player[playerid][AJailTime] == 0)
    {
        KillTimer(AJailTimer[playerid]);
        Player[playerid][AJailTime] = 0;
        SetPlayerPos(playerid, 628.9576, -543.6878, 16.3694);
        SetPlayerInterior(playerid, 0);
        SetPlayerVirtualWorld(playerid, 0);
        TogglePlayerControllable(playerid, 1);
        SaveStats(playerid);
        SendClientMessage(playerid, WHITE, "You have been released from ajail!");
    }
    else
    {
        Player[playerid][AJailTime] --;
        format(string, sizeof(string), "You have to been %d minutes in jail.", Player[playerid][AJailTime]);
        SendClientMessage(playerid, RED, string);
        SaveStats(playerid);
    }
    return 1;
}
pawn Код:
Player[playerid][JailTime],
Player[playerid][AJailTime],
This is on under SaveStats.
Reply
#2

Show how you create the timer.
Reply
#3

I cant find any problem in the script not that I'm that good of a scripter, but i used to create a function called "OnSecondsUpdate" and i programmed it to work on seconds update.
Try and check if the string you have (The 'else' one) might work faster then intended or the time you /ajail someone is not transfered correctly and its maxed in 60 seconds.

Check both of this things and tell me the result
Reply
#4

Are you sure that AJailTimer[playerid] stored the timer ID? You attempt to kill the timer and that's correct but it's like it failed to do so.

Is it like?
pawn Код:
// let's say "targetid" stores the id we want to jail in the /jail or /ajail command:
AJailTimer[targetid] = SetTimerEx( ... );
Make sure you didn't write playerid by accident etc..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)