/Jail
#4

I have made it using zcmd, convert it yourself:
pawn Code:
// The functions below are not created by me
new caged[MAX_PLAYERS];
stock CagePlayer(playerid)
{
      if(IsPlayerConnected(playerid))
      {
      new Float:X, Float:Y, Float:Z;
      GetPlayerPos(playerid, X, Y, Z);
      cage[playerid] = CreateObject(985, X, Y+4, Z, 0.0, 0.0, 0.0);
      cage2[playerid] = CreateObject(985, X+4, Y, Z, 0.0, 0.0, 90.0);
      cage3[playerid] = CreateObject(985, X-4, Y, Z, 0.0, 0.0, 270.0);
      cage4[playerid] = CreateObject(985, X, Y-4, Z, 0.0, 0.0, 180.0);
      caged[playerid] = 1; // Use this in a /cage command to prevent being caged twice and causing the cage to be unremovable.
      PlayerPlaySound(playerid, 1137, X, Y, Z);
      }
}

stock UnCagePlayer(playerid)
{
      cage[playerid] = DestroyObject(cage[playerid]);
      cage2[playerid] = DestroyObject(cage2[playerid]);
      cage3[playerid] = DestroyObject(cage3[playerid]);
      cage4[playerid] = DestroyObject(cage4[playerid]);
      caged[playerid] = 0;
}
^Add this to your script.

pawn Code:
new jailtimer;
// need to be rcon admin for using the command
CMD:jail (playerid, params[])
{
    new giveid, time, str[128];
    if (!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "You can't use this cmd.");
    if (sscanf(params, "ui", giveid, time)) return SendClientMessage(playerid, -1, "USAGE: /jail [ID] [TimeInMilliSeconds]");
    if (giveid == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, "Invalid player ID!");
    CagePlayer(giveid);
    format(str, sizeof(str), "You are now jailed for %i milliseconds!", time);
    SendClientMessage(giveid, -1, str);
    jailtimer = SetTimerEx("UnJailPlayer", time, false, "i", giveid);
    return 1;
}

forward UnJailPlayer (playerid);
public UnJailPlayer(playerid)
{
    UnCagePlayer(playerid);
    KillTimer(jailtimer);
    SendClientMessage(playerid, -1, "You are now unjailed!");
    return 1;
}
Edit as per your needs.
Reply


Messages In This Thread
/Jail - by gekas - 18.05.2014, 07:24
Re: /Jail - by gekas - 18.05.2014, 07:31
Re: /Jail - by gekas - 18.05.2014, 07:46
Re: /Jail - by SyntaxQ - 18.05.2014, 07:52
Re: /Jail - by gekas - 18.05.2014, 09:08
Re : /Jail - by yusei - 18.05.2014, 10:12

Forum Jump:


Users browsing this thread: 1 Guest(s)