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");
}
CMD:remwarn(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: /RemWarn [PlayerID]") && SendClientMessage(playerid,orange, "Function: Will remove a warning from 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 removed a warning from \"%s\" | (Warnings: %d/%d) -|", pName(playerid), pName(warned), PlayerInfo[warned][Warnings], MAX_WARNINGS);
IRC_GroupSay(gGroupID, IRC_CHANNEL, str);
IRC_GroupSay(gGroupID2, IRC_ADMINCHANNEL, str);
format(str, sizeof (str), "|- Administrator \"%s\" has removed a warning from \"%s\" | (Warnings: %d/%d) -|", pName(playerid), pName(warned), PlayerInfo[warned][Warnings], MAX_WARNINGS);
return SendClientMessageToAll(yellow, str) && SaveToFile("WarnLog",str);
}
} else return SendClientMessage(playerid, red, "ERROR: You cannot remove your own warnings");
} 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");
}
CMD:warnremove(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: /Warnremove [PlayerID] [Reason]") && SendClientMessage(playerid,orange, "Function: Will remove 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,"UnWarn");
PlayerInfo[warned][Warnings]--;
if( PlayerInfo[warned][Warnings] == MAX_WARNINGS) {
format(str, sizeof (str), "4|- Administrator \%s\ has removed \%s\'s one 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 removed \%s\'s one warning". | 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 removed \%s\'s one 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 removed \%s\'s one 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 unwarn 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");
}
CMD:remwarn(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: /RemWarn [PlayerID]") && SendClientMessage(playerid,orange, "Function: Will remove a warning from 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\".(Warnings: %d/%d) -|", pName(playerid), pName(warned), PlayerInfo[warned][Warnings], MAX_WARNINGS);// I change here
IRC_GroupSay(gGroupID, IRC_CHANNEL, str);
IRC_GroupSay(gGroupID2, IRC_ADMINCHANNEL, str);
format(str, sizeof (str), "|- Administrator \"%s\" has kicked \"%s\". (Warnings: %d/%d) -|", pName(playerid), pName(warned), PlayerInfo[warned][Warnings], MAX_WARNINGS);// I change here
SendClientMessageToAll(red, str);
SaveToFile("KickLog",str); Kick(warned);
return PlayerInfo[warned][Warnings] = 0;
} else {
format(str, sizeof (str), "8|- Administrator \"%s\" has removed a warning from \"%s\" | (Warnings: %d/%d) -|", pName(playerid), pName(warned), PlayerInfo[warned][Warnings], MAX_WARNINGS);
IRC_GroupSay(gGroupID, IRC_CHANNEL, str);
IRC_GroupSay(gGroupID2, IRC_ADMINCHANNEL, str);
format(str, sizeof (str), "|- Administrator \"%s\" has removed a warning from \"%s\" | (Warnings: %d/%d) -|", pName(playerid), pName(warned), PlayerInfo[warned][Warnings], MAX_WARNINGS);
return SendClientMessageToAll(yellow, str) && SaveToFile("WarnLog",str);
}
} else return SendClientMessage(playerid, red, "ERROR: You cannot remove your own warnings");
} 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");
}
CMD:unwarn(playerid, params[])
{
if(AccInfo[playerid][Level] < 2) return SendClientMessage(playerid, COLOR_ERROR, "You are not Admin!");
new
tempname,
temptext[128];
if(sscanf(params, "us[128]", tempname, temptext)) return SendClientMessage( playerid, -1, "Usage: /unwarn [PlayerID] [reason]");
if(!IsPlayerConnected(tempname)) return SendClientMessage( playerid, -1, "Player is not connected.");
SetPVarInt(tempname, "Warnings", GetPVarInt( tempname, "Warnings") - 1 );
new
String[50];
format(String, sizeof(String), "Admin %u removed your one warning.", playerid);
SendClientMessage( tempname, -1, String );
format(String, sizeof(String), "You removed a warning for player %u for %s.", tempname, temptext);
SendClientMessage(playerid, -1, String);
return 1;
}
Try this made in a few minutes:
pawn Код:
|
CMD:unwarn(playerid, params[])
{
if(PlayerInfo[playerid][Level] >= 2) return SendClientMessage(playerid, COLOR_ERROR, "You are not Admin!");
new tempname, temptext[128];
if(sscanf(params, "us[128]", tempname, temptext)) return SendClientMessage( playerid, -1, "Usage: /unwarn [PlayerID] [reason]");
if(!IsPlayerConnected(tempname)) return SendClientMessage( playerid, -1, "Player is not connected.");
SetPVarInt(tempname, "Warnings", GetPVarInt( tempname, "Warnings") - 1 );
new String[50];
format(String, sizeof(String), "Admin %u removed your one warning.", playerid);
SendClientMessage( tempname, -1, String );
format(String, sizeof(String), "You removed a warning for player %u for %s.", tempname, temptext);
SendClientMessage(playerid, -1, String);
return 1;
}