AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Player is holding a button (https://forums.alliedmods.net/showthread.php?t=277601)

DavidLin 01-12-2016 04:47

Player is holding a button
 
Hello,

How can I detect if player is holding a button in FM_CmdStart and detect when he releases it ?

raizo11 01-12-2016 05:03

Re: Player is holding a button
 
If you want to bind keys is considered slowhacking is not supported here.

Baws 01-12-2016 05:10

Re: Player is holding a button
 
Quote:

Originally Posted by raizo11 (Post 2382450)
If you want to bind keys is considered slowhacking is not supported here.

True, but maybe he wants to do something other than that.

DavidLin 01-12-2016 05:32

Re: Player is holding a button
 
Fixed it, needed to get oldbuttons.

PHP Code:

public CmdStartiduc_handle ) {

        if( !
is_user_aliveid ) )
                return 
FMRES_IGNORED;

        static 
buttonoldbuttons;
        
button get_ucuc_handleUC_Buttons );
        
oldbuttons pevidpev_oldbuttons );

        if( 
button IN_USE && !( oldbuttons IN_USE ) && !is_fArmorid ] ) {

                if( 
nextAvailableid ] > get_gametime( ) ) {
                        
client_printidprint_chat"You can't armor yourself yet!" );
                        return 
FMRES_IGNORED;
                }
                
fArmorid );
        }
        else if( !( 
button IN_USE ) && is_fArmorid ] )
                
fArmoridtrue );
        else if( 
button & (IN_FORWARD|IN_BACK|IN_DUCK|IN_MOVELEFT|IN_MOVERIGHT|IN_JUMP|IN_ATTACK|IN_ATTACK2) && is_fArmorid ] )
                
fArmoridfalse );

        return 
FMRES_IGNORED;




All times are GMT -4. The time now is 09:25.

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