Raised This Month: $ Target: $400
 0% 

[Request] Block same IP Connect to Server


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Snitch
Veteran Member
Join Date: Sep 2013
Location: Kazakhstan
Old 07-08-2014 , 09:26   [Request] Block same IP Connect to Server
Reply With Quote #1

I have two brothers in server allowed entry from two computers but the same IP.

I want to block that you can not get into the server from the same IP.

It blocks only when there is already one in the server.
I want to check if they are allowed entry at the same time to server (when loading the server each get kick)
PHP Code:
#include < amxmodx >

#pragma semicolon 1

new g_iMaxPlayers;

public 
plugin_init() 
{
    
register_plugin"Block Same Ips""1.0""AlliedModders" );
    
    
g_iMaxPlayers get_maxplayers();
}

public 
client_connectclient )
{
    new 
bool:g_bDisconnect;
    
    
g_bDisconnect CheckIpAddressGetIpclient ) );
    
    if( 
g_bDisconnect UserKickclient"Someone is already connected with your ip address!" );
    
}

stock bool:CheckIpAddress( const szConnectIp[] )
{
    for( new 
1<= g_iMaxPlayersi++ )
    {
        if( !
is_user_connected) ) continue;
        
        if( 
equalszConnectIpGetIp) ) )
            return 
true;
    }
    
    return 
false;
}

stock GetIp( const index )
{
    static 
ip35 ];
    
    
get_user_ipindexipcharsmaxip ), );
    
    return 
ip;
}

stock UserKickiClientszReason[]="Unable to connect to server!" )
{
    
message_beginMSG_ONESVC_DISCONNECT, {0,0,0}, iClient );
    
write_stringszReason );
    
message_end();


Last edited by Snitch; 07-08-2014 at 09:30.
Snitch is offline
Send a message via Skype™ to Snitch
Old 07-08-2014, 11:16
ANTICHRISTUS
This message has been deleted by YamiKaitou. Reason: derailing thread with pointless bickering
Old 07-08-2014, 11:28
Snitch
This message has been deleted by YamiKaitou. Reason: derailing thread with pointless bickering
Old 07-08-2014, 11:36
ANTICHRISTUS
This message has been deleted by YamiKaitou. Reason: derailing thread with pointless bickering
Old 07-08-2014, 11:48
Snitch
This message has been deleted by YamiKaitou. Reason: derailing thread with pointless bickering
Old 07-08-2014, 13:35
joshknifer
This message has been deleted by YamiKaitou. Reason: derailing thread with pointless bickering
Old 07-08-2014, 13:57
Snitch
This message has been deleted by YamiKaitou. Reason: derailing thread with pointless bickering
Old 07-08-2014, 15:13
Kia
This message has been deleted by YamiKaitou. Reason: derailing thread with pointless bickering
Old 07-08-2014, 15:49
zmd94
This message has been deleted by YamiKaitou. Reason: derailing thread with pointless bickering
Old 07-08-2014, 15:51
Snitch
This message has been deleted by YamiKaitou. Reason: derailing thread with pointless bickering
Old 07-08-2014, 16:01
joshknifer
This message has been deleted by YamiKaitou. Reason: derailing thread with pointless bickering
Old 07-08-2014, 16:08
fysiks
This message has been deleted by YamiKaitou. Reason: derailing thread with pointless bickering
Old 07-08-2014, 16:23
Snitch
This message has been deleted by YamiKaitou. Reason: derailing thread with pointless bickering
Old 07-08-2014, 16:24
joshknifer
This message has been deleted by YamiKaitou. Reason: derailing thread with pointless bickering
Old 07-08-2014, 16:31
Snitch
This message has been deleted by YamiKaitou. Reason: derailing thread with pointless bickering
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 07-08-2014 , 16:40   Re: [Request] Block same IP Connect to Server
Reply With Quote #2

Try this
Code:
#include <amxmodx>

