Raised This Month: $ Target: $400
 0% 

Kick for ip


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
bumbastik
Member
Join Date: Jan 2007
Old 06-25-2007 , 04:00   Kick for ip
Reply With Quote #1

How can I make next.. If player ip=127.0.0.1 (for example)) then kick player with reason and logs.
bumbastik is offline
Drak
Veteran Member
Join Date: Jul 2005
Old 06-25-2007 , 04:27   Re: Kick for ip
Reply With Quote #2

Code:
#include <amxmodx> #define PLUGIN "IP Kick" #define VERSION "1.0" #define AUTHOR "" #define NUM_IP 1   // How many IP's are there? static const KickReason[] = "REASON" // What is the kick reason? // Add the IP's here (That you want kicked) static const IP_TO_KICK[NUM_IP][256] = {     "127.0.0.1" } public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR) } public client_putinserver(id) {     new playerIP[64]     get_user_ip(id,playerIP,63,1);         new i;     for(i=0;i<sizeof(IP_TO_KICK);i++)     {         if(equal(playerIP,IP_TO_KICK[i]))         {             new userId = get_user_userid(id)             server_cmd("kickid %d %s",userId,KickReason);         }     } }

Just made this on the spot, but add all the IP's you want kicked in the "IP_TO_KICK" array, if you wannted to and another, it would like so:

Code:
// Add the IP's here (That you want kicked) static const IP_TO_KICK[NUM_IP][256] = {     "127.0.0.1",     "192.168.1.1"  // Another IP }

Make sure you change the define (NUM_IP) to the IP's in the array.
__________________
Oh yeah
Drak is offline
Send a message via MSN to Drak
bumbastik
Member
Join Date: Jan 2007
Old 06-25-2007 , 05:20   Re: Kick for ip
Reply With Quote #3

It not work( I make amxx with your code but add my admin ip and make my admin priority off. After restart server and join. So I was in game without problems and kicks (
bumbastik is offline
_Master_
Senior Member
Join Date: Dec 2006
Old 06-25-2007 , 08:24   Re: Kick for ip
Reply With Quote #4

You didn't expect it to actually work did you ?

Those IPs are "placeholders" for LOCAL IP ADDRESS !!!
_Master_ is offline
bumbastik
Member
Join Date: Jan 2007
Old 06-25-2007 , 10:20   Re: Kick for ip
Reply With Quote #5

Those ip used for example, but this code didnt work with any ips
bumbastik is offline
Drak
Veteran Member
Join Date: Jul 2005
Old 06-25-2007 , 13:46   Re: Kick for ip
Reply With Quote #6

Eh, i messed up the kick command. Try this:
Code:
#include <amxmodx> #define PLUGIN "IP Kick" #define VERSION "1.0" #define AUTHOR "" #define NUM_IP 1   // How many IP's are there? static const KickReason[] = "REASON" // What is the kick reason? // Add the IP's here (That you want kicked) static const IP_TO_KICK[NUM_IP][256] = {     "loopback" } public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR) } public client_putinserver(id) {     new playerIP[64]     get_user_ip(id,playerIP,63,1);         new i;     for(i=0;i<sizeof(IP_TO_KICK);i++)     {         if(equal(playerIP,IP_TO_KICK[i]))         {             new userId = get_user_userid(id)             server_cmd("amx_kick #%d %s",userId,KickReason);         }     } }
__________________
Oh yeah
Drak is offline
Send a message via MSN to Drak
bumbastik
Member
Join Date: Jan 2007
Old 06-26-2007 , 08:57   Re: Kick for ip
Reply With Quote #7

Hmmm sexy code)) Its work, but reason can be only one word ((. Oh yes, can you make that after kick player, some messages print in chat and in console. I try something:
Code:
public client_putinserver(id)
{
    new playerIP[64]
    get_user_ip(id,playerIP,63,1);
    
    new i;
    for(i=0;i<sizeof(IP_TO_KICK);i++)
    {
        if(equal(playerIP,IP_TO_KICK[i]))
        {    new name[32]
    get_user_name(id, name, 31)
               new userId = get_user_userid(id)
                server_cmd("amx_kick #%d %s",userId,KickReason);
    client_cmd(id, "echo ^"BlahBlahBlah^"; disconnect")
    client_print(0, print_chat, "BlahBlahBlah %s kicked!", name)
     }
    }
}
Not work(((
bumbastik is offline
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 06-26-2007 , 09:02   Re: Kick for ip
Reply With Quote #8

You can't print a msg. in conosle after player is kicked. :/...must do that before! And reason can be more that onw word 0o,in that code was just an e.g
__________________
Still...lovin' . Connor noob! Hello
Alka is offline
regalis
Veteran Member
Join Date: Jan 2007
Location: F*cking Germany
Old 06-26-2007 , 09:08   Re: Kick for ip
Reply With Quote #9

If you want to exec a command at the player who is getting kicked you should exec the command and do a delayed kick with set_task..
__________________
regalis is offline
bumbastik
Member
Join Date: Jan 2007
Old 06-26-2007 , 09:14   Re: Kick for ip
Reply With Quote #10

With set_task I tried. Not work.
Quote:
must do that before! And reason can be more that onw word 0o,in that code was just an e.g
Hmmm only one word, I tried and mix code. Can you
bumbastik 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 02:24.


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