29.10.2010, 17:38
Quote:
format(string, sizeof(string), "AdmCmd: %s has jailed %s, reason: %s", name, giveplayerid, (result)); |
format(string, sizeof(string), "AdmCmd: %s has jailed %s, reason: %s", name, giveplayerid, (result)); |
if(strcmp(cmd, "/ajail", true) == 0)
{
if(PlayerInfo[playerid][pLogged] == 1)
{
if(PlayerInfo[playerid][pAdmin] >= 1)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "[Command]: /ajail [playerid] [minutes] [Reason]");
return 1;
}
new playa;
new jailtime;
playa = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "[Command]: /ajail [playerid] [minutes] [Reason]");
return 1;
}
jailtime = strval(tmp);
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_WHITE, "[Command]: /ajail [playerid] [Jailtime] [Reason]");
return 1;
}
new name[MAX_PLAYER_NAME];
if(IsPlayerConnected(playa))
{
if(playa != INVALID_PLAYER_ID)
{
GetPlayerName(playa, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "AdmCmd: %s has jailed %s, reason: %s", name, giveplayerid, (result));
SendClientMessageToAll(COLOR_LIGHTRED, string);
PlayerInfo[playa][pJailed] = 1;
PlayerInfo[playa][pJailTime] = jailtime*60;
SetPlayerInterior(playa, 6);
SetPlayerPos(playa, 264.6288,77.5742,1001.0391);
}
else SendClientMessage(playerid, COLOR_LIGHTRED, "[Error]: That player is not connected!");
}
else SendClientMessage(playerid, COLOR_LIGHTRED, "[Error]: That player is not connected!");
}
else SendClientMessage(playerid, COLOR_LIGHTRED, "[Error]: You're not allowed to use that command!");
}
else SendClientMessage(playerid, COLOR_LIGHTRED, "[Error]: You're not logged in!");
return 1;
}
Whole command:
pawn Code:
|