Garry's Mod

Garry's Mod

235 ratings
Atmos Time Display
   
Award
Favorite
Favorited
Unfavorite
Content Type: Addon
Addon Type: Tool
Addon Tags: Fun, Scenic
File Size
Posted
Updated
2.894 KB
5 Nov, 2014 @ 6:30pm
28 Jul, 2015 @ 1:03pm
5 Change Notes ( view )

Subscribe to download
Atmos Time Display

In 1 collection by TheFreeman193
TF193 Test Server
5 items
Description
A digital clock displaying the current Atmos time.

Features
-Digital display showing current Atmos time
-Fully positionable, defaults to integrate with the Source health box
-Customisable anchor points (left/right, top/bottom)
-12/24 hour modes
-Customisable am/pm suffixes for 12-hour mode
-Works in both singleplayer and on servers
-Can be toggled by each client on a server, and will automatically enable/disable for all clients if Atmos is turned on/off
-Can be hot-swapped, no need to restart a server or kick all clients

Console Variables
atmoshud_<setting> <value>

enabled 1/0 Toggles the panel clientside (1=enable, 0=disable, default=1)
12hr 1/0 12-hour mode (1=enable, 0=disable, default=0)
12hr_am [any] AM suffix for 12-hour mode (default=am)
12hr_pm [any] PM suffix for 12-hour mode (default=pm)
posx [num] The horizontal (x) position of the clock, -1 fits the health box (default=-1)
posy [num] The vertical (y) position of the clock, -1 fits the health box (default=-1)
anchorright 1/0 Horizontal (x) position anchor (0=left, 1=right, default=1)
anchorbottom 1/0 Vertical (y) position anchor (0=top, 1=bottom, default=0)

Console Commands
atmoshud_<command>

rebuild
-Rebuilds the clock panel clientside.
resetpos
-Resets the pos/anchor ConVars back to their defaults, and reports the previous values.

Hot-swappping
Minus the limitations of the workshop, this script can be hot-swapped. If you are installing whilst the server is running, set ATMOSHUD_IMMEDIATE to true serverside before executing the script. Clients may need to run the console command "atmoshud_rebuild startup".

(Obviously) requires the Atmos addon to be installed, which is available on the workshop here.

Released under Creative Commons CC BY-NC-SA 4.0
http://creativecommons.org/licenses/by-nc-sa/4.0/
53 Comments
TheFreeman193  [author] 24 Nov, 2019 @ 5:57pm 
Erik It's fairly simple mathematically. Use math.floor() to get the hours, subtract hours from total and multiply by 60 to get minutes (you'll need to floor this value too). If you want to get seconds, it's the same; subtract floored minutes from total minutes and multiply by 60 etc.
flipflop 24 Nov, 2019 @ 6:46am 
Thank you! I did it server-side and it works.
Now i just need to multiply the decimals by 60 for it to display minutes instead of %.

Something like AtmosGlobal:GetTime() * 60 but only for decimals.
As in your example 14.5 I take the 0.5 * 60 to get 30 minutes.
Idk if this is possible but i can't think of any other way right now.
TheFreeman193  [author] 23 Nov, 2019 @ 2:55pm 
Erik If you are implementing this server-side, it is possible to call AtmosGlobal:GetTime() which returns the current time between 0 and 24 as a float (e.g. for 2:30pm it would return 14.5). This method comes from Atmos itself. You could then take this number and format it correctly for the message broadcast. Alternatively, if you are doing this client-side, you can access the already-formatted time that this addon generates, accessible as a property using ATMOSHUD.LastTime . The advantage of the latter is that the formatting will be whatever each client has set. The former is probably better though, since you wouldn't be relying on each client running my addon; it would work as long as Atmos was running on the server. Hope this helps.
flipflop 22 Nov, 2019 @ 2:34pm 
On my server, whenever someone dies, I've made it so that a message comes up in the chat for admins that says "this person died."

Do you think theres any way of adding time of death?
By somehow taking the current time this addon displays and adding it to the message?
TheFreeman193  [author] 25 Oct, 2019 @ 11:44am 
≽<∈⍩ This error occurs when Atmos is not installed or is disabled. Download Atmos here if you haven't got it already.
flipflop 22 Oct, 2019 @ 6:50pm 
I get false when i type in: lua_run print(timer.Exists'atmos_dnc_hudUpd')
flipflop 22 Oct, 2019 @ 6:48pm 
How would this be fixed?
Atmos not found! Stopping. The script can be reloaded once Atmos is running.Failed to load .nav file: Cannot access!
[ExG]ティーモ提莫醬 27 Feb, 2019 @ 4:24am 
ok,thanks
TheFreeman193  [author] 24 Feb, 2019 @ 2:47pm 
[ExG]提҈莫醬 At present, the best way to do this is to send console commands to each client in your serverside Lua environment, whether it be once when they first spawn or to update the displays dynamically. Please bear in mind however, that sending these commands can override player's personal preferences and that people run a variety of different resolutions and aspect ratios). Also note that any dynamic layout changes require a panel rebuild to display properly (see command for this in the description). In the future I may add functionality for server settings that would automatically synchronise clients' displays without altering each player's personal settings, such that they revert when in single-player or on AtmosHUD-unconfigured servers.
[ExG]ティーモ提莫醬 22 Feb, 2019 @ 8:07pm 
How do I make it so that the settings I set through console take effect for all players?