AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Detecting JUMP+DUCK to boost yourself (https://forums.alliedmods.net/showthread.php?t=312041)

marcelowzd 11-13-2018 15:21

Detecting JUMP+DUCK to boost yourself
 
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.

SHIELD755 11-13-2018 19:49

Re: Detecting JUMP+DUCK to boost yourself
 
is it amx_forcejump

Bugsy 11-13-2018 20:01

Re: Detecting JUMP+DUCK to boost yourself
 
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 ) ) ) 


SHIELD755 11-14-2018 02:11

Re: Detecting JUMP+DUCK to boost yourself
 
Quote:

Originally Posted by Bugsy (Post 2623930)
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 ?

marcelowzd 11-14-2018 07:39

Re: Detecting JUMP+DUCK to boost yourself
 
Quote:

Originally Posted by Bugsy (Post 2623930)
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 (Post 2623927)
is it amx_forcejump

No It isn't

SHIELD755 11-14-2018 09:40

Re: Detecting JUMP+DUCK to boost yourself
 
Quote:

Originally Posted by marcelowzd (Post 2623973)
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

Bugsy 11-14-2018 18:47

Re: Detecting JUMP+DUCK to boost yourself
 
IIRC, cmdstart is every frame also


All times are GMT -4. The time now is 13:39.

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