AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Kick for ip (https://forums.alliedmods.net/showthread.php?t=56957)

bumbastik 06-25-2007 04:00

Kick for ip
 
How can I make next.. If player ip=127.0.0.1 (for example)) then kick player with reason and logs.

Drak 06-25-2007 04:27

Re: Kick for ip
 
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.

bumbastik 06-25-2007 05:20

Re: Kick for ip
 
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 :((

_Master_ 06-25-2007 08:24

Re: Kick for ip
 
You didn't expect it to actually work did you ?

Those IPs are "placeholders" for LOCAL IP ADDRESS !!!

bumbastik 06-25-2007 10:20

Re: Kick for ip
 
Those ip used for example, but this code didnt work with any ips

Drak 06-25-2007 13:46

Re: Kick for ip
 
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);         }     } }

bumbastik 06-26-2007 08:57

Re: Kick for ip
 
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(((

Alka 06-26-2007 09:02

Re: Kick for ip
 
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

regalis 06-26-2007 09:08

Re: Kick for ip
 
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..

bumbastik 06-26-2007 09:14

Re: Kick for ip
 
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


All times are GMT -4. The time now is 21:34.

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