Hello, I want to share my Q3fill fix.
Script will kick player which tries to connect to the server when other player on server has same IP address.
The code is not diffucult but it can help to prevent annoying server haters ^^.
NOTICE: Requires libcod!
PHP Code:
notifyConnecting()
{
self endon("disconnect");
waittillframeend;
if(isDefined(self))
{
level notify("connecting",self);
setQ3Fix(); //Add this line
}
}
setQ3Fix()
{
if(!isDefined(level.q3_fix))
level.q3_fix = [];
my_ip = getIP(self);
if(isDefined(level.q3_fix[my_ip]) && !self.data["bot"])
{
self setClientCvar("com_errorTitle", "Error"); //Maybe somehow system will fail (it should'nt but we should always assume that can happens) and a real client can be kicked.
self setClientCvar("com_errorMessage", "IP duplicate detected"); //So let him know, what went wrong.
self.kicked = true;
println("Warning: Kicking client with IP duplicate: "+my_ip);
kick(self getEntityNumber());
return true;
}
if(!self.data["bot"])
level.q3_fix[my_ip] = true;
return false;
}
getIP(client)
{
return closer(430, client getEntityNumber());
}
println(msg)
{
closer(200, msg + "\n");
}
Callback_PlayerDisconnect()
{
if(!isDefined(self.kicked))
level.q3_fix[getIP(self)] = undefined;
[...]
}
Results:
PHP Code:
Going from CS_FREE to CS_CONNECTED for (num 0 guid 0)
Sending heartbeat to cod2master.activision.com
Client 3 connecting with 50 challenge ping from SOMEIP:SOMEPORT
Going from CS_FREE to CS_CONNECTED for (num 1 guid 0)
Warning: Kicking client with IP duplicate: SOMEIP
WARNING: Non-localized Game Message string is not allowed to have letters in it. Must be changed over to a localized string: "^4*^7 t0nj3WO345oa ^7Ha^9s ^7Disc^9onnected ^7Fr^9om ^4*^7eXtremE^2~^9ZOMBIES^7"
1: EXE_PLAYERKICKED
You can see self.data["bot"] which is boolean in my case. You should define your own variable to know if connecting entity is a bot (to prevent testclient kicking).
Also you can add a line which adds kicked IP into a logfile. Then you can easily add it manually into firewall (or do whatever you need).
If you got any questions or objections to my code please let me know below
Edit#1: I forget to add array undefining when a real player disconnects