Originally Posted by
nerdiiii
Okay, I've done this so far right now
PHP Code:
Callback_PlayerConnect()
{
thread dummy();
self thread kickFakeClients();
self PlayerConnected();
and added this too on Callback_PlayerConnect()
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());
}
and I got this shit bug everytime:
Code:
******* script compile error *******
unknown function: @ 19403
************************************
Sys_Error: Error during initialization:
script compile error
(see console for details)
I'm using voron's libcod
use:
put in server-config
P.S:
for voron00-libcod, better use:
PHP Code:
validateClient()
{
self endon("disconnect");
if (!self isBot() && self getClientState() < 3)
{
wait 3.5;
if (self getClientState() == 2 && self getLastMSG() >= 3500)
{
inConsole("Invalid Client: " + removeColors(self.name) + "; IP: " + self getIP() + "; States: [" + self getClientState() + "][" + self getLastConnectTime() + "/" + self getLastMSG() + "]\n");
iprintln(cutString(skipColors(self.name), 20) + " kicked! ^7Invalid client.");
cmd_executestring("clientkick " + self getEntityNumber());
return;
}
}
}
removeColors(string) //remove if necessary, i am lazy
{
return string;
}
skipColors(string) //remove if necessary, i am lazy
{
return string;
}
cutString(string, length)
{
return string;
}
inConsole(s)
{
/*
*/
printf(s);
}
replace validateClient for kickFakeClients.