Need help with jail timer
#1

I don't know what i am doing wrong, but as far as i try to jail someone for 1 minute, after 1 minute they're not getting respawned at all, here's the code:

pawn Код:
CMD:jail(playerid, params[])
{
new pID, pTI, reason[100], aname[MAX_PLAYER_NAME], pname[MAX_PLAYER_NAME], string[128];
if(sscanf(params, "uds[128]", pID, pTI, reason)) return SendClientMessage(playerid, 0xFF0000AA, "[USAGE] /jail <playerid> <time> <reason>.");
if(pInfo[playerid][Level] < 3) return 0;
if(pInfo[playerid][Level] < 2) return SendClientMessage(playerid, 0xFF0000AA, "[ERROR] You are not authorized to use this command.");
if(!IsPlayerConnected(pID)) return SendClientMessage(playerid, 0xFF0000AA, "[ERROR]: User is not connected.");
if(pjailed[pID] == 1) return SendClientMessage(playerid, 0xFF0000AA, "[ERROR] User is currently in jail.");
{
    GetPlayerName(playerid, aname, sizeof(aname));
    GetPlayerName(pID, pname, sizeof(pname));
    format(string, sizeof(string), "[ADMIN] You have admin jailed %s for: %s.", pname, reason);
    SendClientMessage(playerid, 0xFFFF00AA, string);
    format(string, sizeof(string), "You have been admin jailed by %s for: %s.", aname, reason);
    SendClientMessage(pID, 0xFFFF00AA, string);
    format(string, sizeof(string), "[ADMIN] %s has admin jailed %s for: %s.", aname, pname, reason);
    SendClientMessageToAll(0xFFFF00AA, string);
    SetPlayerPos(pID, 2334.1631,1459.6666,2114.5259);
    SetPlayerInterior(pID, 0);
    SetPlayerFacingAngle(pID, 360.0);
    SetPlayerHealth(pID, 99999999999999999.0);
    ResetPlayerWeapons(pID);
    jtime[pID] = SetTimerEx("UnJail", pTI*1000*60,0, "i", pID);
    pjailed[playerid] = 1;
    }
return 1;
}
help plz.
Reply
#2

What do you mean not respawned all? They're not getting out on jail after 1 minute?
Reply
#3

pawn Код:
SetTimerEx("UnJail",80000,0,"i",pID);//80000 1 minute i think
pawn Код:
forward UnJail(playerid);
public UnJail(playerid)
{
pjailed[playerid] = 0;
SpawnPlayer(playerid);
return 1;
}
Reply
#4

Guest123's post solved my issue, thanks for the quick help!!
Reply
#5

okay, no problem
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)