Author Topic: Best way to decrease a value every x sec  (Read 1968 times)

0 Members and 1 Guest are viewing this topic.

Offline XxLMM13xX

  • Sr. Member
  • ****
  • Posts: 265
  • Karma: -51
  • New to lua development
    • Twitch
Best way to decrease a value every x sec
« on: June 14, 2015, 07:15:58 AM »
Ok so im trying to make a battery system on a printer and i need a value to decrease by 1 every 13sec

local battery = 100

Thats all i got! I need help making this decrease on the printer HUD!

ex. 100 (3 sec later) 99 (3 more sec later) 98

I have NO idea how to do this!!! PLEASE HELP!

Offline Zmaster

  • Full Member
  • ***
  • Posts: 235
  • Karma: 25
Re: Best way to decrease a value every x sec
« Reply #1 on: June 14, 2015, 08:43:02 AM »
This is how I'd do it
http://wiki.garrysmod.com/page/timer/Create
See if you can find out how by using that function

An Error Has Occurred!

array_keys(): Argument #1 ($array) must be of type array, null given