Raised This Month: $ Target: $400
 0% 

PreThink and client buttons


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
MrDev
Member
Join Date: Sep 2005
Old 10-29-2005 , 14:03   PreThink and client buttons
Reply With Quote #1

I'm trying to reverse the users direction. move left = move right etc.

Currently I have:

Code:
public client_PreThink ( id ) {         if(get_user_button(id) & IN_MOVELEFT)     {         client_cmd(id, "+moveright")     }                     else if (get_user_oldbutton(id) & IN_MOVELEFT)     {         client_cmd(id, "-moveright")     }         return FMRES_HANDLED }

but it won't work Maybe it's because i need to stop moving left first? I've tryed different approches but none worked. Prethink is called correctly.
MrDev is offline
Freecode
Never Fall Asleep
Join Date: Jan 2004
Old 10-29-2005 , 14:29  
Reply With Quote #2

to stop the other movement use the - sign.
so
Code:
client_cmd(id, "-moveleft") client_cmd(id, "+moveright")
Freecode is offline
MrDev
Member
Join Date: Sep 2005
Old 10-29-2005 , 16:49  
Reply With Quote #3

Without trying I think you're wrong.

You see the idea here is to move as long as you hold down the button, when you release the button you stop move.

If you only write +moveright you will move right until the command "-moveright" is entered.
MrDev is offline
Charr
Senior Member
Join Date: Jul 2005
Location: Long Island, New York, U
Old 10-29-2005 , 17:05  
Reply With Quote #4

Hes right.

First in your plugin you have to stop them moving by using the:
Code:
-movedirection
Then you have to tell them to move the direction you want them to move. So use this:
Code:
 public client_PreThink ( id ) {         if(get_user_button(id) & IN_MOVELEFT)     {         client_cmd(id,"-moveleft")         client_cmd(id, "+moveright")     }                     else if (get_user_oldbutton(id) & IN_MOVELEFT)     {         client_cmd(id, "-moveright")     }         return FMRES_HANDLED }
__________________
Charr is offline
Send a message via AIM to Charr Send a message via MSN to Charr
MrDev
Member
Join Date: Sep 2005
Old 10-29-2005 , 17:22  
Reply With Quote #5

The problem is.. It's not working. I've already tried that and you just stand still when "trying" to move left instead of going right.. What's really annoys me is, that SHOULD work, and i really can't see why it wont.

1) User hold down a KEY -- It stop and begin to move right
2) User releases KEY. Now get_user_button & LEFT returns 0 and else if is called. old button is LEFT one time and it should then stop moving RIGHT.. but noooo
MrDev is offline
Charr
Senior Member
Join Date: Jul 2005
Location: Long Island, New York, U
Old 10-29-2005 , 17:46  
Reply With Quote #6

Instead of using prethink, try registering the +moveleft and +moveright.
__________________
Charr is offline
Send a message via AIM to Charr Send a message via MSN to Charr
[ --<-@ ] Black Rose
ANNIHILATED
Join Date: Sep 2005
Location: Stockholm, Sweden.
Old 10-29-2005 , 17:52  
Reply With Quote #7

whats FMRES_HANDELED ?
[ --<-@ ] Black Rose is offline
MrDev
Member
Join Date: Sep 2005
Old 10-29-2005 , 17:57  
Reply With Quote #8

Charr: Yeah, but i would really like it to work in prethink, I've used prethink before to make it so the user could not attack so this should be do-able. Thanks for the advice though
MrDev is offline
Charr
Senior Member
Join Date: Jul 2005
Location: Long Island, New York, U
Old 10-29-2005 , 18:46  
Reply With Quote #9

Try using a test script were you could use something like client_print instead moving the player.
__________________
Charr is offline
Send a message via AIM to Charr Send a message via MSN to Charr
[ --<-@ ] Black Rose
ANNIHILATED
Join Date: Sep 2005
Location: Stockholm, Sweden.
Old 10-29-2005 , 19:29  
Reply With Quote #10

its flimmering... or w/e... does IN_MOVELEFT means, player is pressing "go left btn" or player is going left or maby something else...?
[ --<-@ ] Black Rose 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 23:50.


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