4 As Max on 1 IP
#3

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_IPconnecting_ip);
        
SendClientMessage(playeridCOLOR_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 
0;
    new 
ip_count 0;
    for(
x=0x<MAX_PLAYERSx++) {
        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"500false"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
Reply


Messages In This Thread
4 As Max on 1 IP - by litmanen - 24.01.2014, 19:11
Re: 4 As Max on 1 IP - by litmanen - 25.01.2014, 09:52
Re : 4 As Max on 1 IP - by MCZOFT - 25.01.2014, 10:16
Re: 4 As Max on 1 IP - by Vince - 25.01.2014, 11:59
Re: 4 As Max on 1 IP - by litmanen - 25.01.2014, 12:02
Re: 4 As Max on 1 IP - by litmanen - 25.01.2014, 12:21
Re: 4 As Max on 1 IP - by Ada32 - 25.01.2014, 13:41
Re: 4 As Max on 1 IP - by litmanen - 25.01.2014, 13:49

Forum Jump:


Users browsing this thread: 2 Guest(s)