20.04.2012, 14:10
This command ADD a warning but I want a command to remove 1 warning, but I dont know how :/
pawn Код:
CMD:warn(playerid,params[]) {
if(PlayerInfo[playerid][Level] >= 2) {
new tmp[128], tmp2[128], Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index);
if(isnull(tmp) || isnull(tmp2)) return SendClientMessage(playerid,LIGHTBLUE2, "Usage: /Warn [PlayerID] [Reason]") && SendClientMessage(playerid,orange, "Function: Will give a warning in a specified reason to a specified player");
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) {
CMDMessageToAdmins(playerid,"Warn");
PlayerInfo[warned][Warnings]++;
if( PlayerInfo[warned][Warnings] == MAX_WARNINGS) {
format(str, sizeof (str), "4|- Administrator \"%s\" has kicked \"%s\". | Reason: %s (Warnings: %d/%d) -|", pName(playerid), pName(warned), params[1+strlen(tmp)], PlayerInfo[warned][Warnings], MAX_WARNINGS);
IRC_GroupSay(gGroupID, IRC_CHANNEL, str);
IRC_GroupSay(gGroupID2, IRC_ADMINCHANNEL, str);
format(str, sizeof (str), "|- Administrator \"%s\" has kicked \"%s\". | Reason: %s (Warnings: %d/%d) -|", pName(playerid), pName(warned), params[1+strlen(tmp)], PlayerInfo[warned][Warnings], MAX_WARNINGS);
SendClientMessageToAll(red, str);
SaveToFile("KickLog",str); Kick(warned);
return PlayerInfo[warned][Warnings] = 0;
} else {
format(str, sizeof (str), "8|- Administrator \"%s\" has given \"%s\" a Warning. | Reason: %s (Warnings: %d/%d) -|", pName(playerid), pName(warned), params[1+strlen(tmp)], PlayerInfo[warned][Warnings], MAX_WARNINGS);
IRC_GroupSay(gGroupID, IRC_CHANNEL, str);
IRC_GroupSay(gGroupID2, IRC_ADMINCHANNEL, str);
format(str, sizeof (str), "|- Administrator \"%s\" has given \"%s\" a Warning. | Reason: %s (Warnings: %d/%d) -|", pName(playerid), pName(warned), params[1+strlen(tmp)], PlayerInfo[warned][Warnings], MAX_WARNINGS);
return SendClientMessageToAll(yellow, str) && SaveToFile("WarnLog",str);
}
} 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");
}