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;
}
CMD:cage(playerid, params[])
{
new string[256], id, reason, PlayerName[MAX_PLAYER_NAME];
if(PVar[playerid][pLevel] < 3) return
SendClientMessage(playerid, COLOR_RED, "ERROR : You need to be administrator level 3 to use this command!");
format(string, sizeof(string), "%s has used the command '/cage'");
SendAdminMessage(COLOR_YELLOW, string);
if(sscanf(params, "uz", id, reason)) return SCM(playerid, COLOR_RED, "* Usage : /cage [PlayerID/Name] [Reason]");
CagePlayer(id);
CageTimer = SetTimer("UnCagePlayer",60000,false);
GetPlayerName(id, PlayerName, sizeof(PlayerName));
format(string, sizeof(string), "*** Administrator %s have caged %s for 1 minute | Reason : %d", pName(playerid), PlayerName, reason);
SCMTA(COLOR_YELLOW, string);
return true;
}
CMD:uncage(playerid, params[])
{
new string[256], id, reason, PlayerName[MAX_PLAYER_NAME];
if(PVar[playerid][pLevel] < 3) return
SendClientMessage(playerid, COLOR_RED, "ERROR : You need to be administrator level 3 to use this command!");
format(string, sizeof(string), "%s has used the command '/uncage'");
SendAdminMessage(COLOR_YELLOW, string);
if(sscanf(params, "uz", id, reason)) return SCM(playerid, COLOR_RED, "* Usage : /uncage [PlayerID/Name] [Reason]");
KillTimer(CageTimer);
UnCagePlayer(id);
GetPlayerName(id, PlayerName, sizeof(PlayerName));
format(string, sizeof(string), "*** Administrator %s has UnCaged %s | Reason : %d", pName(playerid), PlayerName, reason);
SCMTA(COLOR_YELLOW, string);
return true;
}
if(sscanf(params, "uz", id, reason)) return SCM(playerid, COLOR_RED, "* Usage : /cage [PlayerID/Name] [Reason]");
if(sscanf(params, "us", id, reason)) return SCM(playerid, COLOR_RED, "* Usage : /cage [PlayerID/Name] [Reason]");
format(string, sizeof(string), "*** Administrator %s have caged %s for 1 minute | Reason : %d", pName(playerid), PlayerName, reason);
format(string, sizeof(string), "*** Administrator %s have caged %s for 1 minute | Reason : %s", pName(playerid), PlayerName, reason);
Not sure why it's not cagin the player, but the code above is true.
Also for a cage, theirs a 0.3C Object, that is a small cage. has a little black sign that says Bullet proof. Noob safe. or somthing. the object ID: 19075. Just create this object on them. |