AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Block Knife1 Attack (https://forums.alliedmods.net/showthread.php?t=171335)

PsychoGaming 11-04-2011 16:54

Block Knife1 Attack
 
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.

Devil259 11-04-2011 16:59

Re: Block Knife1 Attack
 
Hook Ham_Weapon_PrimaryAttack with weapon_knife and return HAM_SUPERCEDE.

The Inhabitant Of Heavens 11-04-2011 17:01

Re: Block Knife1 Attack
 
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



PsychoGaming 11-04-2011 17:11

Re: Block Knife1 Attack
 
Oo Thakns :D

Bugsy 11-04-2011 18:58

Re: Block Knife1 Attack
 
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 );



Devil259 11-05-2011 06:22

Re: Block Knife1 Attack
 
@Bugsy : Why hooking Ham_Weapon_SecondaryAttack to blocking Primary Attack ?

Bugsy 11-05-2011 09:10

Re: Block Knife1 Attack
 
did you read what I said above my code?

Devil259 11-05-2011 13:09

Re: Block Knife1 Attack
 
Yes but I don't understand ^^


All times are GMT -4. The time now is 14:18.

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