Bugün 20% tasarruf edin Ödemede WELCOME kodunu kullanın. WELCOME

Qbox Framework Guide for FiveM

Ücretsiz bir komut dosyasını mı test ediyorsunuz?

Hızlı kontroller için ücretsiz komut dosyaları uygundur. Üretim sunucuları için, çerçeveye ve kullanım senaryosuna göre tam sunucu paketlerini veya ücretli, bakımı yapılan komut dosyalarını karşılaştırın.

Hızlı cevap: Qbox is a modern FiveM framework direction commonly used with the overextended stack, including ox_lib, ox_inventory, and ox_target-style workflows. Before migrating from QBCore, audit resources, exports, database tables, inventory, jobs, and admin tooling.

Son güncelleme: 25 Haziran 2026

Overextended (Ox) is the modern baseline for FiveM servers. This guide shows you how to install, configure, and safely migrate to öküz_envanteri, ox_kütüphane, öküz_hedefi, Ve oxmysql. You’ll get copy‑pasteable code, opinionated defaults, and battle‑tested patterns for UI, interactions, and data. Includes playbooks for qb-inventory → ox_inventory Ve mysql-async → oxmysql. Back up your server and database before any change.


TL;DR: Which Ox component for what?

BileşenAmaçCore APIsTypical UseMigration PathCommon Gotchas
öküz_envanteriInventory & items, stashes, shopsAddItem, RemoveItem, RegisterStash, RegisterShopPlayer items, job stashes, vendor shopsqb-inventory → ox_inventoryWrong item schema, duplicate invs running, missing emin olmak sipariş
ox_kütüphaneUtilities, UI, helpersaddCommand, registerContext/showContext, inputDialog, progressBar, zones/pointsMenus, prompts, rate‑limits, zone logicYokMixing UI libs, not awaiting callbacks
öküz_hedefiInteraction targetingaddBoxZone, addSphereZone, addEntity, addModelEye targets on props/peds/zonesqtarget → ox_target (optional)Overlapping zones, missing job conditions
oxmysqlMySQL driverquery, single, scalar, insert, prepare, transactionDB persistence, leaderboards, auditsmysql-async → oxmysqlUnindexed queries, unsafe string concat

Uç: İle başla oxmysql Ve ox_kütüphane, then migrate inventory Ve hedef. Validate each step on a staging server.

İlgili: https://fivemx.com/frameworks/ · https://fivemx.com/framework-conversion/

Get QBox Scripts here


Prerequisites & Baseline

  • Recent server artifact, txYöneticisi, and a framework (QB Çekirdek veya ESX).
  • Node.js is not required for Ox, but your NUI stack (if any) might use it.
  • Resource start order: oxmysqlox_kütüphaneöküz_envanteri → the rest. Put öküz_hedefi early among UI/interact libs.
  • Checklist:
    • Firewall allows DB traffic; DB user has least privileges.
    • Set production vs dev convars; enable slow query warnings in staging.
    • Backups for DB and resource configs.

İlgili: https://fivemx.com/how-to-install-qbcore/ · https://fivemx.com/how-to-customize-qbcore-scripts/ · https://fivemx.com/qbcore-scripts/


Install & Configure: ox_inventory

Düzenlemek

Add the resource and ensure it sonrasında ox_kütüphane.

-- resources/[ox]/ox_inventory/fxmanifest.lua (snippet)
fx_version 'cerulean'
game 'gta5'

lua54 'yes'
shared_scripts {
  '@ox_lib/init.lua',
  'config.lua'
}
client_scripts { 'client/*.lua' }
server_scripts { '@oxmysql/lib/MySQL.lua', 'server/*.lua' }

sunucu.cfg:

ensure oxmysql
ensure ox_lib
ensure ox_inventory

Core config

Define items (weight, stack, metadata). Typical path: ox_envanter/veri/öğeler.lua.

return {
  water = {
    label = 'Water Bottle',
    weight = 200,
    stack = true,
    close = true,
    description = 'Stay hydrated.'
  },
  sandwich = { label = 'Sandwich', weight = 300, stack = true }
}

Register a stash ve bir mağaza on server start:

-- server/stash_shop.lua
CreateThread(function()
  exports.ox_inventory:RegisterStash('pd_evidence', 'Police Evidence', 100, 100000, false, {police = 2})

  exports.ox_inventory:RegisterShop('corner_store', {
    name = '24/7 Market',
    inventory = {
      { name = 'water', price = 8 },
      { name = 'sandwich', price = 12 }
    }
  })
end)

