07.05.2011, 23:44
pawn Код:
if(strcmp(cmd, "/ban", true) == 0)
{
new string[256];
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_RED, "USE: /ban [id] [motivo]");
return 1;
}
giveplayerid = ReturnUser(tmp);
if (PlayerInfo[playerid][Admin] >= 3)
{
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
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_RED, "USE: /ban [id] [motivo]");
return 1;
}
format(string, sizeof(string), "{FF0000}%s {FFFFFF}foi banido by: {FF0000}%s {FFFFFF}|| Motivo: {FF0000}%s", giveplayer, sendername, (result));
SendClientMessageToAll(COLOR_RED, string);
Ban(giveplayerid);
return 1;
}
}//not connected
}
else
{
format(string, sizeof(string), "%d й um ID invбlido.", giveplayerid);
SendClientMessage(playerid, COLOR_WHITE, string);
}
}
return 1;
}