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

engine_const.inc questions


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ArtAttack
Senior Member
Join Date: Mar 2004
Location: Bordeaux, France
Old 04-23-2004 , 17:40   engine_const.inc questions
Reply With Quote #1

Hi all.

I'd like to use some functions included in the engine_const header file.
How to use for example :
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)


Here's an extract of my code in which i'd like to use that.
Code:
#define IN_DUCK #define IN_JUMP new buttona = EV_INT_button if (buttona=IN_JUMP)  buttona=IN_DUCK
So the players would be supposed to duck instead of jumping...
It compiles fine, but nothing happens.

I added that line to check the value of "buttona".
Code:
show_hudmessage(0,"%i",buttona)
But it returns the number "4" whatever the IN_DUCK, JUMP, ...

Any help would be appreciated ;)
ArtAttack is offline
Send a message via MSN to ArtAttack
IceMouse[WrG]
Senior Member
Join Date: Mar 2004
Old 04-23-2004 , 18:31  
Reply With Quote #2

Code:
new button = entity_get_int(id,EV_INT_button); if(button&IN_JUMP)     button |= IN_DUCK;
IceMouse[WrG] is offline
Send a message via AIM to IceMouse[WrG] Send a message via MSN to IceMouse[WrG] Send a message via Yahoo to IceMouse[WrG]
xeroblood
BANNED
Join Date: Mar 2004
Location: Toronto, Canada
Old 04-23-2004 , 21:03  
Reply With Quote #3

Also, In engine_stocks.inc you can find this function:
Code:
/* Get the Button(s) user is pressing */ stock get_user_button(id)     return entity_get_int(id, EV_INT_button)

Which is Exactly what IceMouse Posted above (in a round-about way)..

This way simply gives it to you in a simpler function: get_user_button(id)
xeroblood is offline
Send a message via MSN to xeroblood
ArtAttack
Senior Member
Join Date: Mar 2004
Location: Bordeaux, France
Old 04-23-2004 , 21:05  
Reply With Quote #4

Still doesn't work.
It tried that
Code:
new button = entity_get_int(id,EV_INT_button); if(button&IN_JUMP)     entity_set_int(id,button,IN_DUCK);
doen't work too.

edit : thanks i'll try with get_user_button
ArtAttack is offline
Send a message via MSN to ArtAttack
xeroblood
BANNED
Join Date: Mar 2004
Location: Toronto, Canada
Old 04-23-2004 , 21:07  
Reply With Quote #5

Code:
entity_set_int( id, EV_INT_button, IN_DUCK )
xeroblood is offline
Send a message via MSN to xeroblood
T(+)rget
Senior Member
Join Date: Mar 2004
Old 04-23-2004 , 23:05  
Reply With Quote #6

I think those flags are clientside only, which means you can't force those flags from the server.
T(+)rget is offline
xeroblood
BANNED
Join Date: Mar 2004
Location: Toronto, Canada
Old 04-23-2004 , 23:37  
Reply With Quote #7

Good Point!!
xeroblood is offline
Send a message via MSN to xeroblood
IceMouse[WrG]
Senior Member
Join Date: Mar 2004
Old 04-24-2004 , 01:03  
Reply With Quote #8

The buttons aren't read only, so if you're lucky enough to sneak it in just after the buttons are passed to the server and just before any physics code is executed, then you might get to sneak it in... Not going to happen
IceMouse[WrG] is offline
Send a message via AIM to IceMouse[WrG] Send a message via MSN to IceMouse[WrG] Send a message via Yahoo to IceMouse[WrG]
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 17:41.


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