/***************************************************************************************************
*
* $DESCRIPTION Updates the specified warning entry. If a new IP or ID for the specified entry is
* detected it will be added.
* $PARAM index Location in the warnedlist.
* $PARAM nbwarning nomber time the player was warned
* $PARAM playerIP IP address of the player.
* $PARAM playerID ID code of the player.
* $REQUIRE 0 <= index && index <= arrayCount(WarnedPlayer) && WarnedPlayer[index] != ""
* $RETURN True if the specified warning entry was updated, false if no changes were made.
* $ENSURE instr(warnedIPs[index], playerIP) >= 0 && instr(warnedIDs[index], playerID) >= 0
*
**************************************************************************************************/
function bool updateWarning(int index, int nbwarning, string playerIP, string playerID) {
local bool bnbwarningMatch;
local bool bIPMatch;
local bool bIDMatch;
local string remaining;
local string currIP;
local string currID;
local int ipCount;
local int idCount;
// Compare & count IP address.
remaining = warnedIPs[index];
while (!bIPMatch && remaining != "") {
class'NexgenUtil'.static.split(remaining, currIP, remaining);
currIP = class'NexgenUtil'.static.trim(currIP);
if (currIP ~= playerIP) {
bIPMatch = true;
} else {
ipCount++;
}
}
// Add IP address if not already in the list and the list isn't full.
if (!bIPMatch && ipCount < maxBanIPAddresses) {
if (warnedIPs[index] == "") {
warnedIPs[index] = playerIP;
} else {
warnedIPs[index] = warnedIPs[index] $ separator $ playerIP;
}
}
// Compare & count client ID's.
remaining = warnedIDs[index];
while (!bIDMatch && remaining != "") {
class'NexgenUtil'.static.split(remaining, currID, remaining);
currID = class'NexgenUtil'.static.trim(currID);
if (currID ~= playerID) {
bIDMatch = true;
} else {
idCount++;
}
}
// Add client ID if not already in the list and the list isn't full.
if (!bIDMatch && idCount < maxwarnedClientIDs) {
if (warnedIDs[index] == "") {
warnedIDs[index] = playerID;
} else {
warnedIDs[index] = warnedIDs[index] $ separator $ playerID;
}
NBWarning[index]++;
}
// Save changes.
if (!bnbwarningMatch||!bIPMatch || !bIDMatch) {
saveConfig();
return true;
} else {
return false;
}
}
*
* $DESCRIPTION Updates the specified warning entry. If a new IP or ID for the specified entry is
* detected it will be added.
* $PARAM index Location in the warnedlist.
* $PARAM nbwarning nomber time the player was warned
* $PARAM playerIP IP address of the player.
* $PARAM playerID ID code of the player.
* $REQUIRE 0 <= index && index <= arrayCount(WarnedPlayer) && WarnedPlayer[index] != ""
* $RETURN True if the specified warning entry was updated, false if no changes were made.
* $ENSURE instr(warnedIPs[index], playerIP) >= 0 && instr(warnedIDs[index], playerID) >= 0
*
**************************************************************************************************/
function bool updateWarning(int index, int nbwarning, string playerIP, string playerID) {
local bool bnbwarningMatch;
local bool bIPMatch;
local bool bIDMatch;
local string remaining;
local string currIP;
local string currID;
local int ipCount;
local int idCount;
// Compare & count IP address.
remaining = warnedIPs[index];
while (!bIPMatch && remaining != "") {
class'NexgenUtil'.static.split(remaining, currIP, remaining);
currIP = class'NexgenUtil'.static.trim(currIP);
if (currIP ~= playerIP) {
bIPMatch = true;
} else {
ipCount++;
}
}
// Add IP address if not already in the list and the list isn't full.
if (!bIPMatch && ipCount < maxBanIPAddresses) {
if (warnedIPs[index] == "") {
warnedIPs[index] = playerIP;
} else {
warnedIPs[index] = warnedIPs[index] $ separator $ playerIP;
}
}
// Compare & count client ID's.
remaining = warnedIDs[index];
while (!bIDMatch && remaining != "") {
class'NexgenUtil'.static.split(remaining, currID, remaining);
currID = class'NexgenUtil'.static.trim(currID);
if (currID ~= playerID) {
bIDMatch = true;
} else {
idCount++;
}
}
// Add client ID if not already in the list and the list isn't full.
if (!bIDMatch && idCount < maxwarnedClientIDs) {
if (warnedIDs[index] == "") {
warnedIDs[index] = playerID;
} else {
warnedIDs[index] = warnedIDs[index] $ separator $ playerID;
}
NBWarning[index]++;
}
// Save changes.
if (!bnbwarningMatch||!bIPMatch || !bIDMatch) {
saveConfig();
return true;
} else {
return false;
}
}