QBCore quick start
Install QBCore with the txAdmin recipe, understand its folders, make yourself admin, add a job and a usable item, write a small QBCore script, and avoid common pitfalls.
Bu dokümanlar şimdilik İngilizce.
QBCore is one of the most popular FiveM roleplay frameworks, with the largest catalogue of compatible scripts. This quick start gets a QBCore server running and shows you how to add your own job, item and script. Official docs: qbcore.org/docs.
1. Install with txAdmin
Requirements: an artifact, a license key, and MariaDB (QBCore’s guide pairs it with HeidiSQL, see Database setup).
- Start FXServer, link your Cfx.re account in txAdmin.
- Choose Popular Recipes > QBCore.
- Enter your license key and the database connection (leave the database name empty).
- Run Recipe, then Save & Run Server.
Important
On the first start, some resources build with yarn. QBCore’s docs say to let yarn install run all the way through before restarting.
What the recipe installs is listed in Popular recipes. Its server.cfg enforces game build 3095, sets setr qb_locale "en" and setr UseTarget false.
2. The folder structure
resources/
├─ [cfx-default]/ Cfx default resources
├─ [standalone]/ oxmysql, PolyZone, connectqueue, progressbar, bob74_ipl...
├─ [voice]/ pma-voice, qb-radio
├─ [defaultmaps]/ hospital, dealer, prison maps
└─ [qb]/
├─ qb-core/ the framework
│ ├─ config.lua
│ ├─ shared/ jobs.lua, gangs.lua, items.lua, vehicles.lua, weapons.lua, locations.lua
│ ├─ server/
│ └─ client/
├─ qb-inventory/
├─ qb-policejob/ ...qb-core/shared/*.lua is where most “data” lives: jobs, gangs, items, vehicles.
3. Make yourself admin
The recipe’s server.cfg builds a permission chain:
add_ace qbcore.god command allow
add_principal qbcore.god group.admin
add_principal qbcore.god qbcore.admin
add_principal qbcore.admin qbcore.modAdd yourself to qbcore.god with your identifier (find it in txAdmin’s player info):
add_principal identifier.fivem:123456 qbcore.god
# or: add_principal identifier.license:abcdef... qbcore.godRestart, join, and try /admin for qb-adminmenu. txAdmin’s own menu (/tx) works independently of this.
4. Add a job
Jobs are in qb-core/shared/jobs.lua. Copy an existing entry:
QBCore.Shared.Jobs = {
-- ...existing jobs...
burgershot = {
label = 'Burger Shot',
defaultDuty = true,
offDutyPay = false,
grades = {
['0'] = { name = 'Trainee', payment = 50 },
['1'] = { name = 'Cook', payment = 75 },
['2'] = { name = 'Manager', isboss = true, payment = 120 },
},
},
}- The key (
burgershot) is the job name scripts check. - Grades are string keys (
'0','1') in QBCore. isboss = truegives access to the boss menu (qb-management).
Restart qb-core (or the server) and give yourself the job: /setjob [your id] burgershot 2.
5. Add a usable item
Items live in qb-core/shared/items.lua:
QBCore.Shared.Items = {
-- ...
burger = {
name = 'burger',
label = 'Burger',
weight = 250,
type = 'item',
image = 'burger.png',
unique = false,
useable = true,
shouldClose = true,
description = 'A juicy Burger Shot burger',
},
}Put burger.png in the inventory’s image folder (qb-inventory/html/images/). The Inventory Icons tool makes transparent item images from prop pictures or your own images.
Make it do something when used, in a server script of your own resource:
local QBCore = exports['qb-core']:GetCoreObject()
QBCore.Functions.CreateUseableItem('burger', function(source, item)
local Player = QBCore.Functions.GetPlayer(source)
if not Player then return end
if Player.Functions.RemoveItem(item.name, 1, item.slot) then
TriggerClientEvent('my_food:eat', source)
-- raise hunger through your HUD/status resource here
end
end)Give it to yourself with /giveitem [your id] burger 1.
6. A small QBCore script
A /paycheck command that pays bank money based on the player’s job grade, with server side checks:
fx_version 'cerulean'
game 'gta5'
server_script 'server.lua'
dependency 'qb-core'local QBCore = exports['qb-core']:GetCoreObject()
local lastClaim = {}
QBCore.Commands.Add('paycheck', 'Claim a bonus paycheck (once per hour)', {}, false, function(source)
local src = source
local Player = QBCore.Functions.GetPlayer(src)
if not Player then return end
local cid = Player.PlayerData.citizenid
if lastClaim[cid] and os.time() - lastClaim[cid] < 3600 then
TriggerClientEvent('QBCore:Notify', src, 'You already claimed it this hour', 'error')
return
end
local job = Player.PlayerData.job
local amount = 100 + (job.grade.level * 50)
Player.Functions.AddMoney('bank', amount, 'paycheck-bonus')
lastClaim[cid] = os.time()
TriggerClientEvent('QBCore:Notify', src, ('Paid $%d for %s'):format(amount, job.label), 'success')
end)Useful player data: Player.PlayerData.citizenid, .charinfo (first and last name), .job (name, label, grade.level, onduty), .gang, .money (cash, bank, crypto), .metadata.
Common pitfalls
- Editing
shared/*.luaon a live server: other resources cache shared data. Restart the server after changing jobs or items. - Old tutorials: QBCore has changed a lot. Code with
TriggerEvent('QBCore:GetObject', ...)is outdated: useexports['qb-core']:GetCoreObject(). - Modified forks: many paid scripts expect a stock or a specific version of QBCore. Keep a note of what you changed in core files, or better, don’t change core files.
- qb-target vs ox_target:
UseTargetisfalseby default in the recipe. Decide early and configure resources to match. - Performance: the full recipe runs many resources you may not need. Remove jobs and systems you don’t use, check
resmon. - XAMPP: use a real MariaDB.
Next steps
- Browse qbcore.org/docs for each resource’s config.
- Swap in ox_inventory if you want it (the QBCore docs and ox_inventory’s docs cover the conversion).
- The video archive has a frameworks course with QBCore installs and follow ups.
