Question
#1

Guys i made a jail command but i cant figure how to make that a admin can jail how much time he wants
and the command will read it like if i type /jail 0 25 it will jail the player for 25 sec or other that i pick


Here is my code:

pawn Код:
CMD:jail(playerid,params[])
{
    new ID;
    if(pInfo[playerid][Adminlevel] >= 2)
    {
       new rnd = random(sizeof(PrisonSpawn));
       SetPlayerPos(ID, PrisonSpawn[rnd][0], PrisonSpawn[rnd][1], PrisonSpawn[rnd][2]);
       SetPlayerInterior(ID,10);
       SetPVarInt(ID,"JailTime",-1);
       @Release(ID);
       return 1;
    }
    return 1;
}
Reply
#2

pawn Код:
CMD:jail(playerid, params[])
{
    if(pInfo[playerid][Adminlevel] < 2) {
        return 1;
    }
    new
        iTargetID,
        iJailSeconds
    ;
    if (!sscanf(params, "ud", iTargetID, iJailSeconds))
    {
        if (!IsPlayerConnected(iTargetID)) {
            return SendClientMessage(playerid, -1, "Player is not connected.");
        }
        else if (iJailSeconds < 0 || iJailSeconds > 500000) {
            return SendClientMessage(playerid, -1, "Invalid amount of time.");
        }
        new iRandSpawn = random(sizeof(PrisonSpawn));
        SetPlayerPos(iTargetID, PrisonSpawn[iRandSpawn][0], PrisonSpawn[iRandSpawn][1], PrisonSpawn[iRandSpawn][2]);

        SetPlayerInterior(iTargetID, 10);
        SetPVarInt(iTargetID, "JailTime", iJailSeconds);
        SetTimerEx("@Release", iJailSeconds * 1000, false, "d", iTargetID);
    }
    else SendClientMessage(playerid, -1, "USAGE: /jail [playerid] [seconds]");
    return 1;
}
Reply
#3

Thanks it worked +1REPED
Reply
#4

I think Emmet_ must have cringed at regurgitating that PVar.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)