Onex
Onex
Home
Products
Documentation
Changelog
Login with FiveM
  • 👋 Welcome
  • Claim Purchase
  • Translations
    • Weaponmeta
    • Voice Interaction
      Integrations
      Installation
      Configuration
      General
      Addons
      Features
      Api
Artifacts Tracker
  1. Onex Scripts
  2. Scripts_guides / Currency
Ctrl K

CURRENCY#

Unified currency configuration used by all addons — banking, shops, hospital, and anywhere money amounts appear in TTS speech or voice input parsing.

Config file: shared/currency.lua

CurrencyConfig.symbol#

TypeDefault
string"$"

Currency symbol prepended or appended to formatted amounts. Common values: "$", "€", "£", "₹", "¥".

CurrencyConfig.name#

TypeDefault
string"dollar"

Singular currency name used in TTS speech. Example: "1 dollar".

CurrencyConfig.namePlural#

TypeDefault
string"dollars"

Plural currency name used in TTS speech. Example: "500 dollars".

CurrencyConfig.slang#

TypeDefault
string[]{"bucks"}

Informal names recognized in voice input. Players can say "give me 500 bucks" and the parser will strip the slang word before processing the amount. Add any informal terms your players use.

CurrencyConfig.slang = { "bucks", "cash", "bread" }

CurrencyConfig.position#

TypeDefaultValues
string"before""before" | "after"

Controls where the symbol or name appears in formatted output.

  • "before" — symbol before number: $1,500 / €1.500
  • "after" — word after number: 1,500 dollars / 1.500 euros

When position = "after", FormatCurrency uses name/namePlural instead of symbol.

CurrencyConfig.separator#

TypeDefaultValues
string",""," | "." | " "

Thousands separator used when formatting numbers.

ValueExample
","1,500
"."1.500
" "1 500

Full Example#

-- Default(USD) CurrencyConfig = { symbol = "$", name = "dollar", namePlural = "dollars", slang = { "bucks" }, position = "before", separator = ",", } -- Euro example CurrencyConfig = { symbol = "€", name = "euro", namePlural = "euros", slang = {}, position = "after", separator = ".", }

Utility Functions#

Three global functions are exposed for use in addon scripts. Do not modify them.

FormatCurrency(amount)#

Formats an amount according to position. Returns symbol + number or number + word.

FormatCurrency(1500) -- → "$1,500" (before) or "1,500 dollars" (after) FormatCurrency(1) -- → "$1" (before) or "1 dollar" (after, singular)

FormatCurrencyWords(amount)#

Always formats as number + word, regardless of position. Used for TTS speech where the symbol is not spoken.

FormatCurrencyWords(1500) -- → "1,500 dollars" FormatCurrencyWords(1) -- → "1 dollar"

StripCurrencyText(text)#

Strips currency words, symbols, and slang from voice input before amount parsing. Called automatically by all addon parseAmount functions — you typically do not need to call this directly.

Strips: configured name, namePlural, all slang entries (including pluralized forms), common symbols ($, €, £, ¥, ₹, ₩, ₪, ฿), thousands separators, and surrounding whitespace.

StripCurrencyText("give me five hundred bucks") -- → "give me five hundred" StripCurrencyText("$1,500 dollars") -- → "1500"

Last updated 3 months ago

Quick Links

All DocumentationOur Products