UI basics

  • Drag & drop, split, stack; configurable hotkeys.
  • Kullanmak metadata for serials, qualities, expiry.

Quick test

Give yourself an item and open inventory:

-- server/debug.lua
RegisterCommand('giveme', function(src)
  exports.ox_inventory:AddItem(src, 'water', 1)
end, true)

Yaygın hatalar

Uyarı: Yapmak Olumsuz run two inventories at once. Fully disable qb-inventory before enabling ox_inventory.

Uç: Match item names exactly across jobs/crafting and inventory data.

İlgili: https://fivemx.com/fivem-inventory-scripts/ · https://fivemx.com/qbcore-scripts/


Install & Configure: ox_lib

Temeller

Çekirdek helpers you’ll use everywhere:

-- Commands
lib.addCommand('healme', {
  help = 'Heal yourself (admin only).',
  restricted = 'group.admin'
}, function(src)
  TriggerClientEvent('fivemx:heal', src)
end)

-- Context menus
lib.registerContext({
  id = 'shop_menu',
  title = '24/7 Market',
  options = {
    { title = 'Buy Water ($8)', event = 'fivemx:buy', args = { item = 'water', price = 8 } },
    { title = 'Buy Sandwich ($12)', event = 'fivemx:buy', args = { item = 'sandwich', price = 12 } }
  }
})
-- later
lib.showContext('shop_menu')

Mini cookbook

  • Input dialog & ilerlemek with awaitable flow:
-- client
local input = lib.inputDialog('Craft Coffee', {
  { type = 'number', label = 'Beans (g)', default = 18, min = 1, max = 60 }
})
if input then
  local ok = lib.progressBar({ duration = 3500, label = 'Brewing…', useWhileDead = false, canCancel = true })
  if ok then TriggerServerEvent('fivemx:craft:coffee', input[1]) end
end
  • Callbacks (server validates, client awaits):
-- server
lib.callback.register('fivemx:buyItem', function(src, item, price)
  -- validate job/coords/etc. then charge + grant
  -- return true/false and message
  return exports.ox_inventory:AddItem(src, item, 1)
end)

-- client
local success = lib.callback.await('fivemx:buyItem', false, 'water', 8)

İlgili: https://fivemx.com/frameworks/ · https://fivemx.com/framework-conversion/


Install & Configure: ox_target

Entities & bones

Attach actions to specific peds/vehicles/objects or their bones.

-- target an entity by model
exports.ox_target:addModel(`prop_vend_soda_02`, {
  {
    name = 'vending_buy',
    icon = 'fa-solid fa-bottle-water',
    label = 'Buy a Drink',
    onSelect = function(data) TriggerEvent('fivemx:openVending') end
  }
})

Zones

Create 3D boxes/spheres/polys with job conditions.

-- Box zone in front of cash register
exports.ox_target:addBoxZone({
  coords = vec3(25.7, -1347.3, 29.5),
  size = vec3(1.6, 1.2, 1.0),
  rotation = 0.0,
  debug = false,
  options = {
    {
      label = 'Open Shop',
      icon = 'fa-solid fa-store',
      groups = { police = 0, ambulance = 0 }, -- anyone; example of group filter
      onSelect = function()
        lib.showContext('shop_menu')
      end
    }
  }
})

Örnekler

  • Stash target for police evidence.
  • Job‑gated crafting inside a workshop.

İlgili: https://fivemx.com/qbcore-scripts/ · https://fivemx.com/fivem-inventory-scripts/


Install & Configure: oxmysql

Why oxmysql

  • Prepared statements, pooling, async/await API.
  • Better performance and safety than string‑concat SQL.

API cheatsheet

-- read many
local rows = MySQL.query.await('SELECT id, name FROM players WHERE job = ?', { 'police' })

-- read single row
local player = MySQL.single.await('SELECT * FROM players WHERE identifier = ?', { identifier })

-- scalar value
local count = MySQL.scalar.await('SELECT COUNT(*) FROM stash_items WHERE stash = ?', { 'pd_evidence' })

-- insert
local id = MySQL.insert.await('INSERT INTO logs (event, source) VALUES (?, ?)', { 'buy_water', src })

-- prepared & cached
local info = MySQL.prepare.await('SELECT label, weight FROM items WHERE name = ?', { 'water' })

-- transaction
MySQL.transaction.await(function()
  MySQL.query.await('UPDATE accounts SET money = money - ? WHERE identifier = ?', { 12, identifier })
  MySQL.query.await('INSERT INTO purchases (identifier, item) VALUES (?, ?)', { identifier, 'sandwich' })
end)

