help with KEY_UP?
#1

Hello, everybody. Well today i have an issue with KEY_UP, i know that i cannot be used under OnPlayerKeyStateChange, so it brings me an issue. I am using a menu and i need for the values in the my array to change every time i either press KEY_UP, or KEY_DOWN so i would know where i am at and so that my NPC would, be holding a right object. What i did is i put GetPlayerKeys, under OnPlayerUpdate and it does work, but there is an issue. The issue is that it recognizes the key even when it is being held down and then my array gets screwed up, since the menu selection does not change when the key is held down. How can i only recognize when KEY_UP or KEY_DOWN is only being pressed and not held down? Or is there a different way to do, that i am trying to accomplish here? And i am basically, just trying to remake a Single Player food ordering system.
Reply
#2

Add a var under onplayerupdate that utilizes a timer of how ever many seconds you think best so the code is only fired once every so many seconds?
Reply
#3

There is no better way for doing this? Because if the player is holding, the key for lets say a long time, the timer will fire the code, but the selection in the menu wont change.. it only changes when you press the button. There has to be a way to do this, because there is a server with singleplayer features. Any other ideas?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)