Raised This Month: $ Target: $400
 0% 

Block Knife1 Attack


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
PsychoGaming
Junior Member
Join Date: Nov 2011
Old 11-04-2011 , 16:54   Block Knife1 Attack
Reply With Quote #1

I need block knife 1 attack ı have hidenseek server and we using knife2atack so ı need everytime block knife 1attack but only knife 1attack.


Thanks NOW.
PsychoGaming is offline
Devil259
Veteran Member
Join Date: Dec 2009
Location: France (59)
Old 11-04-2011 , 16:59   Re: Block Knife1 Attack
Reply With Quote #2

Hook Ham_Weapon_PrimaryAttack with weapon_knife and return HAM_SUPERCEDE.
Devil259 is offline
The Inhabitant Of Heavens
Member
Join Date: Aug 2011
Old 11-04-2011 , 17:01   Re: Block Knife1 Attack
Reply With Quote #3

PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>

const m_pPlayer                =                 41
const m_flNextPrimaryAttack        =                 46

public plugin_init() RegisterHam(Ham_Weapon_PrimaryAttack"weapon_knife""fw_Knife_PrimaryAttack_Post"1)

public 
fw_Knife_PrimaryAttack_Post(knife)
{    
    static 
id
    id 
get_pdata_cbase(knifem_pPlayer4)
    
    if(
is_user_connected(id) )
    {
        
set_pdata_float(knifem_flNextPrimaryAttack999.04)
    }
    return 
HAM_IGNORED

The Inhabitant Of Heavens is offline
PsychoGaming
Junior Member
Join Date: Nov 2011
Old 11-04-2011 , 17:11   Re: Block Knife1 Attack
Reply With Quote #4

Oo Thakns
PsychoGaming is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 11-04-2011 , 18:58   Re: Block Knife1 Attack
Reply With Quote #5

With that method the player can attack1 once and then it is blocked, plus, if an attack2 is done he can again use attack1 once; NextPrimaryAttack is reset when an attack2 is done. With my method it is blocked always so he can never use it.
PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>

public plugin_init() 
{
    
RegisterHamHam_Item_Deploy "weapon_knife" "BlockPrimaryKnife" );
    
RegisterHamHam_Weapon_SecondaryAttack "weapon_knife" "BlockPrimaryKnife" );
}

public 
BlockPrimaryKnifeiEntity )
{    
    static const 
EXTRAOFFSET_WEAPON 4;
    static const 
m_flNextPrimaryAttack 46;
    
    
set_pdata_floatiEntity m_flNextPrimaryAttack 9999.0 EXTRAOFFSET_WEAPON );

__________________

Last edited by Bugsy; 11-04-2011 at 19:02.
Bugsy is offline
Devil259
Veteran Member
Join Date: Dec 2009
Location: France (59)
Old 11-05-2011 , 06:22   Re: Block Knife1 Attack
Reply With Quote #6

@Bugsy : Why hooking Ham_Weapon_SecondaryAttack to blocking Primary Attack ?

Last edited by Devil259; 11-05-2011 at 06:22.
Devil259 is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 11-05-2011 , 09:10   Re: Block Knife1 Attack
Reply With Quote #7

did you read what I said above my code?
__________________
Bugsy is offline
Devil259
Veteran Member
Join Date: Dec 2009
Location: France (59)
Old 11-05-2011 , 13:09   Re: Block Knife1 Attack
Reply With Quote #8

Yes but I don't understand ^^
Devil259 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 14:18.


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