Raised This Month: $ Target: $400
 0% 

Checking ip same.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
yoni279
Member
Join Date: Feb 2010
Old 06-02-2013 , 15:40   Checking ip same.
Reply With Quote #1

listen if you can try to do if i type in chat : ipcheck
if someone with same ip like my ip are playing in my server its say "2 computers connected"
if not its say "only one computer connected.

Last edited by yoni279; 06-02-2013 at 18:02.
yoni279 is offline
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 06-02-2013 , 16:26   Re: Checking ip same.
Reply With Quote #2

PHP Code:
#include <amxmodx>

public plugin_cfg() register_plugin("Kick same Client IP",AMXX_VERSION_STR,"SmileY");

public 
client_putinserver(id)
{
    new 
iPlayers[32],iNum,Players;
    
get_players(iPlayers,iNum,"ch"); // Do not Kick BOTs or HLTVs
    
    
new szIP[33][17];
    
get_user_ip(id,szIP[id],charsmax(szIP[]),1// Get Users IP without port
    
    
for(new i;iNum;i++)  // Get all users IPs in server, and check if it is equal another address what is already in use
    
{
        
Players iPlayers[i];

        if(
Players == id) continue; // Removes self from LOOP to not check the same IP
        
        
get_user_ip(Players,szIP[i],charsmax(szIP[]),1); // Get IP of all players
        
        
if(equali(szIP[i],szIP[id])) server_cmd("kick #%d ^"Sorrythis IP address is already in use in server^"",get_user_userid(id));
    }

I suggest to test with care
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 

Last edited by ^SmileY; 06-02-2013 at 16:28.
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
yoni279
Member
Join Date: Feb 2010
Old 06-02-2013 , 17:25   Re: Checking ip same.
Reply With Quote #3

doesn't work
yoni279 is offline
TheDS1337
Veteran Member
Join Date: Jun 2012
Old 06-02-2013 , 17:39   Re: Checking ip same.
Reply With Quote #4

Try ...
Code:
#include < amxmodx >

public client_putinserver( Client )
{
	for( new Index = 1; Index <= get_maxplayers( ); Index++ )
	{
		static AddressIP[ 32 ][ 2 ];
		get_user_ip( Client, AddressIP[ 0 ], charsmax( AddressIP[ ] ) );
		get_user_ip( Index, AddressIP[ 1 ], charsmax( AddressIP[ ] ) );
		
		if( equal( AddressIP[ 0 ], AddressIP[ 1 ] ) )		
			server_cmd( "amx_kick ^"%s^"", AddressIP[ 0 ] );			
		
	}
}
TheDS1337 is offline
yoni279
Member
Join Date: Feb 2010
Old 06-02-2013 , 18:01   Re: Checking ip same.
Reply With Quote #5

listen if you can try to do if i type in chat : ipcheck
if someone with same ip like my ip are playing in my server its say "2 computers connected"
if not its say "only one computer connected.
what you give me not work
yoni279 is offline
TheDS1337
Veteran Member
Join Date: Jun 2012
Old 06-02-2013 , 18:10   Re: Checking ip same.
Reply With Quote #6

Code:
#include < amxmodx >

new g_Computers;
public plugin_init( )
	register_clcmd( "say ipcheck", "ClientCommand_IPCheck" );
	
public client_putinserver( Client )
{
	for( new Index = 1; Index <= get_maxplayers( ); Index++ )
	{
		static AddressIP[ 32 ], AddressIP2[ 32 ];
		get_user_ip( Client, AddressIP, charsmax( AddressIP ) );
		get_user_ip( Index, AddressIP2, charsmax( AddressIP2 ) );
		
		if( equal( AddressIP, AddressIP2 ) )
			g_Computers++;
	}
}

public ClientCommand_IPCheck( Client )
	client_print( Client, print_chat, g_Computers > 0 ? "%d Cumputers Connected!" : "Only One Cumputer Connected", g_Computers );
TheDS1337 is offline
yoni279
Member
Join Date: Feb 2010
Old 06-02-2013 , 18:18   Re: Checking ip same.
Reply With Quote #7

Quote:
Originally Posted by DeagLe.Studio View Post
Code:
#include < amxmodx >

new g_Computers;
public plugin_init( )
    register_clcmd( "say ipcheck", "ClientCommand_IPCheck" );
    
public client_putinserver( Client )
{
    for( new Index = 1; Index <= get_maxplayers( ); Index++ )
    {
        static AddressIP[ 32 ], AddressIP2[ 32 ];
        get_user_ip( Client, AddressIP, charsmax( AddressIP ) );
        get_user_ip( Index, AddressIP2, charsmax( AddressIP2 ) );
        
        if( equal( AddressIP, AddressIP2 ) )
            g_Computers++;
    }
}

public ClientCommand_IPCheck( Client )
    client_print( Client, print_chat, g_Computers > 0 ? "%d Cumputers Connected!" : "Only One Cumputer Connected", g_Computers );
isn't count only same ip is count all ip's try to fix it please.
yoni279 is offline
TheDS1337
Veteran Member
Join Date: Jun 2012
Old 06-02-2013 , 18:20   Re: Checking ip same.
Reply With Quote #8

Quote:
Originally Posted by yoni279 View Post
isn't count only same ip is count all ip's try to fix it please.
I don't understand what you need
TheDS1337 is offline
yoni279
Member
Join Date: Feb 2010
Old 06-02-2013 , 18:26   Re: Checking ip same.
Reply With Quote #9

Quote:
Originally Posted by DeagLe.Studio View Post
I don't understand what you need
i need plugin check if 2 coumpters with same ip like this for example:
people with this ip:212.150.176.32
connected and if some people with same ip "212.150.176.32" arleady in server is give connected people kick.
yoni279 is offline
TheDS1337
Veteran Member
Join Date: Jun 2012
Old 06-02-2013 , 18:28   Re: Checking ip same.
Reply With Quote #10

Code:
#include < amxmodx >

public client_putinserver( Client )
{
	for( new Index = 1; Index <= get_maxplayers( ); Index++ )
	{
		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 this again

Last edited by TheDS1337; 06-02-2013 at 18:29.
TheDS1337 is offline
Reply


Thread Tools
Display Modes

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