Raised This Month: $ Target: $400
 0% 

check if player is pressing the use key


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
mammapappa
Member
Join Date: Nov 2008
Old 03-02-2015 , 15:15   check if player is pressing the use key
Reply With Quote #1

how can i do this?
mammapappa is offline
VoiDeD
AlliedModders Donor
Join Date: Mar 2009
Location: Illinois, USA
Old 03-02-2015 , 15:31   Re: check if player is pressing the use key
Reply With Quote #2

Code:
if ( GetClientButtons( client ) & IN_USE )
{
    // ...
}
__________________
VoiDeD is offline
mammapappa
Member
Join Date: Nov 2008
Old 03-02-2015 , 15:50   Re: check if player is pressing the use key
Reply With Quote #3

Quote:
Originally Posted by VoiDeD View Post
Code:
if ( GetClientButtons( client ) & IN_USE )
{
    // ...
}
thank you, is there anywhere i can find a list of all the key commands?
mammapappa is offline
TnTSCS
AlliedModders Donor
Join Date: Oct 2010
Location: Undisclosed...
Old 03-02-2015 , 15:54   Re: check if player is pressing the use key
Reply With Quote #4

entity_prop_stocks.inc

PHP Code:
// These defines are for client button presses.
#define IN_ATTACK        (1 << 0)
#define IN_JUMP            (1 << 1)
#define IN_DUCK            (1 << 2)
#define IN_FORWARD        (1 << 3)
#define IN_BACK            (1 << 4)
#define IN_USE            (1 << 5)
#define IN_CANCEL        (1 << 6)
#define IN_LEFT            (1 << 7)
#define IN_RIGHT        (1 << 8)
#define IN_MOVELEFT        (1 << 9)
#define IN_MOVERIGHT        (1 << 10)
#define IN_ATTACK2        (1 << 11)
#define IN_RUN            (1 << 12)
#define IN_RELOAD        (1 << 13)
#define IN_ALT1            (1 << 14)
#define IN_ALT2            (1 << 15)
#define IN_SCORE        (1 << 16)       /**< Used by client.dll for when scoreboard is held down */
#define IN_SPEED        (1 << 17)    /**< Player is holding the speed key */
#define IN_WALK            (1 << 18)    /**< Player holding walk key */
#define IN_ZOOM            (1 << 19)    /**< Zoom key for HUD zoom */
#define IN_WEAPON1        (1 << 20)    /**< weapon defines these bits */
#define IN_WEAPON2        (1 << 21)    /**< weapon defines these bits */
#define IN_BULLRUSH        (1 << 22)
#define IN_GRENADE1        (1 << 23)    /**< grenade 1 */
#define IN_GRENADE2        (1 << 24)    /**< grenade 2 */
#define IN_ATTACK3        (1 << 25) 
__________________
View my Plugins | Donate
TnTSCS is offline
KissLick
Veteran Member
Join Date: Nov 2012
Location: void
Old 03-02-2015 , 16:05   Re: check if player is pressing the use key
Reply With Quote #5

Quote:
Originally Posted by mammapappa View Post
thank you, is there anywhere i can find a list of all the key commands?
Yeah, google ;-) :-D
KissLick is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 03-02-2015 , 16:46   Re: check if player is pressing the use key
Reply With Quote #6

Of course, not every game supports every button. For example, IN_ATTACK3 is likely TF2-only... it's only used by the MvM Medic Shield.
__________________
Not currently working on SourceMod plugin development.
Powerlord 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 02:31.


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