Scripts / Making a money system having some coding issues Help please thanks

Author
Message
AstrobloodKnight
9
Years of Service
User Offline
Joined: 3rd Aug 2015
Location:
Posted: 4th Sep 2015 01:00 Edited at: 4th Sep 2015 01:06
so i am making a random box that gives you a random weapon and takes away some of your score the issue is its taking double the amount it should take away from the play heres the code

PM
cybernescence
GameGuru Master
11
Years of Service
User Offline
Joined: 28th Jan 2013
Playing: Cogwheel Chronicles
Posted: 4th Sep 2015 10:45
The engine will be cycling around your script fast so the 'g_KeyPressE == 1' will be true more than once (finger pressed on key once, but script executed more than once during this time). You need to add a 'key pressed' variable or a timer so the script only processes the weapon and score commands once per key press.

Cheers.
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 4th Sep 2015 17:12
cybernescence is right.

This the complete script + few modifications



In action



hth

3com

Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics

PM
AstrobloodKnight
9
Years of Service
User Offline
Joined: 3rd Aug 2015
Location:
Posted: 5th Sep 2015 18:52
thanks so much
PM

Login to post a reply

Server time is: 2024-12-22 05:31:36
Your offset time is: 2024-12-22 05:31:36