pawn Код:
dcmd_warn(playerid,params[]) {
if(PlayerInfo[playerid][Level] >= 1 || Moderator[playerid] == 1) {
new tmp[256], tmp2[256], Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index);
if(!strlen(tmp) || !strlen(tmp2)) return SendClientMessage(playerid, red, "USAGE: /warn [playerid] [reason]");
new warned = strval(tmp), str[128];
if(PlayerInfo[warned][Level] == ServerInfo[MaxAdminLevel] && PlayerInfo[playerid][Level] != ServerInfo[MaxAdminLevel]) return SendClientMessage(playerid,red,"ERROR: You cannot use this command on this admin");
if(IsPlayerConnected(warned) && warned != INVALID_PLAYER_ID) {
if(warned != playerid) {
if(Anti_Warn[warned] == 0) {
CMDMessageToAdmins(playerid,"WARN");
PlayerInfo[warned][Warnings]++;
if(PlayerInfo[playerid][Level] >= 1) {
if( PlayerInfo[warned][Warnings] == MAX_WARNINGS) {
format(str, sizeof (str), "Administrator \"%s\" has kicked \"%s\". ( Warning: %d/%d )", pName(playerid), pName(warned), PlayerInfo[warned][Warnings], MAX_WARNINGS);
SendClientMessageToAll(red, str);
format(str, sizeof (str), "[ Reason: %s ]",params[1+strlen(tmp)]);
SendClientMessageToAll(red, str);
SaveToFile("KickLog",str); Kick(warned);
return PlayerInfo[warned][Warnings] = 0;
} else {
format(str, sizeof (str), "*Administrator \"%s\" has given \"%s\" a warning ( Warning: %d/%d )", pName(playerid), pName(warned), params[1+strlen(tmp)], PlayerInfo[warned][Warnings], MAX_WARNINGS);
SendClientMessageToAll(yellow, str);
format(str, sizeof (str), "[ Reason: %s ]", params[1+strlen(tmp)]);
SendClientMessageToAll(yellow, str);
}
}
else if(Moderator[playerid] == 1)
{
if( PlayerInfo[warned][Warnings] == MAX_WARNINGS) {
format(str, sizeof (str), "*Moderator \"%s\" has kicked \"%s\". (Warning: %d/%d)*", pName(playerid), pName(warned), params[1+strlen(tmp)], PlayerInfo[warned][Warnings], MAX_WARNINGS);
SendClientMessageToAll(red, str);
format(str, sizeof (str), "[ Reason: %s ]",params[1+strlen(tmp)]);
SendClientMessageToAll(red, str);
SaveToFile("KickLog",str); Kick(warned);
return PlayerInfo[warned][Warnings] = 0;
} else {
format(str, sizeof (str), "*Moderator \"%s\" has given \"%s\" a warning.( Warning: %d/%d )*", pName(playerid), pName(warned), params[1+strlen(tmp)], PlayerInfo[warned][Warnings], MAX_WARNINGS);
SendClientMessageToAll(yellow, str);
format(str, sizeof (str), "[ Reason: %s ]",params[1+strlen(tmp)]);
SendClientMessageToAll(yellow, str);
}
} else return SendClientMessage(playerid, orange,"Player Already Warned");
}
Anti_Warn[warned] = 1;
SetTimerEx("AntiWarn", 5000, true, "i", playerid);
Warn[playerid] = warned;
return 1;
} else return SendClientMessage(playerid, red, "ERROR: You cannot warn yourself");
} else return SendClientMessage(playerid, red, "ERROR: Player is not connected");
} else return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");
}