Currency
In-game currency formatting, display, and management system for the Lilia framework.
Overview
lia.currency.get(amount)
Purpose
Format a numeric amount into a localized currency string with the configured symbol and singular/plural name.
When Called
Whenever a currency amount needs to be shown to players or logged (UI, chat, logs, tooltips).
Parameters
number amount Raw amount to format; must be a number.
Returns
string Formatted amount with symbol prefix and the singular or plural currency name.
Example Usage
chat.AddText(L("youReceivedMoney", lia.currency.get(250)))
lia.log.add(client, "moneyPickedUp", 250)
lia.currency.spawn(pos, amount, angle)
Purpose
Spawn a physical money entity at a world position and assign it an amount.
When Called
Server-side when creating droppable currency (player drops, rewards, refunds, scripted events).
Parameters
Vector pos World position to spawn the money entity; required.
number amount Currency amount to store on the entity; must be non-negative.
Angle angle optional Optional spawn angles; defaults to `angle_zero` when omitted.
Returns
Entity|nil Created `lia_money` entity, or nil if input is invalid or entity creation fails.
Example Usage
hook.Add("OnNPCKilled", "DropBountyCash", function(npc, attacker)
if not IsValid(attacker) or not attacker:IsPlayer() then return end
local money = lia.currency.spawn(npc:GetPos() + Vector(0, 0, 10), math.random(50, 150))
if IsValid(money) then
money:SetVelocity(VectorRand() * 80)
end
end)