Raised This Month: $ Target: $400
 0% 

Checking ip same.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
TheDS1337
Veteran Member
Join Date: Jun 2012
Old 06-02-2013 , 19:14   Re: Checking ip same.
Reply With Quote #1

Code:
#include < amxmodx >

public client_putinserver( Client )
{
    for( new Index = 1; Index <= get_maxplayers( ); Index++ )
    {
        if( Index == Client )
	{
		static AddressIP[ 32 ], AddressIP2[ 32 ];
		get_user_ip( Client, AddressIP, charsmax( AddressIP ) );
		get_user_ip( Index, AddressIP2, charsmax( AddressIP2 ) );
        
		if( equali( AddressIP, AddressIP2 ) )    
		{
			static Name[ 32 ];
			get_user_name( Client, Name, charsmax( Name ) );
			server_cmd( "amx_kick ^"%s^"", Name );    
		}
	}
    }    
}
Try it am going to sleep now

Last edited by TheDS1337; 06-02-2013 at 19:16.
TheDS1337 is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 06-02-2013 , 22:38   Re: Checking ip same.
Reply With Quote #2

Replace the return with continue. You want to skip that comparison, not stop comparing

EDIT: I'll give it a shot later, when I get back on my PC

EDIT2:
Try this (untested)

PHP Code:
#include <amxmodx>

// Comment this line to disable the auto-kick on connect
#define AUTO_KICK_ON_CONNECT

public plugin_init()
{
    
register_plugin("Detect/Kick duplicate IPs""1""YamiKaitou");
    
    
register_clcmd("say ipcheck""check_ip");
}

public 
check_ip(id)
{
    new 
aPlayers[32], iCountsIP1[16], sIP2[16], iPlayeriTotal;
    
get_players(aPlayersiCount"ch");
    
    
get_user_ip(idsIP1charsmax(sIP1), 1);
    
    for (new 
0iCountk++)
    {
        
iPlayer aPlayers[k];
        
        if (
iPlayer == id)
            continue;
        
        
get_user_ip(iPlayersIP2charsmax(sIP2), 1);
        
        if (
equal(sIP1sIP2))
            
iTotal++;
    }
    
    
client_print(idprint_chat"There are %d other player%s connected with your IP"iTotal, (iTotal==1) ? "" "s");
    
    return 
PLUGIN_CONTINUE;
}

#if defined AUTO_KICK_ON_CONNECT
public client_connect(id)
{
    new 
aPlayers[32], iCountsIP1[16], sIP2[16], iPlayer;
    
get_players(aPlayersiCount"ch");
    
    
get_user_ip(idsIP1charsmax(sIP1), 1);
    
    for (new 
0iCountk++)
    {
        
iPlayer aPlayers[k];
        
        if (
iPlayer == id)
            continue;
        
        
get_user_ip(iPlayersIP2charsmax(sIP2), 1);
        
        if (
equal(sIP1sIP2))
        {
            
server_cmd("kick #%d ^"Sorryonly one client per IP connected at a time^""get_user_userid(id));
            break;
        }
    }
}
#endif 
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).

Last edited by YamiKaitou; 06-03-2013 at 00:02.
YamiKaitou is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-03-2013 , 00:29   Re: Checking ip same.
Reply With Quote #3

Deagle . . . please stop trying to help when you have no idea what is going on.
__________________
fysiks is offline
TheDS1337
Veteran Member
Join Date: Jun 2012
Old 06-03-2013 , 04:25   Re: Checking ip same.
Reply With Quote #4

Quote:
Originally Posted by fysiks View Post
Deagle . . . please stop trying to help when you have no idea what is going on.
ok ... sorry i won't post any post again
TheDS1337 is offline
yoni279
Member
Join Date: Feb 2010
Old 06-03-2013 , 09:30   Re: Checking ip same.
Reply With Quote #5

Quote:
Originally Posted by DeagLe.Studio View Post
ok ... sorry i won't post any post again
thnx anyway for trying!!!

Quote:
Originally Posted by YamiKaitou View Post
Replace the return with continue. You want to skip that comparison, not stop comparing

EDIT: I'll give it a shot later, when I get back on my PC

EDIT2:
Try this (untested)

PHP Code:
#include <amxmodx>

// Comment this line to disable the auto-kick on connect
#define AUTO_KICK_ON_CONNECT

public plugin_init()
{
    
register_plugin("Detect/Kick duplicate IPs""1""YamiKaitou");
    
    
register_clcmd("say ipcheck""check_ip");
}

public 
check_ip(id)
{
    new 
aPlayers[32], iCountsIP1[16], sIP2[16], iPlayeriTotal;
    
get_players(aPlayersiCount"ch");
    
    
get_user_ip(idsIP1charsmax(sIP1), 1);
    
    for (new 
0iCountk++)
    {
        
iPlayer aPlayers[k];
        
        if (
iPlayer == id)
            continue;
        
        
get_user_ip(iPlayersIP2charsmax(sIP2), 1);
        
        if (
equal(sIP1sIP2))
            
iTotal++;
    }
    
    
client_print(idprint_chat"There are %d other player%s connected with your IP"iTotal, (iTotal==1) ? "" "s");
    
    return 
PLUGIN_CONTINUE;
}

#if defined AUTO_KICK_ON_CONNECT
public client_connect(id)
{
    new 
aPlayers[32], iCountsIP1[16], sIP2[16], iPlayer;
    
get_players(aPlayersiCount"ch");
    
    
get_user_ip(idsIP1charsmax(sIP1), 1);
    
    for (new 
0iCountk++)
    {
        
iPlayer aPlayers[k];
        
        if (
iPlayer == id)
            continue;
        
        
get_user_ip(iPlayersIP2charsmax(sIP2), 1);
        
        if (
equal(sIP1sIP2))
        {
            
server_cmd("kick #%d ^"Sorryonly one client per IP connected at a time^""get_user_userid(id));
            break;
        }
    }
}
#endif 

thx is working
yoni279 is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 16:14.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode