Raised This Month: $ Target: $400
 0% 

Delay between buttons


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
yan1255
Senior Member
Join Date: Jul 2011
Old 08-15-2013 , 01:25   Delay between buttons
Reply With Quote #1

New Question:

Here I am trying to create a delay between using buttons..
now the trace attack seems to skip right to the client_print
and the ham_use seems to just do nothing... it normal...
PHP Code:
#include < amxmodx >
#include < fakemeta >
#include < hamsandwich >

new Float:fBug33 ];

public 
plugin_init()
{
    
RegisterHamHam_Use"func_button""FwdTraceButtonUse" );
    
    
RegisterHamHam_TraceAttack"func_button""FwdTraceButtonAttack" );
}

public 
client_putinserverclient )
{
    
fBugclient ] = get_gametime();
}

public 
FwdTraceButtonAttackentattacker )
{
    if ( 
fBugattacker ] + 1.5 get_gametime() )
    {
        
dllfuncDLLFunc_Useentattacker );
        
        
fBugattacker ] = get_gametime();
        
        return 
1;
    }
    
    
client_printattackerprint_center"You need to wait at least 1.5 Seconds between using buttons." );
    
    return 
1;
}

public 
FwdTraceButtonUseclient )
{
    if ( 
fBugclient ] + 1.5 get_gametime() )
    {
        
fBugclient ] = get_gametime();
    
        
client_printclientprint_center"You need to wait at least 1.5 Seconds between using buttons." );
        
        return 
1;
    }
    
    return 
4;

__________________

Last edited by yan1255; 08-15-2013 at 02:07.
yan1255 is offline
jimaway
Heeeere's Jimmy!
Join Date: Jan 2009
Location: Estonia
Old 08-15-2013 , 09:53   Re: Delay between buttons
Reply With Quote #2

Code:
/**
	 * Description:		Called whenver one entity uses another.
	 * Forward params:	function(this, idcaller, idactivator, use_type, Float:value)
	 * Return type:		None.
	 * Execute params:	ExecuteHam(Ham_Use, this, idcaller, idactivator, use_type, Float:value);
	 */
	Ham_Use
first param in the ham_use forward is the func_button entity id in your case
jimaway is offline
r0ck
Senior Member
Join Date: Jun 2011
Location: India
Old 08-15-2013 , 14:34   Re: Delay between buttons
Reply With Quote #3

This should work ......

EDIT: TESTED....

PHP Code:

#include < amxmodx >
#include < fakemeta > 
#include < hamsandwich > 

new Float:fBug33 ]; 

public 
plugin_init() 
{
    
register_plugin"Button Delay""1.0""R0CK" );
    
    if( 
engfunc(EngFunc_FindEntityByString, -1"classname""func_button") )
    {
        
RegisterHamHam_Use"func_button""FwdTraceButtonUse" );
        
RegisterHamHam_TraceAttack"func_button""FwdTraceButtonAttack" ); 
    }
    
    if( 
engfunc(EngFunc_FindEntityByString, -1"classname""func_rot_button") )
    {
        
RegisterHamHam_Use"func_rot_button""FwdTraceButtonUse" );
        
RegisterHamHam_TraceAttack"func_rot_button""FwdTraceButtonAttack" ); 
    }
    
    if( 
engfunc(EngFunc_FindEntityByString, -1"classname""button_target") )
    {
        
RegisterHamHam_Use"button_target""FwdTraceButtonUse" );
        
RegisterHamHam_TraceAttack"button_target""FwdTraceButtonAttack" ); 
    }
}

public 
client_putinserverclient 

    
fBugclient ] = 0.0
}

public 
FwdTraceButtonAttackbuttonid )
    if( 
pev_validbutton ) && is_user_aliveid ) )
        
ExecuteHamBHam_Usebuttonidid21.0 );

public 
FwdTraceButtonUse(thisidcalleridactivatoruse_typeFloat:value)

    if( !
is_user_alive(idcaller) || idcaller != idactivator )
        return 
HAM_IGNORED;
        
    if( 
fBugidcaller ] + 1.5 >= get_gametime() ) 
    {
        
client_printidcallerprint_center"You need to wait at least 1.5 Seconds between using buttons." ); 
         
        return 
HAM_SUPERCEDE
    }
    
    
fBugidcaller ] = get_gametime(); 
    
    return 
HAM_IGNORED

__________________
Preparing to release my plugins..

Last edited by r0ck; 08-15-2013 at 15:52. Reason: tested
r0ck 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 15:48.


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