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

SHOPS#

Voice-controlled shopping at shop NPCs. Players can purchase items, check prices, browse inventory by category, reorder previous purchases, and attempt to bargain for discounts.

Config file: shared/shops/default.lua

General#

ShopsConfig.enabled#

Typeboolean
Defaulttrue

Master toggle for the shops addon.

ShopsConfig.enabled = true

Integration Priority#

The shop addon integrates with your server's shop resource. Set the priority order to match what is running on your server — the first detected resource is used.

ShopsConfig.integrationPriority#

Typetable
Default{"qb-shops", "ox-inventory", "esx-shops"}
ShopsConfig.integrationPriority = {"qb-shops", "ox-inventory", "esx-shops"}

See Integrations for supported shop systems.

ShopsConfig.spawnPeds#

Typestring[]
Default{"ox-inventory", "esx-shops"}

Integrations for which the addon spawns its own shop peds. Resources listed here do not spawn their own NPCs, so the addon creates them. qb-shops spawns its own peds and is excluded.

ShopsConfig.spawnPeds = { "ox-inventory", "esx-shops" }

Proximity#

The addon detects when a player enters a shop zone and searches for a shop NPC within range.

ShopsConfig.proximity.defaultRadius#

Typenumber
Default5.0

Circular detection radius in metres (legacy, used for circle zones).

ShopsConfig.proximity.width / length#

Typenumber
Default4.0 / 4.5

Box-shaped zone dimensions in metres.

ShopsConfig.proximity.updateInterval#

Typenumber
Default500

How often (ms) the addon checks player position against shop zones.

Zone Geometry#

ShopsConfig.zoneGeometry.height#

Typenumber
Default3.0

Height of the box zone in metres.

ShopsConfig.zoneGeometry = { height = 3.0 }

NPC Detection#

When a player enters a shop zone, the addon searches for a shop NPC nearby.

SettingDefaultPurpose
searchRadius8.0Primary NPC search radius (metres)
fallbackSearchRadius10.0Fallback radius if primary finds nothing
waitForSpawn500Time to wait (ms) for an NPC to spawn before searching
greetingDelay0Delay (ms) before the NPC delivers an automatic greeting

Voice Matching#

ShopsConfig.voice.minSimilarity#

Typenumber
Default0.65

Global minimum similarity score for voice-to-command matching (0.0–1.0).

ShopsConfig.voice.enableQuantity#

Typeboolean
Defaulttrue

Allows players to specify quantities when purchasing (e.g., "buy three burgers").

ShopsConfig.voice.maxQuantity#

Typenumber
Default10

Maximum quantity allowed in a single voice purchase.

ShopsConfig.voice.enableMultiItem#

Typeboolean
Defaulttrue

Allows purchasing multiple different items in a single voice command.

ShopsConfig.matching#

Per-intent similarity thresholds. Lower values allow less exact matches.

ShopsConfig.matching = { purchase = 0.65, price = 0.60, availability = 0.65, inventory = 0.70, productLookup = 0.70, }

ShopsConfig.cache.ttl#

Typenumber (ms)
Default300000 (5 minutes)

How long shop data is cached on the client before being re-fetched.

ShopsConfig.rpc = { timeout = 5000 } ShopsConfig.cache = { ttl = 300000 }

Voice Hints#

ShopsConfig.hintMode#

Typestring
Default"3d"
Values"3d" | "2d"

Controls where voice hint phrases are displayed.

  • "3d" — floating bubble above the shop NPC's head (requires NPC to be present)
  • "2d" — screen overlay (always visible regardless of NPC)
ShopsConfig.hintMode = "3d"

Feedback / TTS#

ShopsConfig.feedback.enabled#

Typeboolean
Defaulttrue

Master toggle for NPC TTS speech responses.

ShopsConfig.feedback.responseToggles#

Individual toggles for each response category. Set any to false to silence that category entirely.

ShopsConfig.feedback.responseToggles = { greeting = true, -- greet player on entry farewell = true, -- farewell on exit success = true, -- purchase confirmation priceCheck = true, -- price inquiry responses inventory = true, -- stock/availability responses errors = true, -- insufficient funds, out of stock, etc. category = true, -- category browsing responses reorder = true, -- reorder confirmation/history responses bargain = true, -- bargaining outcome responses }

ShopsConfig.feedbackTiming#

SettingDefaultPurpose
responseCooldown1000 msMinimum time between NPC responses
duplicatePrevention5000 msSuppress duplicate responses within this window
farewellCooldown500 msReduced cooldown after a farewell before a new greeting

Inventory Display#

ShopsConfig.inventoryDisplay.maxSpokenItems#

Typenumber
Default8

Maximum number of items the NPC will list aloud when a player asks for inventory.

ShopsConfig.inventoryDisplay = { maxSpokenItems = 8 }

Categories#

The category system groups shop items so players can ask "what's in the food section?"

ShopsConfig.categories.enabled#

Typeboolean
Defaulttrue

ShopsConfig.categories.autoDetect#

Typeboolean
Defaulttrue

Automatically categorizes items based on their names and metadata.

ShopsConfig.categories.maxItemsPerCategory#

Typenumber
Default6

Maximum items listed when a player requests a category.

ShopsConfig.categories = { enabled = true, maxItemsPerCategory = 6, autoDetect = true, defaultCategory = "general", }

Reorder System#

Players can reorder their previous purchases by voice.

ShopsConfig.reorder.enabled#

Typeboolean
Defaulttrue

ShopsConfig.reorder.persistToKvp#

Typeboolean
Defaulttrue

Saves purchase history to KVP (key-value persistence) so it survives reconnects.

ShopsConfig.reorder.maxHistoryAge#

Typenumber (ms)
Default604800000 (7 days)

Maximum age of purchase history entries. Older entries are discarded.

ShopsConfig.reorder = { enabled = true, persistToKvp = true, sessionOnly = false, maxHistoryAge = 604800000, }

Bargaining#

Players can attempt to bargain for a discount. Chance and discount magnitude are randomized within configured ranges.

ShopsConfig.bargaining.enabled#

Typeboolean
Defaulttrue

ShopsConfig.bargaining.baseChance / maxChance#

Typenumber
Default0.10 / 0.50

Minimum and maximum probability (0.0–1.0) of a bargain succeeding.

ShopsConfig.bargaining.enableLoyalty#

Typeboolean
Defaulttrue

Uses persistent purchase history to factor loyalty into bargain success chance. Players who buy often have a higher chance of getting a discount.

ShopsConfig.bargaining.discountTiers / discountWeights#

Typetable
Default{5, 10, 15, 20} / {50, 30, 15, 5}

Discount percentages and their relative weights. A weight of 50 for 5% means the 5% discount is far more common than the 20% tier with weight 5.

ShopsConfig.bargaining = { enabled = true, baseChance = 0.10, maxChance = 0.50, cooldown = 120000, discountDuration = 60000, enableLoyalty = true, discountTiers = {5, 10, 15, 20}, discountWeights = {50, 30, 15, 5}, }
SettingDefaultPurpose
cooldown120000 msPer-player cooldown between bargain attempts (2 minutes)
discountDuration60000 msHow long a granted discount remains valid

Last updated 3 months ago

Quick Links

All DocumentationOur Products