Raised This Month: $344 Target: $400
 86%   Almost there!

Detecting JUMP+DUCK to boost yourself


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
marcelowzd
Senior Member
Join Date: Feb 2011
Location: São Paulo, Brazil
Old 11-13-2018 , 15:21   Detecting JUMP+DUCK to boost yourself
Reply With Quote #1

Hi guys,

I'm trying to detect, in bhop, when a player uses the JUMP + DUCK trick to give himself a "boost"

If you don't know how to reproduce this, just hold jump and duck while you bhop and when you're in the ground release the duck button, you'll go a bit higher (at least it looks like it)

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

public plugin_init( )
{
    
register_forwardFM_PlayerPreThink"OnClientPreThink" );
}

public 
OnClientPreThinkiClient )
{
    if( !
is_user_aliveiClient ) )
        return 
FMRES_IGNORED;

    static 
biButtonsbiOldButtonsbiFlagsbiOldFlags;

    
biButtons peviClientpev_button );
    
biOldButtons peviClientpev_oldbuttons );
    
biFlags peviClientpev_flags );

    if( 
biButtons IN_JUMP && !( biButtons IN_DUCK ) && biOldButtons IN_DUCK && biOldFlags FL_ONGROUND )
    { 
        
client_printiClientprint_chat"Debug test" );
    }

    
biOldFlags biFlags;

    return 
FMRES_IGNORED;

I wrote this and it works (kinda) but there are some cases that it doesn't detect, because you can be above the ground already and still do this boost, so i need some tip in how to do this.

Thanks in advance.
__________________
marcelowzd is offline
SHIELD755
Veteran Member
Join Date: Feb 2018
Location: FROM MARVEL STUDIO
Old 11-13-2018 , 19:49   Re: Detecting JUMP+DUCK to boost yourself
Reply With Quote #2

is it amx_forcejump
__________________
SED LYF !!!
SHIELD755 is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 11-13-2018 , 20:01   Re: Detecting JUMP+DUCK to boost yourself
Reply With Quote #3

Add this and then do the scenario's that you are trying to detect to get the appropriate conditions? It's going to be tough with your code being in prethink.
PHP Code:
server_print"[Old Jump=%d] [Jump=%d] [Old Duck=%d] [Duck=%d] [OnGround=%d]" , !!(biOldButtons IN_JUMP) , !!(biButtons IN_JUMP) , !!(biOldButtons IN_DUCK) , !!(biOldButtons IN_DUCK) , !!(biOldFlags FL_ONGROUND) ) 
Or this?
PHP Code:
    if ( ( biButtons IN_JUMP && !( biButtons IN_DUCK ) && biOldButtons IN_DUCK && biOldFlags FL_ONGROUND ) ||
       ( ( 
biOldButtons IN_JUMP && biButtons IN_JUMP ) && ( biOldButtons IN_DUCK && biButtons IN_DUCK ) && !( biFlags FL_ONGROUND ) ) ) 
__________________

Last edited by Bugsy; 11-13-2018 at 20:02.
Bugsy is offline
SHIELD755
Veteran Member
Join Date: Feb 2018
Location: FROM MARVEL STUDIO
Old 11-14-2018 , 02:11   Re: Detecting JUMP+DUCK to boost yourself
Reply With Quote #4

Quote:
Originally Posted by Bugsy View Post
Add this and then do the scenario's that you are trying to detect to get the appropriate conditions? It's going to be tough with your code being in prethink.
PHP Code:
server_print"[Old Jump=%d] [Jump=%d] [Old Duck=%d] [Duck=%d] [OnGround=%d]" , !!(biOldButtons IN_JUMP) , !!(biButtons IN_JUMP) , !!(biOldButtons IN_DUCK) , !!(biOldButtons IN_DUCK) , !!(biOldFlags FL_ONGROUND) ) 
Or this?
PHP Code:
    if ( ( biButtons IN_JUMP && !( biButtons IN_DUCK ) && biOldButtons IN_DUCK && biOldFlags FL_ONGROUND ) ||
       ( ( 
biOldButtons IN_JUMP && biButtons IN_JUMP ) && ( biOldButtons IN_DUCK && biButtons IN_DUCK ) && !( biFlags FL_ONGROUND ) ) ) 

is it amx_forcejump that detect BHOP ?
__________________
SED LYF !!!
SHIELD755 is offline
marcelowzd
Senior Member
Join Date: Feb 2011
Location: São Paulo, Brazil
Old 11-14-2018 , 07:39   Re: Detecting JUMP+DUCK to boost yourself
Reply With Quote #5

Quote:
Originally Posted by Bugsy View Post
Add this and then do the scenario's that you are trying to detect to get the appropriate conditions? It's going to be tough with your code being in prethink.
PHP Code:
server_print"[Old Jump=%d] [Jump=%d] [Old Duck=%d] [Duck=%d] [OnGround=%d]" , !!(biOldButtons IN_JUMP) , !!(biButtons IN_JUMP) , !!(biOldButtons IN_DUCK) , !!(biOldButtons IN_DUCK) , !!(biOldFlags FL_ONGROUND) ) 
Or this?
PHP Code:
    if ( ( biButtons IN_JUMP && !( biButtons IN_DUCK ) && biOldButtons IN_DUCK && biOldFlags FL_ONGROUND ) ||
       ( ( 
biOldButtons IN_JUMP && biButtons IN_JUMP ) && ( biOldButtons IN_DUCK && biButtons IN_DUCK ) && !( biFlags FL_ONGROUND ) ) ) 
I Just did with prethink because the original bhop plugin uses this, but i Will Also try with CmdStart and post the results

Quote:
Originally Posted by SHIELD755 View Post
is it amx_forcejump
No It isn't
__________________
marcelowzd is offline
SHIELD755
Veteran Member
Join Date: Feb 2018
Location: FROM MARVEL STUDIO
Old 11-14-2018 , 09:40   Re: Detecting JUMP+DUCK to boost yourself
Reply With Quote #6

Quote:
Originally Posted by marcelowzd View Post
I Just did with prethink because the original bhop plugin uses this, but i Will Also try with CmdStart and post the results


No It isn't

do you know where i can gey that amx_forcejump
__________________
SED LYF !!!
SHIELD755 is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 11-14-2018 , 18:47   Re: Detecting JUMP+DUCK to boost yourself
Reply With Quote #7

IIRC, cmdstart is every frame also
__________________
Bugsy is offline
Reply


Thread Tools
Display Modes

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 22:13.


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