Scripts / Delay (timer) help!

Author
Message
Cripleshot
7
Years of Service
User Offline
Joined: 12th Jul 2016
Location:
Posted: 15th Jul 2016 18:03 Edited at: 16th Jul 2016 15:29
How would i do a delay (Timer) o show a panel for say like 5 seconds then turn back on the HUD?
this is from smallg's script just adding panels to it...
this is what I am using....



edited..fixed code tag...
PM
wermer
8
Years of Service
User Offline
Joined: 18th Sep 2015
Location:
Posted: 22nd Jul 2016 00:13 Edited at: 22nd Jul 2016 00:16
Do you want to pause the game for 5 seconds while the panel is displayed, or to display the panel for 5 seconds while the game loop continues to run?
The Lua function "os.clock" returns seconds since lua started, so it can be used to count a delay time.

You can make a delay function similar to Pascal's that will pause the game like this:


You can also use os.clock to check the passage of time as the game continues to run with something like this:


You can probably use "g_Time" or "g_TimeElapsed" to do the same thing, or use a "scriptholder" entity with an entity timer using "StartTimer" and "GetTimer".
Windows 10 Home 64-bit / Intel i5 2500k @ 4.4Ghz + Asetek 510LC / Intel DP67DE / Intel 530 Series 240GB SSD / 16GB Kingston KVR 1333 / XFX Radeon R9 380X / Corsair TX 650 / Antec 300
PM

Login to post a reply

Server time is: 2024-05-03 18:44:17
Your offset time is: 2024-05-03 18:44:17