Skip to content

Commit

Permalink
fix: FormatMoney (#50)
Browse files Browse the repository at this point in the history
  • Loading branch information
Be1zebub authored Aug 2, 2024
1 parent a9747e4 commit 0977992
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions lua/pixelui/core/sh_formatting.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@ do
local currencySymbol = "$"
local currencyLeft = true

hook.Add("PostGamemodeLoaded", "PIXEL.UI.GetMoneyFormatSettings", function()
local config = (GM or GAMEMODE).Config
local function load()
local config = (GM or GAMEMODE or {}).Config
if not config then return end

if config.currency then currencySymbol = config.currency end
if config.currencyLeft then currencyLeft = config.currencyLeft end
end)
if config.currency ~= nil then currencySymbol = config.currency end
if config.currencyLeft ~= nil then currencyLeft = config.currencyLeft end
end
load()
hook.Add("PostGamemodeLoaded", "PIXEL.UI.GetMoneyFormatSettings", load)

local function addCurrency(str)
return currencyLeft and (currencySymbol .. str) or (str .. currencySymbol)
Expand Down Expand Up @@ -88,4 +90,4 @@ function PIXEL.FormatTime(time)
end

return format("%im %is", m, s)
end
end

0 comments on commit 0977992

Please sign in to comment.