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!^^