Raised This Month: $ Target: $400
 0% 

No HE plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Toster v2.1
Senior Member
Join Date: Oct 2006
Location: Latvia, Riga
Old 06-12-2007 , 01:30   No HE plugin
Reply With Quote #1

Can someone tell me what I'm doing wrong? Sometimes it works sometimes not...

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

#define PLUGIN "Anti HE"
#define VERSION "1.0"
#define AUTHOR "Toster v 2.1"

new wname
new clip,ammo
new file[128]
new buf[128]

public plugin_init() 
{
    register_plugin(PLUGIN, VERSION, AUTHOR)
    register_forward(FM_PlayerPreThink, "Prethink", 0)
    checkmap()
    register_cvar("amx_antihe","1")
}

public Prethink(id)
{
    wname=get_user_weapon(id,clip,ammo)
    
    if(get_cvar_num("amx_antihe")!=0)
    {
      if((pev(id,pev_button)&IN_ATTACK)&&wname==4)
      {
        set_pev(id,pev_button,IN_CANCEL)
      }
    }
}

public checkmap()
{
    if(get_cvar_num("amx_antihe")!=0)
    {
    
        set_cvar_num("amx_antihe",0)
        get_configsdir(file,127)
        format(file[strlen(file)],127-strlen(file),"/antihemaps.txt")
    
        new trash
        new next
        new cur[128]
    
        get_mapname(cur,127)
        while((next = read_file(file,next,buf,127,trash)) != 0)if(equali(cur,buf))set_cvar_num("amx_antihe",1)
    }
}
antihemaps.txt
Code:
cs_deagle5
deagleknivez
fy_pool_day
__________________
I am 52% addicted to Counterstrike. What about you?
Toster v2.1 is offline
Send a message via Skype™ to Toster v2.1
pRED*
Join Date: Dec 2006
Old 06-12-2007 , 02:44   Re: No HE plugin
Reply With Quote #2

You'd probably need to make it something like

set_pev(id,pev_button, pev(id,pev_button) | IN_CANCEL)

Theres another way to do it too ~| IN_CANCEL maybe?

But anyway that's a really inefficient way to block HE throwing. Prethink is called every frame.. so lots.. 60 per second +?

What I'd do is hook the curweapon event (use register_event), this is called on every weapon switch, fire, reload and maybe a few other things.

Check if the current weapon is a HE and then force switch the user to knife or remove the grenade from them (set_user_weapons should work I think).
pRED* is offline
Toster v2.1
Senior Member
Join Date: Oct 2006
Location: Latvia, Riga
Old 06-12-2007 , 03:40   Re: No HE plugin
Reply With Quote #3

I've got it! I had to put register_cvar("amx_antihe","1") before all the evnts!
__________________
I am 52% addicted to Counterstrike. What about you?
Toster v2.1 is offline
Send a message via Skype™ to Toster v2.1
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 10:32.


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