Another thing to consider is that players that have not spawned have classname "noclass".
Might be useful too, instead of using the waittill begin.
Another thing to consider is that players that have not spawned have classname "noclass".
Might be useful too, instead of using the waittill begin.
"Does not work" is an error report for a bug between keyboard and chair.
All hail Artie Effem
RobsoN (26th February 2014)
Thanks. I just edit my code so people with a valid guid are always accepted.
I am now using iptables to limit the number of connect each second. (same rules as limiting getstatus)
PHP Code:
iptables -N CQUERY-BLOCK
iptables -A CQUERY-BLOCK -m recent --set --name cblocked-hosts -j DROP
iptables -N CQUERY-CHECK
iptables -A CQUERY-CHECK -p udp -m string ! --string "connect" --algo bm --from 32 --to 39 -j RETURN
iptables -A CQUERY-CHECK -m recent --update --name cblocked-hosts --seconds 30 --hitcount 1 -j DROP
iptables -A CQUERY-CHECK -m hashlimit --hashlimit-mode srcip --hashlimit-name cod2connect --hashlimit-above 2/second -j CQUERY-BLOCK
iptables -A INPUT -p udp --dport 27960:29000 -j CQUERY-CHECK
This is my latest version with the new libcod functions.
PHP Code:
kickFakeClients()
{
self endon("begin");
self endon("disconnect");
if(self getGuid() != 0)
return; // cd key can only be used once
wait 5;
lastconnect = self getLastConnectTime();
lastmsg = self getLastMSG();
if(lastmsg == lastconnect)
{
ip = self getIP();
if(isDefined(level.lastconnectedplayerip) && level.lastconnectedplayerip == ip)
self kickFakeClient(ip, lastconnect, lastmsg);
else // more time when IP isn't the same as previous ip
{
level.lastconnectedplayerip = ip;
wait 5;
lastconnect = self getLastConnectTime();
lastmsg = self getLastMSG();
if(lastmsg == lastconnect)
self kickFakeClient(ip, lastconnect, lastmsg);
}
}
}
kickFakeClient(ip, lastconnect, lastmsg)
{
printfline("[" + ip + "] connect: " + lastconnect + "/" + lastmsg + " (" + self.name + ")");
iprintln(self.name + "^7 connection timeout.");
kick(self getEntityNumber());
}
PHP Code:
self thread kickFakeClients();
self.statusicon = "hud_status_connecting";
self waittill("begin");
self.statusicon = "";
kung foo man (14th August 2014),Ni3ls (15th August 2014),Rocky (15th August 2014)
With the commit https://github.com/M-itch/libcod/com...5541c3be6c1969 you can request the state of a player with getClientState. The state of a fake player is always CS_CONNECTED.
PHP Code:
kickFakeClients()
{
self endon("begin");
self endon("disconnect");
if(self getGuid() != 0)
return; // cd key can only be used once
wait 0.05;
if(self getClientState() >= 3) // CS_PRIMED (3) or CS_ACTIVE (4)
return; // a fake player's state is always CS_CONNECTED (2)
wait 5;
if(self getClientState() == 2)
{
ip = self getIP();
lastconnect = self getLastConnectTime();
lastmsg = self getLastMSG();
self kickFakeClient(ip, lastconnect, lastmsg);
}
}
kickFakeClient(ip, lastconnect, lastmsg)
{
printfline("[" + ip + "][" + self getClientState() + "] connect: " + lastconnect + "/" + lastmsg + " (" + self.name + ")");
iprintln(self.name + "^7 connection timeout.");
kick(self getEntityNumber());
}
Ni3ls (25th November 2014)
In Brazil a considerable number of people still play CoD in cyber cafes. If two friends decide to play in a protected server, they won't be able to.
But it's just a small consequence anyway.
set logfile 2
Its not working for me. All my servers are being filled with bots. I added the script. THey do get kicked, but they connect faster than they get kicked. So server is still being filled. Any ideas to just prevent them even from connecting? The IP: 94.255.70.95
You could try blocking the connect packets with the iptables from this post:
http://killtube.org/showthread.php?1...ull=1#post9259
Or the new challenge rate limiter from this commit:
https://github.com/M-itch/libcod/com...908ae4ef702581
How can I use/add that commit?
You could try my builds for Ubuntu (they should also work under Debian):
https://znation.nl/libcod/ubuntu/
Or checkout my github.
PHP Code:
git checkout https://github.com/M-itch/libcod.git libcod
cd libcod
./doit.sh base
./doit.sh cod2_1_0
Ni3ls (8th June 2015)
I added your build + the last script with getState. Still got 10 bots in the server.
http://service.killtube.org/?ip=46.4...yles/frontpage
I dont have root access so I cant add the iptables. He is also using different IP's now