Raised This Month: $51 Target: $400
 12% 

Solved [Help] Kick specific ip


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
JohnyS
Junior Member
Join Date: Feb 2019
Old 12-12-2021 , 03:16   [Help] Kick specific ip
Reply With Quote #1

Hello, i have this plugin that kick a specific player after 10 seconds after connection, but sometimes the plugin kicks random people that don't have that ip can you help me fix it?
Code:
#include <amxmodx>
#include <amxmisc>

#define zIP     "86.119.131.121"

new const
PLUGIN_NAME[ ] 		= "[Enduro]Autokick Enemy",
PLUGIN_VERSION[ ] 	= "1.1";

public plugin_init( )
{
	register_plugin( PLUGIN_NAME, PLUGIN_VERSION, "Rodney" );
	// Add your code here...
}

public client_connect( id )
{
    new szIP[40], players[32], num;
    get_user_ip ( id, szIP, charsmax(szIP) , 1 ); // Get player's IP, without port.

    if(equali(szIP, zIP) )
    {
        set_task( 10.0, "task_KickPlayer", id );
    }
    return PLUGIN_HANDLED;
}

public task_KickPlayer( id )
{
	if( !is_user_connected( id ) )
		return;
	
	server_cmd( "kick #%d ^"[Enduro] Your ip is blacklisted^"", get_user_userid( id ) );
	
}

Last edited by JohnyS; 12-18-2021 at 18:06.
JohnyS is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 12-12-2021 , 06:37   Re: [Help] Kick specific ip
Reply With Quote #2

The plugin checks the player's IP and kicks him 10 seconds later. There's no IP check again after the 10 seconds interval. Another player might have entered the server and received his id during this time.

Can you explain to me the logic behind this plugin? Isn't it easier to just ban the player?...
__________________

Last edited by OciXCrom; 12-12-2021 at 06:37.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
DJEarthQuake
Veteran Member
Join Date: Jan 2014
Location: Astral planes
Old 12-12-2021 , 06:37   Re: [Help] Kick specific ip
Reply With Quote #3

Quote:
Originally Posted by JohnyS View Post
Hello, i have this plugin that kick a specific player after 10 seconds after connection, but sometimes the plugin kicks random people that don't have that ip can you help me fix it?
Why not use addip?

Code:
addip 
Usage: addip <minutes> <ipaddress>


Use 0 minutes for permanent
addip 0 86.119.131.121
writeip
Writing listip.cfg.

listip 
IP filter list:
 86.119.131.121 : permanent
Block ISP (List grows as their IP's change)
Code:
addip 0 86.119.0.0    
writeip 
Writing listip.cfg.
listip            
IP filter list:
 86.119.131.121 : permanent
 86.119.  0.  0 : permanent
To fix your AMXX:
Client_connect is what you are using. Try client_putinserver. As it is given client_connect is not connected they are connecting. So then that ID you are kicking goes to somebody else.
__________________

Last edited by DJEarthQuake; 12-12-2021 at 06:44.
DJEarthQuake is offline
JohnyS
Junior Member
Join Date: Feb 2019
Old 12-14-2021 , 08:08   Re: [Help] Kick specific ip
Reply With Quote #4

Fixed with putinserver, thx
JohnyS 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