UE1 - UT Need help :Nexgen ( warning system)

  • Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

Letylove49

New Member
Oct 20, 2011
14
0
0
/***************************************************************************************************
*
* $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;
}
}
 

Helen

Member
Jan 23, 2010
48
0
6
The problem is that you have named a parameter variable the same as one of your global variables, so the function doesn't know what the global variable is.

First, change this:

function bool updateWarning(int index,int nbwarning, string playerIP, string playerID)

To this:

function bool updateWarning(int index,int nbwarningNumber, string playerIP, string playerID)

Now, because you had a parameter called nbwarning, I do not know what your intent was for it. So though my suggested code should now compile:

NBWarning[index]++;

I'm not sure that's what you want to do, maybe you want this:

NBWarning[index] = nbwarningNumber;

or maybe you want this:

NBWarning[index] += nbwarningNumber;

You'll have to figure that our yourself.