Raised This Month: $ Target: $400
 0% 

Blocking weapon fire, including client-side sounds/animations


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 07-14-2010 , 09:02   Re: Blocking weapon fire, including client-side sounds/animations
Reply With Quote #1

hamsandwich provides weapons forward so there are more efficient methods to block weapon firing.
I use this one :

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

// weapons offsets
#define XO_WEAPONS 4
#define m_pPlayer 41
#define m_iId 43
#define m_flNextPrimaryAttack 46
#define m_flNextSecondaryAttack 47

// players offsets
#define XO_PLAYER 5
#define m_flNextAttack 83

public plugin_init()
{
    new 
szWeaponName[20]
    for(new 
i=CSW_P228i<=CSW_P90i++)
    {
        if( 
get_weaponname(iszWeaponNamecharsmax(szWeaponName)) )
        {
            
RegisterHam(Ham_Item_DeployszWeaponName"Weapons_Deploy"true)
        }
    }
}

public 
Weapons_Deploy(iWeapon)
{
    
// want to filter by player id ?
    
new id get_pdata_cbase(iWeaponm_pPlayerXO_WEAPONS)

    
// want to filter by weapon type ?
    // would be better not to register the corresponding weapon classname
    // but you may mix player+weapontype filters...
    
new iId get_pdata_int(iWeaponm_iIdXO_WEAPONS// you can use cs_get_weapon_id as well

    // 99999.0 = 27hours, should be enough.

    // want to block attack1 ?
    
set_pdata_float(iWeaponm_flNextPrimaryAttack99999.0XO_WEAPONS)

    
// want to block attack2 ?
    
set_pdata_float(iWeaponm_flNextSecondaryAttack99999.0XO_WEAPONS)

    
// also want to block +use ? (may block other things as impulse(impulse are put in a queue))
    
set_pdata_float(idm_flNextAttack99999.0XO_PLAYER)

__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
ot_207
Veteran Member
Join Date: Jan 2008
Location: Romania The Love Country
Old 07-14-2010 , 09:07   Re: Blocking weapon fire, including client-side sounds/animations
Reply With Quote #2

Quote:
Originally Posted by ConnorMcLeod View Post
hamsandwich provides weapons forward so there are more efficient methods to block weapon firing.
I use this one :

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

// weapons offsets
#define XO_WEAPONS 4
#define m_pPlayer 41
#define m_iId 43
#define m_flNextPrimaryAttack 46
#define m_flNextSecondaryAttack 47

// players offsets
#define XO_PLAYER 5
#define m_flNextAttack 83

public plugin_init()
{
    new 
szWeaponName[20]
    for(new 
i=CSW_P228i<=CSW_P90i++)
    {
        if( 
get_weaponname(iszWeaponNamecharsmax(szWeaponName)) )
        {
            
RegisterHam(Ham_Item_DeployszWeaponName"Weapons_Deploy"true)
        }
    }
}

public 
Weapons_Deploy(iWeapon)
{
    
// want to filter by player id ?
    
new id get_pdata_cbase(iWeaponm_pPlayerXO_WEAPONS)

    
// want to filter by weapon type ?
    // would be better not to register the corresponding weapon classname
    // but you may mix player+weapontype filters...
    
new iId get_pdata_int(iWeaponm_iIdXO_WEAPONS// you can use cs_get_weapon_id as well

    // 99999.0 = 27hours, should be enough.

    // want to block attack1 ?
    
set_pdata_float(iWeaponm_flNextPrimaryAttack99999.0XO_WEAPONS)

    
// want to block attack2 ?
    
set_pdata_float(iWeaponm_flNextSecondaryAttack99999.0XO_WEAPONS)

    
// also want to block +use ? (may block other things as impulse(impulse are put in a queue))
    
set_pdata_float(idm_flNextAttack99999.0XO_PLAYER)

Well, in my plugin I am not interested in blocking the weapon fire, just the client animation. And I already knew what you have posted here.
__________________
My approved plug-ins | Good for newbies! | Problems?

Back, will come around when I have time.
ot_207 is offline
SpyDevil
BANNED
Join Date: Jul 2010
Location: TURKiYE
Old 07-14-2010 , 10:28   Re: Blocking weapon fire, including client-side sounds/animations
Reply With Quote #3

Quote:
Originally Posted by ot_207 View Post
Well, in my plugin I am not interested in blocking the weapon fire, just the client animation. And I already knew what you have posted here.
he wrote for unknown people. Not for you and as you !
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-15-2010 , 06:07   Re: Blocking weapon fire, including client-side sounds/animations
Reply With Quote #4

Quote:
Originally Posted by ConnorMcLeod View Post
hamsandwich provides weapons forward so there are more efficient methods to block weapon firing.
I use this one :

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

// weapons offsets
#define XO_WEAPONS 4
#define m_pPlayer 41
#define m_iId 43
#define m_flNextPrimaryAttack 46
#define m_flNextSecondaryAttack 47

// players offsets
#define XO_PLAYER 5
#define m_flNextAttack 83

public plugin_init()
{
    new 
szWeaponName[20]
    for(new 
i=CSW_P228i<=CSW_P90i++)
    {
        if( 
get_weaponname(iszWeaponNamecharsmax(szWeaponName)) )
        {
            
RegisterHam(Ham_Item_DeployszWeaponName"Weapons_Deploy"true)
        }
    }
}

public 
Weapons_Deploy(iWeapon)
{
    
// want to filter by player id ?
    
new id get_pdata_cbase(iWeaponm_pPlayerXO_WEAPONS)

    
// want to filter by weapon type ?
    // would be better not to register the corresponding weapon classname
    // but you may mix player+weapontype filters...
    
new iId get_pdata_int(iWeaponm_iIdXO_WEAPONS// you can use cs_get_weapon_id as well

    // 99999.0 = 27hours, should be enough.

    // want to block attack1 ?
    
set_pdata_float(iWeaponm_flNextPrimaryAttack99999.0XO_WEAPONS)

    
// want to block attack2 ?
    
set_pdata_float(iWeaponm_flNextSecondaryAttack99999.0XO_WEAPONS)

    
// also want to block +use ? (may block other things as impulse(impulse are put in a queue))
    
set_pdata_float(idm_flNextAttack99999.0XO_PLAYER)

i did this but when i pressed mouse1, gun dont fire...
SpyDevil is offline
Send a message via ICQ to SpyDevil Send a message via MSN to SpyDevil
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 00:18.


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