While pressing space?
#1

How can I repeat a function without a timer, as long as the player is pressing space?
Like:

While pressing space: repeat untill not holding it anymore.
I need to know this for a fuel system..


New problem;
The same gamemode I'm working on, it's restricted to Palomino with a mapping revamp, But I'd like to check when ever someone get's out the XY that I can get, He should be TPed to inside with some XYZ I got, But the problem is that, OnPlayerUpdate is way too much called, Heard around40 times a second, So how is the best way to call this thing on?
Which callback, or should I create a timer?
Reply
#2

You're going to need a timer anyway. Start timer on key press, kill timer on key release.
Reply
#3

Quote:
Originally Posted by Vince
Посмотреть сообщение
You're going to need a timer anyway. Start timer on key press, kill timer on key release.
Or more optmized, use GetTime/GetTickCount for this...
Reply
#4

Ehm no, if something has to update (textdraw, I imagine) while holding the key (e.g. pumping fuel) then you really have no other choice but timers. If you only want to calculate the time the key was held then yes, gettime will work.
Reply
#5

Quote:
Originally Posted by Vince
Посмотреть сообщение
Ehm no, if something has to update (textdraw, I imagine) while holding the key (e.g. pumping fuel) then you really have no other choice but timers. If you only want to calculate the time the key was held then yes, gettime will work.
Really, I have not read the full post :/
Reply
#6

How many millisecswould you suggest?
Reply
#7

I think, it depends on what kind of system you have. Set to 1000ms, if it takes too long for the process to be complete then you can reduce it. But don't use bellow 500ms I'd say.
Reply
#8

Updated thread for a new problem, thought if I'd create a new one I'd just get pm's about spam posting.
Reply
#9

I didn't really understand what you mean by that. Are you talking about, if a player leaves Palomino Creek, they will be teleported back in? If so, use streamer plugin to create dynamic areas, then you can use OnPlayerLeaveDynamicArea callback.
Reply
#10

Oh, didn't knew it exists. Thanks.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)