Raised This Month: $51 Target: $400
 12% 

Block using HE on time


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
krysteksulek
Member
Join Date: Aug 2013
Location: Poland
Old 08-24-2013 , 17:32   Block using HE on time
Reply With Quote #1

Hi.
I found plugin which bloks using HE:

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

const XO_WEAPONS = 4;
const m_flNextPrimaryAttack = 46;

public plugin_init( )
{
    RegisterHam( Ham_Item_Deploy, "weapon_hegrenade", "Block", 1 );
}

public Block( ent )
{
    set_pdata_float( ent, m_flNextPrimaryAttack, 9999.0, XO_WEAPONS );
    return HAM_SUPERCEDE;
}
It's working great. I want someone to edit it for me, to block hegrenade for 15 sec after roundstart + print chat with timer (example in plugin below)

I have plugin which uses client_PreThink. It's working too, but when i'm trying to throw hegrenade (when it's bloked of course), it flashes for a few seconds:

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

#define m_flNextAttack 83

new pCvarTime, blocktime;

public plugin_init()
{
    register_plugin("Block HE", "9", "QTM. Peyote");
    register_logevent("Start", 2, "1=Round_Start"); 
    register_forward(FM_PlayerPreThink, "client_PreThink");
    
    pCvarTime = register_cvar("cod_he", "15");
}

public client_PreThink(id)
{
    if(task_exists(-44) && get_user_weapon(id) == CSW_HEGRENADE)
    {
        client_print(id, print_center, "He will be enabled in %i second's.", blocktime);
        set_pdata_float(id, m_flNextAttack, 0.1 , 5);
    }
}
public Start()
    set_task(1.0, "Unlock", -44, _, _, "a", blocktime = get_pcvar_num(pCvarTime));

public Unlock()
    blocktime--;
I hope you will help me
krysteksulek is offline
krysteksulek
Member
Join Date: Aug 2013
Location: Poland
Old 09-16-2013 , 15:59   Re: Block using HE on time
Reply With Quote #2

Refresh
krysteksulek is offline
Old 09-17-2013, 02:19
dark_style
This message has been deleted by dark_style. Reason: nvm
krysteksulek
Member
Join Date: Aug 2013
Location: Poland
Old 10-02-2013 , 11:35   Re: Block using HE on time
Reply With Quote #3

Refresh
krysteksulek is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 10-02-2013 , 12:38   Re: Block using HE on time
Reply With Quote #4

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

#pragma semicolon 1

#define PLUGIN "He Grenades Delay"
#define VERSION "0.0.1"

#define cm(%0)    ( sizeof(%0) - 1 )

const XO_CBASEPLAYERITEM 4;
const 
m_pPlayer 41;

const 
XO_CBASEPLAYERWEAPON 4;
 const 
m_flNextPrimaryAttack 46;

new 
g_pcvarHeGrenadeDelay;
new 
Float:g_flEnableHeGrenadesTime;

public 
plugin_init()
{
    
register_pluginPLUGINVERSION"ConnorMcLeod" );

    
g_pcvarHeGrenadeDelay register_cvar("amx_he_grenade_delay""15.0");
    
register_logevent("LogEvent_Round_Start"2"1=Round_Start");

    
RegisterHam(Ham_Weapon_PrimaryAttack"weapon_hegrenade""CHEGrenade_PrimaryAttack"false);
}

public 
LogEvent_Round_Start()
{
    
g_flEnableHeGrenadesTime get_gametime() + get_pcvar_float(g_pcvarHeGrenadeDelay);
}

public 
CHEGrenade_PrimaryAttackhe )
{
    new 
Float:diff g_flEnableHeGrenadesTime get_gametime();
    if( 
diff 0.0 )
    {
        
set_pdata_float(hem_flNextPrimaryAttackdiff 1.0 1.0 diffXO_CBASEPLAYERWEAPON);
        new 
id get_pdata_cbase(hem_pPlayerXO_CBASEPLAYERITEM);
        
client_print(idprint_center"HeGrenades will be enabled in %.1f second's."diff);
        return 
HAM_SUPERCEDE;
    }
    return 
HAM_IGNORED;

__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 10-02-2013 at 16:40.
ConnorMcLeod is offline
Bos93
Veteran Member
Join Date: Jul 2010
Old 10-02-2013 , 15:14   Re: Block using HE on time
Reply With Quote #5

ConnorMcLeod,

Pre hook.
Bos93 is offline
Send a message via ICQ to Bos93 Send a message via Skype™ to Bos93
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 17:12.


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