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 = "";