15.12.2011, 02:56
Im not sure but yes. Try this one! [Untested]
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);
new reason = strval(tmp3);
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!");
if(!strlen(tmp3))
return SendClientMessage(playerid, red, "ERROR: You must enter a reason!");
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;
}