Indexes & schema hygiene

ALTER TABLE players ADD INDEX idx_players_identifier (identifier);
ALTER TABLE purchases ADD INDEX idx_purchases_identifier_created (identifier, created_at);

Error handling

Uç: Enable slow query warnings in staging and add proper indexes before launch.

İlgili: https://fivemx.com/mysql-async-to-oxmysql/ · https://fivemx.com/sql-identifiers-migration/ · https://fivemx.com/converting-fivem-scripts/


Migration Playbooks (copy-paste ready)

qb-inventory → ox_inventory

Concepts mapping

Conceptqb-envanteröküz_envanteri
Öğelerqb-core/shared/items.luaox_envanter/veri/öğeler.lua
StashesJob/player stash logic in scriptsRegisterStash(id, label, slots, weight, owner, groups, coords)
Mağazalarqb-shops or customRegisterShop(id, { inventory = {..} })

Adımlar

  1. Disable qb-inventory and any inventory‑dependent UIs.
  2. Düzenlemek ox_kütüphane, öküz_envanteri, oxmysql in that order.
  3. Port items → data/items.lua (preserve names/weights/metadata).
  4. Replace item add/remove calls with exports.ox_inventory:AddItem/RemoveItem.
  5. Register stashes/shops server‑side; migrate stash save data if applicable.
  6. Test on staging; verify drag/stack/split and job stashes.

Checklist (Before/After)

AreaÖnceSonrasındaRisk
Kaynaklarqb-inventory enabledqb-inventory removed, ox_inventory ensuredDüşük
Öğeleritems in qb shareditems in data/items.luaMedium (naming)
Stashesimplicitexplicit RegisterStashDüşük
Mağazalarqb‑shopsRegisterShopDüşük

Example: add/remove replace

-- before (qb-inventory pseudocode)
-- QBCore.Functions.AddItem(src, 'water', 1)

-- after (ox_inventory)
exports.ox_inventory:AddItem(src, 'water', 1)
exports.ox_inventory:RemoveItem(src, 'sandwich', 1)

İlgili: https://fivemx.com/fivem-inventory-scripts/


mysql-async → oxmysql

Search/replace patterns

mysql-async calloxmysql equivalent
MySQL.Async.fetchAll(sql, params, cb)MySQL.query(sql, params) / .await
MySQL.Async.fetchScalar(sql, params, cb)MySQL.scalar(sql, params) / .await
MySQL.Async.execute(sql, params, cb)MySQL.query(sql, params) veya MySQL.update/insert / .await
string concat "..var.."? placeholders with param array
manual BEGIN/COMMITMySQL.transaction.await(function() ... end)

Example refactor

-- before
MySQL.Async.fetchAll('SELECT * FROM users WHERE identifier = @id', { ['@id'] = identifier }, function(rows)
  -- use rows
end)

-- after
local rows = MySQL.query.await('SELECT * FROM users WHERE identifier = ?', { identifier })

Prepared statements

local user = MySQL.prepare.await('SELECT id, job FROM users WHERE identifier = ?', { identifier })

Uyarı: Never trust client input. Always validate on the sunucu and use placeholders.

İlgili: https://fivemx.com/mysql-async-to-oxmysql/ · https://fivemx.com/sql-identifiers-migration/ · https://fivemx.com/converting-fivem-scripts/


Patterns that sell: building jobs & UI with the Ox stack

A minimal delivery job that ties öküz_hedefi (interact), ox_kütüphane (UI), öküz_envanteri (rewards), and oxmysql (audit).

-- client/jobs_delivery.lua
local drop = vec3(120.4, -1039.2, 29.2)
exports.ox_target:addBoxZone({
  coords = drop, size = vec3(1.4, 1.0, 1.0), rotation = 340.0,
  options = {
    {
      name = 'deliver_crate', label = 'Deliver Crate', icon = 'fa-solid fa-box',
      onSelect = function()
        local ok = lib.progressBar({ duration = 4000, label = 'Dropping off…' })
        if ok then TriggerServerEvent('fivemx:job:deliverCrate') end
      end
    }
  }
})
-- server/jobs_delivery.lua
RegisterNetEvent('fivemx:job:deliverCrate', function()
  local src = source
  -- rate limit per minute (very simple)
  local ok = exports.ox_inventory:AddItem(src, 'water', 1)
  if ok then
    MySQL.insert.await('INSERT INTO job_logs (identifier, event) VALUES (?, ?)', { GetPlayerIdentifier(src, 0), 'deliver_crate' })
    TriggerClientEvent('ox_lib:notify', src, { title = 'Delivery', description = 'You received Water x1', type = 'success' })
  end
end)

