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

GENERAL CONFIGURATION#

Core settings for onex-voiceInteraction are defined in shared/config.lua.

Language#

Config.Language#

Typestring
Default"en"

Sets the language for speech recognition. Use an ISO 639-1 code (e.g. "en", "fr", "de") or a regional variant (e.g. "pt-BR", "zh-CN", "es-MX") to transcribe in that language, or "auto" to detect the player's spoken language automatically.

"auto" requires BYOK (your own API key) — it detects any spoken language and converts it to English before matching, so your English voice command setup works for all players. Without BYOK, "auto" falls back to "en".

Config.Language = "en"

Config.ResponseLanguage#

Typestring | nil
Defaultnil

Sets the language for NPC text-to-speech responses. Leave as nil to match Config.Language.

-- Speak Hindi, hear English responses Config.Language = "hi" Config.ResponseLanguage = "en"

Config.SubtitleScript#

Typestring
Default"native"
Values"romanized" | "native" | "original"

Controls which script is displayed in NPC speech subtitles when ResponseLanguage is a non-Latin language.

  • "native" — show native script (e.g. "آپ کیسے ہیں" for Urdu, "आप कैसे हैं" for Hindi)
  • "romanized" — show romanized text matching TTS input (e.g. "aap kaise hain")
  • "original" — show original text before translation (e.g. English source text)

Has no effect when the response language uses a Latin script, or when no translation is active.

Config.SubtitleScript = "native"

Config.UseNativeVoice#

Typeboolean
Defaulttrue

When ResponseLanguage is a non-Latin language, overrides the NPC's configured voice with a language-native Edge TTS model and sends native script text to the synthesizer. For example, ResponseLanguage = "hi" uses hi-IN-MadhurNeural (male) or hi-IN-SwaraNeural (female). Falls back to the NPC's configured voice if no native model is defined for the language.

Has no effect when using ElevenLabs or Azure TTS. Set to false to always use the NPC's configured voice with romanized text instead.

Config.UseNativeVoice = true

Config.NumberToWords#

Typeboolean
Defaulttrue

Converts numbers to words before translation (e.g. "2 dollars" → "two dollars"). Improves regional language TTS by letting the translation engine handle number words natively. Only applies when translation is active (ResponseLanguage is set or Language is not English).

Config.NumberToWords = true

Translation#

Translation is automatic when Config.Language differs from the language your command phrases are written in. Advanced translation behaviour is controlled via server convars in server.cfg — not in config.lua:

ConvarDefaultDescription
voice_translate"auto""auto" | "true" | "false" — enable/disable translation
voice_translate_target"en"Language your command phrases are written in
voice_dual_match"false"Match against both raw and translated text in parallel
voice_dual_match_priority"highest_score""highest_score" | "raw_first" | "translated_first"
# server.cfg example
set voice_translate "auto"
set voice_translate_target "en"
set voice_dual_match "true"
set voice_dual_match_priority "highest_score"

Key Binding#

Config.KeyBinding#

Typestring
Default'G'

The key players hold to activate voice recognition. Must be a valid key name from Config.AvailableVoiceActivationKeys. Players can rebind this from the F2 settings panel.

Config.KeyBinding = 'G'

Config.FeedbackCancelKey#

Typestring
Default'X'

The key players press to cancel NPC speech while it is playing.

Config.FeedbackCancelKey = 'X'

Config.VoiceSettings#

Controls the F2 voice settings panel.

Config.VoiceSettings = { commandName = 'voicesettings', -- chat/console command to toggle the panel keybindEnabled = true, -- bind a key to toggle the panel defaultKey = 'F2', -- default key when keybindEnabled is true }

Debug#

Config.Debug#

Typeboolean
Defaultfalse

Prints detailed voice recognition and matching output to the F8 client console. Can also be enabled at runtime via the onex_voice_debug convar. Recommended to keep false in production.

Config.Debug = false -- or via convar: set onex_voice_debug "true"

Config.AddonDebug#

Typeboolean
Defaultfalse

Enables additional debug output from all addons (shops, ambient NPC, banking, etc.). Can also be enabled via the onex_voice_addondebug convar. Set false in production.

Config.AddonDebug = false -- or via convar: set onex_voice_addondebug "true"

Transcript#

Config.ShowTranscript#

Typeboolean
Defaulttrue

Displays the recognized speech as text beneath the audio spectrum in the NUI. Color-coded by state: white while listening, yellow while processing, green on match, red on no-match.

Config.ShowTranscript = true

Voice Test Command#

Config.VoiceTestCommand#

Typeboolean
Defaultfalse

Enables a hidden voice command — say "voice recognition test" — that returns a confirmation response. Useful for verifying STT is working without triggering any addon actions.

Config.VoiceTestCommand = false

Network Sync#

Config.NetworkSync.enabled#

Typeboolean
Defaulttrue

Master toggle for broadcasting NPC TTS speech to nearby players as positional audio. Each addon also has its own networkSync toggle — both must be true for a given addon's audio to broadcast.

Config.NetworkSync = { enabled = true, }

LLM Configuration#

