Raised This Month: $ Target: $400
 0% 

Kill/Death Script Help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
SpyDevil
BANNED
Join Date: Jul 2010
Location: TURKiYE
Old 07-10-2010 , 06:56   Kill/Death Script Help
Reply With Quote #1

hi guyz. My friend wrote a script for me but there is a little problem at amx_banip. Can you help me for fix this pls ??

Code:
#include <amxmodx>
#include <amxmisc>

#define PLUGIN "Kill/Death Ban"
#define VERSION "0.0.2"
#define AUTHOR "AlicanC"


public plugin_init()
    {
    //Register plugin
    register_plugin(PLUGIN, VERSION, AUTHOR)
    
    //Register DeathMsg event
    register_event("DeathMsg", "Event_DeathMsg", "a")
    
    //Create ConVars
    if(!cvar_exists("kdban_kills"))
        {
        register_cvar("kdban_kills", "25", FCVAR_SERVER)
        }
    if(!cvar_exists("kdban_mindeaths"))
        {
        register_cvar("kdban_mindeaths", "2", FCVAR_SERVER)
        }
    }

public Event_DeathMsg()
    {
    //Find the attacker
    new attacker= read_data(1);
    //Get death and kill count
    new deaths= get_user_deaths(attacker);
    new kills= get_user_frags(attacker);
    //Check kills
    if(kills>=get_cvar_num("kdban_kills"))
        {
        //Check deaths
        if(deaths<=get_cvar_num("kdban_mindeaths"))
            {
            new ip[12];
            get_user_ip(attacker, ip, 12, 1)
            server_cmd("amx_banip %s", ip)
            server_exec();
            }
        }
    }
when player frag be 25, not banned by server. I think server says; couldnt find id or username. pls help. thanks.

Last edited by SpyDevil; 07-10-2010 at 08:09.
SpyDevil is offline
Send a message via ICQ to SpyDevil Send a message via MSN to SpyDevil
Amonel
Senior Member
Join Date: May 2009
Old 07-10-2010 , 07:09   Re: Kill/Death Script Help
Reply With Quote #2

server_cmd("amx_banip %s", ip)

you ban Name/Id not am ip...

use
server_cmd("amx_addban 0.0 %s", ip)
Amonel is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 07-10-2010 , 07:15   Re: Kill/Death Script Help
Reply With Quote #3

http://forums.alliedmods.net/showthread.php?t=131920
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
SpyDevil
BANNED
Join Date: Jul 2010
Location: TURKiYE
Old 07-10-2010 , 07:26   Re: Kill/Death Script Help
Reply With Quote #4

Quote:
Originally Posted by Amonel View Post
server_cmd("amx_banip %s", ip)

you ban Name/Id not am ip...

use
server_cmd("amx_addban 0.0 %s", ip)
thanks i try it.

Quote:
Originally Posted by ConnorMcLeod View Post
what?
SpyDevil is offline
Send a message via ICQ to SpyDevil Send a message via MSN to SpyDevil
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 07-10-2010 , 07:28   Re: Kill/Death Script Help
Reply With Quote #5

flag "k" doesn't exist.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
SpyDevil
BANNED
Join Date: Jul 2010
Location: TURKiYE
Old 07-10-2010 , 08:09   Re: Kill/Death Script Help
Reply With Quote #6

pff . Dont work ban command. Server says in the chat area to players, you ban xxx.xx.xx.xx (ip), but didnt ban. I look from console, ip writed listip.cfg but not anything in game ! pls help
SpyDevil is offline
Send a message via ICQ to SpyDevil Send a message via MSN to SpyDevil
SpyDevil
BANNED
Join Date: Jul 2010
Location: TURKiYE
Old 07-10-2010 , 08:10   Re: Kill/Death Script Help
Reply With Quote #7

Quote:
Originally Posted by ConnorMcLeod View Post
flag "k" doesn't exist.
i changed it to "a"
SpyDevil is offline
Send a message via ICQ to SpyDevil Send a message via MSN to SpyDevil
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 07-10-2010 , 08:39   Re: Kill/Death Script Help
Reply With Quote #8

PHP Code:
#include <amxmodx>

#define VERSION "0.0.3"

#define FIRST_PLAYER_ID    1

new g_iMaxPlayers
#define IsPlayer(%1)    ( FIRST_PLAYER_ID <= %1 <= g_iMaxPlayers )

new kdban_killskdban_mindeaths

public plugin_init()
{
    
register_plugin("Kill/Death Ban"VERSION"AlicanC")
    
    
register_event("DeathMsg""Event_DeathMsg""a""1>0")
    
    
kdban_kills register_cvar("kdban_kills""25"FCVAR_SERVER)

    
kdban_mindeaths register_cvar("kdban_mindeaths""2"FCVAR_SERVER)

    
g_iMaxPlayers get_maxplayers()
}

public 
Event_DeathMsg()
{
    new 
iVictim read_data(1)
    
CheckPlayeriVictim )

    new 
iKiller read_data(2)
    if( 
iKiller != iVictim && IsPlayer(iKiller) && is_user_connected(iKiller) )
    {
        
CheckPlayeriKiller )
    }
}

CheckPlayerid )
{
    if( 
get_user_frags(id) >= get_pcvar_num(kdban_kills) && get_user_deaths(id) <= get_pcvar_num(kdban_mindeaths) )
    {
        new 
ip[16]
        
get_user_ip(idipcharsmax(ip), true)
        
server_cmd("kick #%d;wait;addip 0 %s;wait;writeip"get_user_userid(id), ip)
    }    

__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 07-10-2010 at 13:19.
ConnorMcLeod is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 07-10-2010 , 09:01   Re: Kill/Death Script Help
Reply With Quote #9

Ahem. "<= kdban_mindeaths"
__________________
Arkshine is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 07-10-2010 , 12:53   Re: Kill/Death Script Help
Reply With Quote #10

FIXED
__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 07-10-2010 at 13:19.
ConnorMcLeod 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 07:12.


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