View Single Post
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