31.08.2013, 08:41
Something like this?
pawn Код:
CMD:warn(playerid, params[])
{
if(PlayerInfo[playerid][Level] >= 1)
{
new
id,
reason[32]
;
if(sscanf(params, "us[32]", id, reason))
return SendClientMessage(playerid, red, "USAGE: /warn [playerid/PartOfName] [reason]");
if(PlayerInfo[id][Level] == ServerInfo[MaxAdminLevel] && PlayerInfo[playerid][Level] != ServerInfo[MaxAdminLevel])
return SendClientMessage(playerid, red, "ERROR: You cannot use this command on this admin");
if(IsPlayerConnected(id))
{
if(id == playerid)
return SendClientMessage(playerid, red, "ERROR: You cannot warn yourself");
CMDMessageToAdmins(playerid, "WARN");
PlayerInfo[id][pWarnings]++;
if(PlayerInfo[id][Warnings] == MAX_WARNINGS)
{
format(str, sizeof(str), "***Administrator \"%s\" has kicked \"%s\". (Reason: %s) (Warning: %d/%d)***",
pName(playerid), pName(id), reason, PlayerInfo[id][Warnings], MAX_WARNINGS);
SendClientMessageToAll(grey, str);
SaveToFile("KickLog", str);
Kick(id);
return PlayerInfo[id][Warnings] = 0;
}
else
{
format(str, sizeof (str), "***Administrator \"%s\" has given \"%s\" a warning. (Reason: %s) (Warning: %d/%d)***", pName(playerid), pName(id), reason, PlayerInfo[id][Warnings], MAX_WARNINGS);
return SendClientMessageToAll(yellow, str);
}
}
else SendClientMessage(playerid, red, "ERROR: Player is not connected");
}
else SendClientMessage(playerid, red, "ERROR: You are not a high enough level to use this command");
return 1;
}