pawn Код:
CMD:warn(playerid, params[])
{
if(gPlayerInfo[playerid][PLAYER_LEVEL] < 1)return SendClientMessage(playerid, COLOR_RED, "You are not allowed to use this command!");
new pID, string[128], pName[MAX_PLAYER_NAME], name[MAX_PLAYER_NAME], reason[60];
if(sscanf(params, "us[60]", pID,reason))return SendClientMessage(playerid, COLOR_ORANGE, "Usage: /warn [playerid] [reason]");
if(!IsPlayerConnected(pID))return SendClientMessage(playerid, COLOR_RED, "ERROR: This player is not connected.");
{
playerWarn[pID] ++;
GetPlayerName(playerid, pName, sizeof pName);
GetPlayerName(pID, name, sizeof name);
format(string, sizeof string, "[SYSTEM]: Administrator %s warned you for %s. Total warnings %i/3.", pName, reason, playerWarn[pID]);
SendClientMessage(pID, COLOR_YELLOW, string);
format(string, sizeof string, "[SYSTEM]: You warned a player %s for %s. Total warnings %i/3.", name, reason, playerWarn[pID]);
SendClientMessage(playerid, COLOR_YELLOW, string);
if(playerWarn[pID] > 2)
{
format(string, sizeof string, "[KICK]: %s recived 3 warnings and got kicked from the server. Reason: %s.", name, reason);
SendClientMessageToAll(COLOR_YELLOW, string);
SendClientMessage(pID, COLOR_YELLOW, "[KICK]: You were warned three (3) times and got kicked.");
Kick(pID);
KickLog(string);
}
}
return 1;
}