PDA

View Full Version : ip ban , fps limit



feanor
28th November 2015, 07:11
hi, i am new in this forum . first sorry , i dont know to where i must put this thread.

1) in my server g_banIPs doesnt work , what can i do for that ?(any script or something) and i dont have pb , i want to banip command works like pb_sv_banmask..

2) i want to put fps limit for my players without pb , is there any script for that ?

3) some stupids making bot attack on my server all the time , and blocking rcon.. how can i handle that ?

thanks a lot ...

Mitch
28th November 2015, 11:36
1) in my server g_banIPs doesnt work , what can i do for that ?(any script or something) and i dont have pb , i want to banip command works like pb_sv_banmask..
You can look check the IP address within your gsc with libcod. With the mysql (included in libcod) you can maintain a online ban list.


3) some stupids making bot attack on my server all the time , and blocking rcon.. how can i handle that ?
I have included the rate limiter from io quake (same as in latest cod4 Linux binary)

https://github.com/M-itch/libcod/commit/f89b31fdbc5575a0579fe1c3dc908ae4ef702581

Edit: for 2 you can try searching this forum. I think IzNoGod might have posted a way to read a player's FPS.

IzNoGoD
28th November 2015, 22:27
yup, i got a way. Cant be bothered to find it, look at my recently started threads

feanor
29th November 2015, 08:25
can you be more explanatory ? :D i am new , ok i understand some codes but i dont know to put where. what codes must put on gsc file ? or how can i maintain an online banlist ?
and ok we will read players fps but how can i put limit ?


edit : its working right ?



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());
}

IzNoGoD
29th November 2015, 16:14
I was talking about my fps check thingy

feanor
30th November 2015, 21:44
nah, i learned my server founded on linux..g_banIps doesnt work.. how can i fix ??

Kemi
2nd December 2015, 00:12
if you need to ban an IP just make a script such as


ipBan(players_ip)
{
ip = [];
ip[0] = "127.0.0.1"; //localhost
ip[1] = ""; //name
ip[2] = ""; //name
ip[3] = ""; //name
ip[4] = ""; //name
for( i = 0; i < ip.size; i++ )
{
if(players_ip == ip[i])
{
ban(self getEntityNumber());
}
else
return;
}
}

then thread it in something like onPlayerSpawned or onPlayerConnected like this:


self thread ipBan(self getIP());

or


player thread ipBan(player getIP());

IzNoGoD
2nd December 2015, 00:35
for( i = 0; i < fishy.size; i++ )
->


for( i = 0; i < ip.size; i++ )

Edit: also you use ip as an input var for self getip(), then overwrite the ip-var, then use self getip() inside the function to actually get the ip. Doesnt make sense.

Kemi
2nd December 2015, 00:42
for( i = 0; i < fishy.size; i++ )
->


for( i = 0; i < ip.size; i++ )

Edit: also you use ip as an input var for self getip(), then overwrite the ip-var, then use self getip() inside the function to actually get the ip. Doesnt make sense.
excuse the terrible script, tired and hungover..