4 As Max on 1 IP - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: 4 As Max on 1 IP (
/showthread.php?tid=489940)
4 As Max on 1 IP -
litmanen - 24.01.2014
Title says it all, any way to change this into your script? Since it must be a protection for Bot spawning.
Re: 4 As Max on 1 IP -
litmanen - 25.01.2014
Is Anyone able to solve this problem for me? I Dont know how a protection script like that looks like since i never heard about Spawning Bots Lol. But since i wanted to play with some friends into my server, it blocked the 4th one. So this must be scripted somewhere.
Re : 4 As Max on 1 IP -
MCZOFT - 25.01.2014
you need to define ur max ip's first .. i will give you a simple example
PHP код:
#define MAX_CONNECTIONS_FROM_IP 25 // maximal connections from 1 ip .. u need to define it at ur top of your gamemod
public OnPlayerConnect(playerid)
// MAX IP'S are connecting ..
new connecting_ip[32+1];
GetPlayerIp(playerid,connecting_ip,32);
new num_players_on_ip = GetNumberOfPlayersOnThisIP(connecting_ip);
if(num_players_on_ip > MAX_CONNECTIONS_FROM_IP) {
printf("MAXIPs: Connecting player(%d) exceded %d IP connections from %s.", playerid, MAX_CONNECTIONS_FROM_IP, connecting_ip);
SendClientMessage(playerid, COLOR_LIGHTRED, "SERVER: {FFFFFF}You have exceeded the max IPs limiit.");
FixedKick(playerid);
return 1;
}
// DONE
PHP код:
Stock of GetNumberOfPlayersOnThisIP
stock GetNumberOfPlayersOnThisIP(test_ip[])
{
new against_ip[32+1];
new x = 0;
new ip_count = 0;
for(x=0; x<MAX_PLAYERS; x++) {
if(IsPlayerConnected(x)) {
GetPlayerIp(x,against_ip,32);
if(!strcmp(against_ip,test_ip)) ip_count++;
}
}
return ip_count;
}
PHP код:
Stock of FixedKick
stock FixedKick(playerid) {
KillTimer(kick_gTimer[playerid]);
kick_gTimer[playerid] = SetTimerEx("DelayedKick", 500, false, "i", playerid);
return 1;
}
PHP код:
forward DelayedKick(playerid);
public DelayedKick(playerid) {
if (!IsPlayerConnected(playerid)) return 1;
Kick(playerid);
return 1;
}
Hope this helps you , i've just give you an idea how to do it , Good luck
Re: 4 As Max on 1 IP -
Vince - 25.01.2014
Just use the filterscript that comes with server.
Re: 4 As Max on 1 IP -
litmanen - 25.01.2014
Yeah many thanks, but the thing is, i dont need a script like that. I've downloaded a script a while ago, and it must be located somewhere inside, so i asked for some examples to search on that. Sadly i had no results, so is there any other way to get rid of it?
EDIT: Nevermind, found it, +Rep for both.
Re: 4 As Max on 1 IP -
litmanen - 25.01.2014
Or well, havent found it yet, LOL.
Re: 4 As Max on 1 IP -
Ada32 - 25.01.2014
http://ysi.wikia.com/wiki/Library:YSI%5Cy_flooding
Re: 4 As Max on 1 IP -
litmanen - 25.01.2014
Still cant find it, i'm using the Zgaming gamemode so you guys know.