![Quote](images/misc/quote_icon.png)
Originally Posted by
Ni3ls
And how to use / add this? :P
Maybe for now it might be easier to tweak the fake bot kick script.
Now the server will wait 5 seconds for the first fake client. But after kicking this bot, the server will kick the clients from that IP after 1.5 seconds.
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)
ip = self getIP();
if(isDefined(level.lastfakeplayerip) && level.lastfakeplayerip == ip)
wait 1.5;
else // more time when IP isn't the same as previous ip
wait 5;
if(self getClientState() == 2)
{
lastconnect = self getLastConnectTime();
lastmsg = self getLastMSG();
if(lastconnect == lastmsg)
{
level.lastfakeplayerip = ip; // store ip from fake client
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());
}
How to use:
PHP Code:
Callback_PlayerConnect()
{
thread dummy();
self thread kickFakeClients();
self PlayerConnected();
You can add it to CodeCallback_PlayerConnect() when you are use multiple gametypes.