SA-MP Forums Archive
jail cmd - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: jail cmd (/showthread.php?tid=323402)



jail cmd - Dw.UsHer - 05.03.2012

how i make a cmd /jail ID Minutes Reason
and when admin you put the player in jail on other players to be written
Server: Carmelo_Castle closed in prison admin Mio_Moretti Reason: DM


Re: jail cmd - Dw.UsHer - 05.03.2012

please any help me ?


Re: jail cmd - Twisted_Insane - 05.03.2012

Check out my signature, one of my tutorials is including a jail-command!


Re: jail cmd - Dw.UsHer - 05.03.2012

i don't understant that can you make a cmd and post here ?


Re: jail cmd - Twisted_Insane - 05.03.2012

Of course I can, but by the way, try to learn it a little by yourself, okay?

Look, add these two variables at the top of your script:

pawn Код:
new JailTimer[MAX_PLAYERS],
        bool:inJail[MAX_PLAYERS];
Then, add this command out of any callback into your script:

pawn Код:
CMD:jail(playerid, params[])
    {
        if(PlayerInfo[playerid][pAdmin] >= 4)
        {
            new targetid, minutes;
            if(sscanf(params, "ri", targetid, minutes)) return SendClientMessage(playerid, COLOR_RED,"Usage: /jail <playerid> <minutes>");
            if(minutes <= 0 || minutes > 60) return SendClientMessage(playerid, COLOR_RED, "Minutes can't be less than 0 or more than 60!");
            if(targetid == playerid) return SendClientMessage(playerid, COLOR_RED, "You can't jail yourself!");
            if(PlayerInfo[targetid][pAdmin] > PlayerInfo[playerid][pAdmin]) return SendClientMessage(playerid, COLOR_RED, "You can't jail higher level admins!");
            else
            {
                new str[128];
                format(str, sizeof(str), "Administrator %s has jailed %s for %d minutes!", Name(playerid), Name(targetid), minutes);
                SendClientMessageToAll(COLOR_LIGHTBLUE,str);
                JailTimer[targetid] = SetTimer("Unjail", minutes*60*1000, false);
                SetPlayerPos(targetid, 264.4176, 77.8930, 1001.0391);
                SetPlayerInterior(playerid, 6);
                inJail[targetid] = true;
                GameTextForPlayer(playerid, "~p~JAILED", 10000, 6);
                PlayerPlaySound(targetid,1057,0.0,0.0,0.0);
            }
        }
        else return SendClientMessage(playerid, COLOR_RED, "You have to be level 4 to use this command!");
        return 1;
    }
REMEMBER THIS LINE:

pawn Код:
if(PlayerInfo[playerid][pAdmin] >= 4)
You'll have to replace it with the variables of the enum from your own playerinfo, okay?

Now, simply add this at the last line of your script:

pawn Код:
forward Unjail(playerid);
public Unjail(playerid)
{
    SpawnPlayer(playerid);
    SetPlayerInterior(playerid, 0);
    inJail[playerid] = false;
    KillTimer(JailTimer[playerid]);
    GameTextForPlayer(playerid, "~g~Unjailed", 5000, 6);
    PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
}
You're done! I posted it in the SAME way in my tutorial, I even explained any line, I don't know what you didn't understand!^^


Re: jail cmd - Hand-Scripter - 05.03.2012

Because, You used ZCMD what he probably did not understand.


Re: jail cmd - Dw.UsHer - 05.03.2012

this is cery hard for me !!! i hate my life bicause i am stupid :@:@
i don't understant that bicause i first day i used ZCMD!!!