![]() |
Cant Control OnKeyPressed
Alright, right now I'm having a problem with a gun script.
The basic idea is that onKeyPressed() is calling the gun as if it were automatic (meaning you hold down the fire button, and tons of bullets fly out) I need this to be limited to one shot per X seconds. Any suggestions for methods? Note: to all of you just looking for a chance to blast a thread, I'm asking for method suggestions, not full code |
Hmm onKeyPressed can be called over and over if you hold down the key I believe. If you don't want the brief wait after first key strike then you'll have to do some sort of timeout loop detecting if the key is pressed. This can be done by doing
PHP Code:
|
Don't rely on onKeyPressed() it relies on the OS setting of the player's keyboard, in which the repeat can be slow or fast... which would of course vary between one player and another.
|
Thanks tig <3
|
Since I hate Clientside timeouts and this should work also:
PHP Code:
|
Quote:
|
Quote:
|
Quote:
|
Mk, so Tig's example didnt work as well as I would have hoped, might just be me. Here is what I'm working with:
Initially this.on = false and this.delay = 1; PHP Code:
|
Quote:
|
Quote:
|
Quote:
PHP Code:
Quote:
|
Quote:
|
Quote:
You beat me to it :[ |
cbk, you rock. Rep+
<3 |
| All times are GMT +2. The time now is 05:21 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.