public client_connect(id)
{
	new players[32], num, ip[16], ip2[16], player;
	get_players(players, num);
	get_user_ip(id, ip, charsmax(ip), 1);
	
	for(new k = 0; k < num; k++)
	{
		player = players[k];
		if (player == id)
			continue;
		
		get_user_ip(player, ip2, charsmax(ip2), 1);
		if (equal(ip, ip2))
		{
			server_cmd("kick #%d ^"Someone is already connected with your ip address!^"", get_user_userid(id));
			break;
		}
	}
}
__________________
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; 07-10-2014 at 06:46. Reason: derailing thread with pointless bickering
YamiKaitou is offline
Snitch
Veteran Member
Join Date: Sep 2013
Location: Kazakhstan
Old 07-08-2014 , 17:01   Re: [Request] Block same IP Connect to Server
Reply With Quote #3

Quote:
Originally Posted by YamiKaitou View Post
Try this
Code:
#include <amxmodx>

public client_connect(id)
{
	new players[32], num, ip[16], ip2[16], player;
	get_players(players, num);
	get_user_ip(id, ip, charsmax(ip), 1);
	
	for(new k = 0; k < num; k++)
	{
		player = players[k];
		if (player == id)
			continue;
		
		get_user_ip(player, ip2, charsmax(ip2), 1);
		if (equal(ip, ip2))
		{
			server_cmd("kick #%d ^"Someone is already connected with your ip address!^"", get_user_userid(id));
			break;
		}
	}
}
NOT Work, still they can connect
First of all thanks for this help someone at least supported code.

You bet it will block them stressful that once the server? Receive KICK then do not let them get into a few seconds.

I will check this, I'd appreciate it if you read my request again (page 1)

Last edited by YamiKaitou; 07-10-2014 at 06:46. Reason: Edit Same Code.
Snitch is offline
Send a message via Skype™ to Snitch
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-08-2014 , 17:59   Re: [Request] Block same IP Connect to Server
Reply With Quote #4

Quote:
Originally Posted by Snitch View Post
NOT Work, still they can connect
What do you mean by "they can still connect"? They will always be able to connect but they will be immediately kicked. This is what you have requested.
__________________

Last edited by fysiks; 07-08-2014 at 18:00.
fysiks is offline
Snitch
Veteran Member
Join Date: Sep 2013
Location: Kazakhstan
Old 07-08-2014 , 20:09   Re: [Request] Block same IP Connect to Server
Reply With Quote #5

I mean that the code he gave me It's like I brought the code on page 1.
Just built differently, and they still can get into the server at the same time they click on the server
Snitch is offline
Send a message via Skype™ to Snitch
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 07-09-2014 , 00:36   Re: [Request] Block same IP Connect to Server
Reply With Quote #6

I just tested my plugin and it worked as expected
__________________
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).
YamiKaitou is offline
Snitch
Veteran Member
Join Date: Sep 2013
Location: Kazakhstan
Old 07-09-2014 , 04:13   Re: [Request] Block same IP Connect to Server
Reply With Quote #7

Quote:
Originally Posted by YamiKaitou View Post
I just tested my plugin and it worked as expected
I just tested you're plugin, and it dont work. Still they connect at same time
Snitch is offline
Send a message via Skype™ to Snitch
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 07-09-2014 , 04:19   Re: [Request] Block same IP Connect to Server
Reply With Quote #8

The it is something on your side as it works fine for me
__________________
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).
YamiKaitou is offline
Snitch
Veteran Member
Join Date: Sep 2013
Location: Kazakhstan
Old 07-09-2014 , 12:12   Re: [Request] Block same IP Connect to Server
Reply With Quote #9

Why are you lying, You know what I'm talking about?

Not that Player 1 has been in the server then connects to the other = not it!
Snitch is offline
Send a message via Skype™ to Snitch
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 07-09-2014 , 12:39   Re: [Request] Block same IP Connect to Server
Reply With Quote #10

Quote:
Originally Posted by Snitch View Post
Why are you lying, You know what I'm talking about?

Not that Player 1 has been in the server then connects to the other = not it!
Could you stop leaving this stupid comms ? You are rude with peoples that try to help you. If you think that you know better then why are you asking here for help ? You just waste our time and yours too.

Last edited by HamletEagle; 07-09-2014 at 12:39.
HamletEagle 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 20:19.


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