Settings for LLM-based matching and addon AI. Only applies with a BYOK LLM API key configured.

Config.LLM = { enableAddonLLM = true, -- Allow addons(ambient_npc, etc.) to use LLM enableMatchingLLM = true, -- Allow Tier 4 LLM matching for voice commands prioritizeMatchingLLM = false, -- Run LLM matching first(before Tiers 1-2) matchingMode = "fallback", -- "parallel" | "fallback" }

ElevenLabs Configuration#

Voice assignment mode when ElevenLabs TTS is active (BYOK only).

Config.ElevenLabs = { -- "preconfigured" = Use pre-assigned voices from data/npc_voices_elevenlabs.json -- "llm_origin" = LLM picks voice based on NPC's inferred origin/character -- "llm_accent" = LLM picks voice matching the server's target language/accent voiceMode = "preconfigured", }

Speech Dictionary#

Config.SpeechDictionaryEnabled#

Typeboolean
Defaultfalse

Enables a custom speech correction dictionary sent to the STT engine. Accepts up to 200 entries, each pattern and replacement up to 50 characters.

Config.SpeechDictionary#

Pattern → replacement mappings applied before intent matching. Patterns are case-insensitive and word-boundary enforced.

Config.SpeechDictionaryEnabled = false Config.SpeechDictionary = { ["five m"] = "fivem", ["with draw"] = "withdraw", ["way point"] = "waypoint", -- add more as needed }

Prompt Hints#

Config.PromptHints#

Typetable

Sends vocabulary hint lists to the STT engine to improve recognition of domain-specific terms.

Config.PromptHints = { enabled = false, -- Master toggle maxTerms = 50, -- Max terms total(global + active layer combined) terms = { -- Global vocabulary hints(filtered to words in registered command phrases) "fivem", "noclip", "godmode", "atm", "gps", "waypoint", "teleport", "spectate", } }

All hint terms are filtered against registered command phrases before being sent to the backend — only words that appear in at least one registered phrase are included. Per-addon hints are defined in each addon's promptHints field in Config.Addons.

Voice Hints#

Config.VoiceHints#

Controls the in-world voice hint display — floating phrase bubbles above NPCs and the 2D screen overlay.

Config.VoiceHints = { enabled = true, mode = "full", -- "off" | "icon" | "full" allowUserCustomization = true, -- Let players toggle icon/full mode in F2 maxPhrases = 5, -- Max phrases shown at once rotateInterval = 8000, -- Phrase shuffle interval(ms) screenTrigger = "proximity", -- "always" | "proximity" -- 3D speech bubble above NPC head bubble = { enabled = true, offsetX = 0.200, offsetY = 0.0, offsetZ = 0.250, hintsDistance = 5.0, -- Hide phrase text beyond this distance maxDistance = 15.0, -- Hide everything beyond this distance minScale = 0.010, maxScale = 0.100, }, -- 2D screen overlay screen = { enabled = true, position = "top-left", -- "top-right" | "top-left" | "bottom-right" | "bottom-left" offsetX = 30, offsetY = 100, }, hideLayers = { "global" }, -- Never show hints for these layers proximityHideLayers = { "global", "ambient" }, -- Hidden in proximity mode -- Translate hint phrases to Config.Language translate = { enabled = true, targetLanguage = nil, -- nil = uses Config.Language }, }

Addon Enable Toggles#

Each addon can be individually enabled or disabled. The full defaults from shared/config.lua:

Config.Addons = { npc_interact = { enabled = true, subtitles = true, networkSync = true, promptHints = { "give", "take", "help", "thanks", "please", "here", "item", "quest", "mission", "job" }, }, shops = { enabled = true, subtitles = true, networkSync = true, promptHints = { "buy", "sell", "purchase", "price", "cost", "item", "weapon", "ammo", "armor", "store", "shop" }, }, ambient_npc = { enabled = true, subtitles = false, networkSync = true, promptHints = { "hello", "hi", "hey", "talk", "ask", "help", "thanks", "goodbye", "time", "weather", "directions" }, }, self_expression = { enabled = true, }, npc_lift = { enabled = true, subtitles = false, networkSync = true, promptHints = { "waypoint", "marker", "lift", "ride", "fare", "pullover", "destination" }, }, npc_robbery = { enabled = true, subtitles = false, networkSync = true, promptHints = { "hands", "up", "money", "wallet", "cash", "give", "me", "your", "valuables", "drop", "empty", "pockets" }, }, banking = { enabled = true, subtitles = true, networkSync = true, promptHints = { "balance", "withdraw", "deposit", "transactions", "yes", "no", "confirm", "cancel" }, }, hospital = { enabled = true, subtitles = true, networkSync = true, promptHints = { "revive", "heal", "help", "hurt", "dying", "doctor", "nurse", "hospital", "health", "cost", "confirm", "cancel" }, }, }

Set an addon's enabled to false to fully disable it. Disabled addons do not load their config, proximity zones, or prompt hints. The networkSync field (not networkAudio) controls whether NPC speech is broadcast to nearby players.

Last updated 3 months ago

Quick Links

All DocumentationOur Products