Raised This Month: $ Target: $400
 0% 

How to block grenade throw


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 04-25-2013 , 13:59   Re: How to block grenade throw
Reply With Quote #9

Try this

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

#define PLUGIN "HeBlock"
#define VERSION "2.1"
#define AUTHOR "FromTheFuture"

const Float:THROW_HEGREN_DELAY 15.0;

const 
XO_CBASEPLAYERITEM 4;
const 
m_pPlayer 41;

const 
XO_CBASEPLAYERWEAPON 4;
const 
m_flNextPrimaryAttack 46;

new 
Floatg_fNextThrowTime[33];

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR);
    
RegisterHamHam_Item_Deploy"weapon_hegrenade""OnCHEGrenade_Deploy_Post"true );
    
RegisterHamHam_Weapon_PrimaryAttack"weapon_hegrenade""OnCHEGrenade_PrimaryAttack"false );
}

public 
OnCHEGrenade_Deploy_PostpEntity )
{
    new 
id get_pdata_cbasepEntity m_pPlayer XO_CBASEPLAYERITEM );
    new 
Float:flWaitTime g_fNextThrowTime[id] - get_gametime();

    if( 
flWaitTime 0.0 )
    {
        
client_print(idprint_center"Please, wait %.0f seconds"flWaitTime);
        
set_pdata_float(pEntitym_flNextPrimaryAttackflWaitTimeXO_CBASEPLAYERWEAPON);
    }
}

public 
OnCHEGrenade_PrimaryAttackpEntity )
{
    new 
id get_pdata_cbasepEntity m_pPlayer XO_CBASEPLAYERITEM );
    new 
Float:flWaitTime g_fNextThrowTime[id] - get_gametime();

    if( 
flWaitTime 0.0 )
    {
        
client_print(idprint_center"Please, wait %.0f seconds"flWaitTime);
        
set_pdata_float(pEntitym_flNextPrimaryAttackflWaitTimeXO_CBASEPLAYERWEAPON);
        return 
HAM_SUPERCEDE;
    }
    return 
HAM_IGNORED;
}

public 
grenade_throw(idgidwid)
{
    if(
wid == CSW_HEGRENADE)
    {
        
g_fNextThrowTime[id] = get_gametime() + THROW_HEGREN_DELAY;
    }

__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 04-25-2013 at 13:59.
ConnorMcLeod is offline
 



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:46.


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