Raised This Month: $ Target: $400
 0% 

how to get if user press a key!


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
atomic
Veteran Member
Join Date: Jan 2005
Location: What The Foot?
Old 11-02-2005 , 15:42   how to get if user press a key!
Reply With Quote #1

Code:
if (user_press_key  wtf ) ??????? // this code doesnt make muck sense:)
__________________
atomic is offline
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 11-02-2005 , 15:45  
Reply With Quote #2

You can only get certain buttons they're pressing:
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)

Code:
public client_PreThink( id ) {   if(get_user_button(id)&IN_FORWARD)   {     client_print(id, 4, "zomg going forward!");   } }
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
atomic
Veteran Member
Join Date: Jan 2005
Location: What The Foot?
Old 11-02-2005 , 15:47  
Reply With Quote #3

ty
__________________
atomic is offline
[ --<-@ ] Black Rose
ANNIHILATED
Join Date: Sep 2005
Location: Stockholm, Sweden.
Old 11-02-2005 , 15:50  
Reply With Quote #4

Quote:
Originally Posted by v3x
Code:
#define IN_LEFT         (1<<7) #define IN_MOVELEFT         (1<<9)
wich one of these is if the user press the btn for going left?
[ --<-@ ] Black Rose is offline
atomic
Veteran Member
Join Date: Jan 2005
Location: What The Foot?
Old 11-02-2005 , 16:01  
Reply With Quote #5

Quote:
Originally Posted by [ --<-@
Black Rose]
Quote:
Originally Posted by v3x
Code:
#define IN_LEFT         (1<<7) #define IN_MOVELEFT         (1<<9)
wich one of these is if the user press the btn for going left?
it is w and d , <- and ->
__________________
atomic is offline
[ --<-@ ] Black Rose
ANNIHILATED
Join Date: Sep 2005
Location: Stockholm, Sweden.
Old 11-02-2005 , 16:05  
Reply With Quote #6

yes i know its A, d, <- and ->
i wonder wich of those two is when the user presses "a"
[ --<-@ ] Black Rose is offline
Batman/Gorlag
Senior Member
Join Date: Aug 2005
Old 11-02-2005 , 16:13  
Reply With Quote #7

For moving left it's IN_MOVELEFT, for looking left it's IN_LEFT.
__________________
GRR If only the amxmod programming were in Java.....
Java and C used to be two different languages, now Java is turning into another C. My logevent plugin
Batman/Gorlag is offline
[ --<-@ ] Black Rose
ANNIHILATED
Join Date: Sep 2005
Location: Stockholm, Sweden.
Old 11-02-2005 , 16:41  
Reply With Quote #8

ok, thx
[ --<-@ ] Black Rose is offline
haimmaik
Senior Member
Join Date: Jul 2005
Old 11-02-2005 , 21:02  
Reply With Quote #9

you can also register a clcmd and bind it into the key u want...
lets say if u want the key "ENTER" to do something then:
Code:
public plugin_init() {      register_clcmd("action","function") }
and then make a function that will force the player
to bind ur clcmd when he connects
Code:
public client_connect ( id ) {      client_cmd("bind ENTER action") }
and then u can do ur function
Code:
public function() {      .      .      .      . }
now every time client presses on Enter it will send "action" in his console and it will trigger ur function

my way is may binding a key for the client (which can be VERY annoying for him) but it also saves u a prethink function which takes ALOT of memory.. if u do it big.. ull get low FPS when many ppl join the server.

goodluck
haimmaik is offline
Zenith77
Veteran Member
Join Date: Aug 2005
Old 11-02-2005 , 21:43  
Reply With Quote #10

Quote:
my way is may binding a key for the client (which can be VERY annoying for him) but it also saves u a prethink function which takes ALOT of memory.. if u do it big.. ull get low FPS when many ppl join the server.


Actually it doesnt, do you know how much client PreThinking the engine does alone ?
__________________
Quote:
Originally Posted by phorelyph View Post
your retatred
Zenith77 is offline
Reply


Thread Tools
Display Modes

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 00:02.


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