Raised This Month: $51 Target: $400
 12% 

detect if client hold and release button


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
AvaStIn
Senior Member
Join Date: Feb 2013
Location: Algeria
Old 11-16-2013 , 13:55   detect if client hold and release button
Reply With Quote #1

Hello i want to detect if client hold and release(unhold) a button , as en exemple , i want to know if this player pressed "S" backwards button... i want to know easiest way xD
__________________
Project : Speedrun / Fastrun / CrazySpeed & [FPS CATEGORY]

o [
||||||||||||||||||||] - 95%

Project : Upgraded Drshop To V6.0

o [||||||||||||||||||||]- 100%
AvaStIn is offline
micapat
Veteran Member
Join Date: Feb 2010
Location: Nyuu, nyuu (France).
Old 11-16-2013 , 16:14   Re: detect if client hold and release button
Reply With Quote #2

You can't detect a specific key, but you can detect actions ( Jump, crouch ... ).

<engine> + <fakemeta>:

PHP Code:
#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_SCORE        (1<<15)

stock const m_afButtonPressed 246;
stock const m_afButtonReleased 247
__________________
micapat is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 11-16-2013 , 16:15   Re: detect if client hold and release button
Reply With Quote #3

You cannot detect if a player has pressed a particular keyboard key. You can detect if they use a command that is sent to the server. So, to detect if they send the backwards command, you will use IN_DUCK constant. Look for threads that use other IN_* constants to see who they are used with pev buttons. See hlsdk_const.inc for all the IN_* constants.
__________________
fysiks 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 15:28.


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