#1

I was wondering how I could do a /ajail [Player ID/Name] [Time(in minutes)] [Reason] command
Reply
#2

Create a jail timer and use it in ur jail cmd, for player/name n reason , as i know with including sscanf create a sscanf format n include playerid, time and reason in it. For mor information visit here:
https://sampforum.blast.hk/showthread.php?pid=2144299#pid2144299
Reply
#3

Thanks for the tutorial but it seems out of date/ incorrect does anyone else mind helping me
Reply
#4

Can someone please help me out
Reply
#5

pawn Код:
CMD:ajail(playerid, params[])
{
    if(IsPlayerAdmin(playerid) || pInfo[playerid][pAdmin] >= 1)
    {
        new time,reason[64], string[200], adminname[MAX_PLAYER_NAME], pname[MAX_PLAYER_NAME], target;
        GetPlayerName(target, pname, sizeof(pname));
        GetPlayerName(playerid, adminname, sizeof(adminname));
        if(sscanf(params,"dds",target,time,reason))
        return SendClientMessage(playerid, -1,"Usage:/ajail [playerid][time][reason]");
        if(target == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, "Note: That ID is invalid");
        if(time <= 0) return SendClientMessage(playerid, -1,"The jail time must be over 0!");
        format(string, 200, "* %s has jailed %s for %d minutes. Reason:%s", adminname, pname, time, reason);
        SCMTA(-1, string);
    pInfo[target][pJailed] = 1;
    SetPlayerPos(target,0.0,0.0,0.0);
    SetPlayerVirtualWorld(target, 999999);
    ClearWeapons(playerid);
        TogglePlayerControllable(playerid, 1);
    }
    else
    {
        SendClientMessage(playerid, -1, "You're not authorized to do this command");
        return 1;
    }
    return 1;
}
You'll need this stock

pawn Код:
stock ClearWeapons(playerid)
{
    ResetPlayerWeapons(playerid);
    foreach(Player, i)
    {
        pInfo[playerid][pWeapons][i] = 0;
        pInfo[playerid][pAmmo][i] = 0;
        pInfo[playerid][pEquipped][i] = false;
    }
    return 1;
}
Add these to your pInfo enum.

pawn Код:
pWeapons[13],
pAmmo[13],
pJailed,
bool:pEquipped[13],
It's not tested.


On your login make sure it checks if the player is jailed. Then it'll send them back to jail.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)