admin jail problem
#1

this system works, however sometimes (not all the time) when the time is up, the player will respawn every second, even though the timer has been killed.

pawn Код:
CMD:ajail(playerid, params[])
{
    new target, reason[100], time, query[400], string[124], timestr[256];
    if(pInfo[playerid][Admin] < 1) return ErrorMessage(pid, "You aren't authorized to use this command.");
    if(sscanf(params, "uds[100]", target, time, reason)) return UsageMessage(pid, "/ajail [target] [time] [reason]");
    SetPlayerVirtualWorld(target, target);
    SetPlayerInterior(target, 2);
    SetPlayerPos(target, 20.1830, 31.9226, 3.1341);
    pInfo[target][Jailed] = time*60;
    format(string, sizeof(string), "%s admin jailed by %s for: %s ( %d minutes )", pInfo[target][Name], pInfo[playerid][Name], reason, time);
    SendClientMessageToAll(COLADMIN, string);

    GetDateTime(timestr);
   
    mysql_format(connection, query, sizeof(query), "INSERT INTO `adminrecord` (`UID`, `Player`, `Banning Admin`, `Ban Type`, `Ban Reason`, `Ban Date`) VALUES (%d, '%e', '%e', %d, '%e', '%e')", pInfo[target][ID], pInfo[target][Name], pInfo[playerid][Name], 2, reason, timestr);
    mysql_query(connection, query);
   
    ajailtimer[pid] = SetTimerEx("ajail", 1000, true, "i", target);
    return 1;
}

public ajail(playerid)
{
    if(pInfo[pid][Jailed] <= 1)
    {
        KillTimer(ajailtimer[pid]);
        SpawnPlayer(playerid);
        return 1;
    }
    else
    {
        pInfo[pid][Jailed] --;
        new string[100];
        format(string, sizeof(string), "~r~%d ~w~Seconds left", pInfo[pid][Jailed]);
        GameTextForPlayer(pid, string, 1000, 6);
    }
    return 1;
}
Reply


Messages In This Thread
admin jail problem - by TakeiT - 12.12.2014, 01:03
Re: admin jail problem - by Jefff - 12.12.2014, 01:34
Re: admin jail problem - by TakeiT - 12.12.2014, 01:35
Re: admin jail problem - by Jefff - 12.12.2014, 01:37
Re: admin jail problem - by TakeiT - 12.12.2014, 01:43

Forum Jump:


Users browsing this thread: 1 Guest(s)