Skip to content

Commit

Permalink
Merge pull request #18 from adamnejm/ulx-uptime
Browse files Browse the repository at this point in the history
Add `ulx uptime` to check server's uptime
  • Loading branch information
Derpius authored Jan 1, 2024
2 parents 55174b1 + e999290 commit d5b9b2a
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lua/ulx/modules/sh/uptime.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
local startTime = CurTime()
local uptimeCommand = ulx.command("Chat", "ulx uptime", function()
local uptimeSeconds = CurTime() - startTime
local uptimeFormatted = string.format(
"%02i:%02i:%02i",
math.floor(uptimeSeconds / 3600),
math.floor(uptimeSeconds % 3600 / 60),
math.floor(uptimeSeconds % 60)
)
ulx.fancyLog("Server has been running for #s", uptimeFormatted)
end, "!uptime")

uptimeCommand:defaultAccess(ULib.ACCESS_ALL)
uptimeCommand:help("Prints the server uptime")

0 comments on commit d5b9b2a

Please sign in to comment.