İlgili: https://fivemx.com/qbcore-scripts/ · https://fivemx.com/fivem-inventory-scripts/


Performance & Security

  • Debounce target interactions; avoid overlapping zones.
  • Cache frequent reads; index columns used in WHERE/JOIN.
  • Keep server ticks low; move heavy loops off the main thread.
  • Security: validate server‑side, rate‑limit economic actions, log sensitive events.

Uç: Turn on slow‑query warnings in staging; ship indexes with migrations.

İlgili: https://fivemx.com/converting-fivem-scripts/ · https://fivemx.com/sql-identifiers-migration/


Debugging & Test Harness

  • Add debug emirler guarded by permissions.
  • Log DB failures and short‑circuit on errors.
  • Test hot‑reload by restarting single resources (not the whole stack).
lib.addCommand('oxping', { help = 'Health check', restricted = 'group.admin' }, function(src)
  local ok = MySQL.scalar.await('SELECT 1') == 1
  TriggerClientEvent('ox_lib:notify', src, { title = 'Ox Health', description = ok and 'DB OK' or 'DB FAIL', type = ok and 'success' or 'error' })
end)

İlgili: https://fivemx.com/frameworks/ · https://fivemx.com/framework-conversion/


Internal Resources & Next Steps

Browse the store for tested scripts that follow these patterns.


SSS

Is ox_inventory faster than qb-inventory?
Generally yes. It emphasizes efficient UI and server‑side operations with sane defaults for stacks, weights, and metadata.

Can I mix qb-inventory and ox_inventory?
Not recommended. Stop qb-inventory entirely before enabling ox_inventory to avoid duplicate handlers and item desync.

Do I need to rewrite SQL for oxmysql?
Mostly search/replace. Replace string concat with placeholders, adopt *.await APIs, and add missing indexes.

How do I secure ox_target interactions?
Kullanmak gruplarını/job checks client‑side but always re‑validate on the server (distance, job, item ownership) before rewards.

What about ESX compatibility?
The Ox stack is framework‑agnostic. Map ESX events to server handlers and keep inventory names consistent.

How do I benchmark DB calls?
Use EXPLAIN, enable slow‑query warnings, and compare timings before/after adding indexes.

Where do I define items for ox_inventory?
İçinde ox_envanter/veri/öğeler.lua. Keep labels short and weights realistic.

Can I keep qtarget while migrating to ox_target?
Temporarily, but avoid overlapping zones. Migrate feature‑by‑feature and remove qtarget when parity is reached.

How do I migrate stash data?
Create equivalent RegisterStash entries and run SQL to rename old stash IDs to the new keys if needed. Test on staging.

How do I set weights and limits?
Weights live in items.lua. Stash/shop capacities are part of RegisterStash/RegisterShop args.

How do I rate‑limit purchases or jobs?
Kullanmak lib.addCommand/callbacks with simple in‑memory cooldowns and server‑side validation.

Does oxmysql support transactions?
Yes—wrap atomic sequences in MySQL.transaction.await(function() ... end).

How do I handle NUI with Ox?
Ox plays fine with any NUI; just keep heavy UI logic client‑side and validations server‑side.

What’s the safest migration order?
oxmysql → ox_lib → ox_inventory → ox_target. Validate after each step.


Changelog & Credits

SürümDateNotlar
v1.02025-09-05Initial publication with install, config, and migration playbooks.

Son güncelleme: 2025-09-05

Credits & sources: Overextended documentation (ox_inventory, ox_lib, ox_target), oxmysql reference, Cfx.re docs, and community best practices.


Conclusion & Next Steps

Both frameworks can run a top‑tier city. The difference is how much legacy you want to carry and how standardized you want your future to be.

Next steps:


External references (learn more)

Migration checks

  • List every resource that calls QBCore exports or events.
  • Check inventory compatibility before changing item definitions.
  • Test shops, jobs, player loading, money, vehicles, and housing on staging.
  • Review ox_lib callbacks and notifications where scripts already depend on them.
  • Keep a database rollback before changing live framework tables.
Luka
Luka

Ben Luke, bir oyuncuyum ve FiveM, GTA ve rol yapma hakkında yazmayı seviyorum. Bir rol yapma topluluğu yönetiyorum ve sunucuları yönetme konusunda yaklaşık 10 yıllık deneyimim var.

Articles: 436

Leave a Reply