15.12.2011, 02:19
I need to add a reason to the /cage cmd.
Ex: /cage (id) (reason)
Ex2: /cage 1 hacking
Ex3: ** ADMIN CAGE: Noobster (2) has been caged - hacking
Ex: /cage (id) (reason)
Ex2: /cage 1 hacking
Ex3: ** ADMIN CAGE: Noobster (2) has been caged - hacking
pawn Code:
dcmd_cage(playerid,params[])
{
if(AccInfo[playerid][Level] < 4)
return ErrorMessages(playerid, 5);
new Index;
new tmp[256]; tmp = strtok(params, Index);
new tmp2[256]; tmp2 = strtok(params, Index);
new player1 = ReturnUser(tmp);
new time = strval(tmp2);
if(!strlen(tmp)) return
SendClientMessage(playerid, LIGHTBLUE2, "Usage: /cage [PlayerID] [Time]") &&
SendClientMessage(playerid, orange, "Function: Will hold player in a Cage by specified Time");
if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID && player1 != playerid && (AccInfo[player1][Level] != ServerInfo[MaxAdminLevel]))
{
if(!strlen(tmp2))
return SendClientMessage(playerid, red, "ERROR: Not specified Time!");
if(time < 10)
return SendClientMessage(playerid, red, "ERROR: Time must be greater than 10 Seconds!");
if(AccInfo[player1][pCaged] == 1)
return SendClientMessage(playerid, red, "ERROR: Player is already in Cage!");
new string[128];
new playername[MAX_PLAYER_NAME];
new adminname [MAX_PLAYER_NAME];
SendCommandToAdmins(playerid,"Cage");
GetPlayerName(player1, playername, sizeof(playername));
GetPlayerName(playerid, adminname, sizeof(adminname));
format(string, sizeof(string), "** ADMIN CAGE: %s Has Been Caged", playername);
SendClientMessageToAll(adminpink, string);
TogglePlayerControllable(player1, 0);
AccInfo[player1][pCageTime] = time;
AccInfo[player1][pCaged] = 1;
GetPlayerPos(playerid, LPosX[player1], LPosY[player1], LPosZ[player1]);
SetTimerEx("CagePlayer", 1000, 0, "i", player1);
SetTimerEx("UnCagePlayer", AccInfo[player1][pCageTime]*1000, 0, "i", player1);
}
else return ErrorMessages(playerid, 3);
return 1;
}