I found a better way to detect fake clients. It also uses last msg but also the last connect time.
The fake clients only connect to the server and nothing else. So after they connect the lastmsg time is the same as the last connect time.
This is part of the last function they run:
PHP Code:
Com_DPrintf( "Going from CS_FREE to CS_CONNECTED for %s\n", newcl->name );
newcl->state = CS_CONNECTED;
newcl->nextSnapshotTime = svs.time;
newcl->lastPacketTime = svs.time;
newcl->lastConnectTime = svs.time;
Proof
PHP Code:
Fake clients:
[ip] connect: 1050/1050 (4GtXwfgRl3)
[ip] connect: 1050/1050 (2S)
[ip] connect: 1050/1050 (5II)
[ip] connect: 6050/6050 (Z4sjLDJe4)
[ip] connect: 6050/6050 (4GtXwfgRl3)
[ip] connect: 6050/6050 (2S)
[ip] connect: 6050/6050 (5II)
Me:
[ip] connect: 1050/1000 (Mitch||OwnZ. ^7[^456^7]) (after 1 s)
[ip] connect: 6050/4000 (Mitch||OwnZ. ^7[^456^7]) (after 6 s)
PHP Code:
lastconnect = std\player::getLastConnectTime();
lastmsg = std\player::getLastMsg();
std\io::println("[" + ip + "] connect: " + lastconnect + "/" + lastmsg + " (" + self.name + ")");
PHP Code:
getLastConnectTime() { return closer(433, self getEntityNumber()); }
https://github.com/M-itch/libcod/com...8d28c88ac75c45
http://znation.nl/libcod
PHP Code:
kickFakeClients(ip)
{
self endon("begin");
self endon("disconnect");
if(self getGuid() != 0)
return; // cd key can only be used once
wait 5;
lastconnect = std\player::getLastConnectTime();
lastmsg = std\player::getLastMsg();
if(lastmsg == lastconnect)
{
ip = std\player::getIP();
std\io::println("[" + ip + "] connect: " + lastconnect + "/" + lastmsg + " (" + self.name + ")");
iprintln(self.name + "^7 connection timeout.");
kick(self getEntityNumber());
}
}