FixFX

Setup & Installation

Complete guide to setting up and installing QBCore framework.

This guide covers the complete installation and initial setup of QBCore framework for your FiveM server.

Prerequisites

Before installing QBCore, ensure you have:

  • FiveM Server: A properly configured FiveM server
  • MySQL Database: MySQL 8.0+ or MariaDB 10.6+
  • Git: For cloning repositories
  • Basic Command Line Knowledge: Comfort with terminal commands

Installation Methods

1. Database Setup

Create a new MySQL database for your server:

CREATE DATABASE qbcore_server CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'qbcore_user'@'localhost' IDENTIFIED BY 'your_secure_password';
GRANT ALL PRIVILEGES ON qbcore_server.* TO 'qbcore_user'@'localhost';
FLUSH PRIVILEGES;

2. Server Structure

Create the proper directory structure:

# Navigate to your server's resources folder
cd /path/to/your/server/resources
 
# Create QBCore folder structure
mkdir -p [qb]
mkdir -p [standalone]
mkdir -p [voice]

3. Core Framework Installation

# Clone the core framework
cd [qb]
git clone https://github.com/qbcore-framework/qb-core.git
 
# Essential resources
git clone https://github.com/qbcore-framework/qb-multicharacter.git
git clone https://github.com/qbcore-framework/qb-spawn.git
git clone https://github.com/qbcore-framework/qb-inventory.git
git clone https://github.com/qbcore-framework/qb-target.git
git clone https://github.com/qbcore-framework/qb-clothing.git
git clone https://github.com/qbcore-framework/qb-weathersync.git
git clone https://github.com/qbcore-framework/qb-houses.git
git clone https://github.com/qbcore-framework/qb-garages.git
git clone https://github.com/qbcore-framework/qb-phone.git
git clone https://github.com/qbcore-framework/qb-vehicleshop.git
git clone https://github.com/qbcore-framework/qb-vehiclekeys.git
git clone https://github.com/qbcore-framework/qb-bankrobbery.git
git clone https://github.com/qbcore-framework/qb-policejob.git
git clone https://github.com/qbcore-framework/qb-ambulancejob.git
git clone https://github.com/qbcore-framework/qb-management.git
git clone https://github.com/qbcore-framework/qb-radialmenu.git
git clone https://github.com/qbcore-framework/qb-hud.git
git clone https://github.com/qbcore-framework/qb-menu.git
git clone https://github.com/qbcore-framework/qb-input.git
git clone https://github.com/qbcore-framework/qb-loading.git

4. Database Dependencies

Install required database resources:

# Navigate to standalone folder
cd ../[standalone]
 
# Clone database connector
git clone https://github.com/overextended/oxmysql.git

5. Database Import

Import the QBCore database structure:

# Import base database (located in qb-core/server/database.sql)
mysql -u qbcore_user -p qbcore_server < [qb]/qb-core/server/database.sql
 
# Import additional resource databases as needed
mysql -u qbcore_user -p qbcore_server < [qb]/qb-houses/database/qb-houses.sql
mysql -u qbcore_user -p qbcore_server < [qb]/qb-phone/database/qb-phone.sql
# Continue for other resources with database requirements

Method 2: QBCore Template (Alternative)

For a quicker start, use the QBCore server template:

# Clone the complete template
git clone https://github.com/qbcore-framework/qb-txAdminRecipe.git
 
# This includes:
# - Pre-configured server structure
# - All essential resources
# - Database files
# - Basic configuration

Configuration

1. Database Connection

Configure your database connection in qb-core/shared/config.lua:

QBConfig = {}
 
QBConfig.MaxPlayers = GetConvarInt('sv_maxclients', 48)
QBConfig.DefaultSpawn = {x = -254.88, y = -982.14, z = 31.22, h = 207.5}
QBConfig.UpdateInterval = 5
QBConfig.StatusInterval = 5000
QBConfig.Money = {}
QBConfig.Money.MoneyTypes = {cash = 500, bank = 5000, crypto = 0}
QBConfig.Money.DontAllowMinus = {'cash', 'crypto'}
QBConfig.Money.PayCheckTimeOut = 10
QBConfig.Money.PayCheckSociety = false
 
-- Player management
QBConfig.Player = {}
QBConfig.Player.HungerRate = 4.2
QBConfig.Player.ThirstRate = 3.8
QBConfig.Player.Bloodtypes = {"A+", "A-", "B+", "B-", "AB+", "AB-", "O+", "O-"}
 
-- Server configuration
QBConfig.Server = {}
QBConfig.Server.Closed = false
QBConfig.Server.ClosedReason = "Server Closed"
QBConfig.Server.Uptime = 0
QBConfig.Server.Whitelist = false
QBConfig.Server.WhitelistPermission = 'admin'
QBConfig.Server.PVP = true
QBConfig.Server.Discord = ""
QBConfig.Server.CheckDuplicateLicense = true
QBConfig.Server.Permissions = {'god', 'admin', 'mod'}

2. Server.cfg Configuration

Add QBCore resources to your server.cfg:

# Database
ensure oxmysql

# QBCore Framework
ensure qb-core
ensure qb-multicharacter
ensure qb-spawn
ensure qb-inventory
ensure qb-target
ensure qb-clothing
ensure qb-weathersync

# Jobs
ensure qb-policejob
ensure qb-ambulancejob
ensure qb-management

# Properties
ensure qb-houses
ensure qb-garages

# Vehicles
ensure qb-vehicleshop
ensure qb-vehiclekeys

# UI/UX
ensure qb-hud
ensure qb-menu
ensure qb-input
ensure qb-phone
ensure qb-radialmenu
ensure qb-loading

# Other essentials
ensure qb-bankrobbery

# Database connection string
set mysql_connection_string "mysql://qbcore_user:your_secure_password@localhost/qbcore_server?charset=utf8mb4"

# Server configuration
set sv_hostname "My QBCore Server"
set sv_maxclients 32
set server_description "A QBCore FiveM Server"
set sv_projectName "QBCore Server"
set sv_projectDesc "QBCore FiveM Server"

# QBCore specific
set qb_locale "en"
set qb_UseTarget true
set qb_inventory "qb-inventory"

# Licensing
sv_licenseKey "your_license_key_here"

3. Resource Loading Order

Proper loading order is crucial for QBCore:

# 1. Database connector
ensure oxmysql

# 2. Core framework
ensure qb-core

# 3. Character system
ensure qb-multicharacter
ensure qb-spawn

# 4. Essential systems
ensure qb-inventory
ensure qb-target
ensure qb-clothing

# 5. Environmental
ensure qb-weathersync

# 6. UI Systems
ensure qb-hud
ensure qb-menu
ensure qb-input
ensure qb-radialmenu

# 7. Properties & Vehicles
ensure qb-houses
ensure qb-garages
ensure qb-vehicleshop
ensure qb-vehiclekeys

# 8. Jobs
ensure qb-policejob
ensure qb-ambulancejob
ensure qb-management

# 9. Additional features
ensure qb-phone
ensure qb-bankrobbery
ensure qb-loading

# 10. Custom resources (add your custom resources last)

Verification & Testing

1. Server Startup

Start your server and verify QBCore loads properly:

# Check the console for errors
# Look for messages like:
# [qb-core] QBCore Started!
# [qb-multicharacter] Multicharacter Started!

2. Database Verification

Check that database tables were created:

USE qbcore_server;
SHOW TABLES;
 
-- You should see tables like:
-- players
-- player_vehicles
-- player_houses
-- etc.

3. In-Game Testing

  1. Connect to Server: Join your server
  2. Character Creation: Test the multicharacter system
  3. Basic Functions: Try commands like /me, /job, /inventory
  4. Job System: Test changing jobs with /setjob [job] [grade]

Common Installation Issues

Database Connection Errors

Error: Failed to execute query: Access denied

Solution:

-- Recreate user with proper permissions
DROP USER 'qbcore_user'@'localhost';
CREATE USER 'qbcore_user'@'localhost' IDENTIFIED BY 'your_password';
GRANT ALL PRIVILEGES ON qbcore_server.* TO 'qbcore_user'@'localhost';
FLUSH PRIVILEGES;

Resource Loading Errors

Error: Resource [qb-core] couldn't be started

Solutions:

  1. Check resource path: Ensure resources are in [qb] folder
  2. Verify manifest: Check fxmanifest.lua syntax
  3. Dependencies: Ensure oxmysql loads before qb-core

Permission Errors

Error: You don't have permissions to access this

Solution:

-- Add yourself as admin in qb-core/server/player.lua
-- Or use the database:
INSERT INTO players (license, name, money, job, position) 
VALUES ('license:your_license_here', 'Your Name', '{"cash":5000,"bank":25000,"crypto":0}', '{"name":"admin","label":"Admin","payment":5000,"onduty":true,"isboss":true,"grade":{"name":"Admin","level":10}}', '{"x":-269.4,"y":-955.3,"z":31.22,"h":205.8}');

Post-Installation Steps

1. Admin Setup

Add yourself as admin:

-- Method 1: Direct database
UPDATE players SET job = '{"name":"admin","label":"Admin","payment":5000,"onduty":true,"isboss":true,"grade":{"name":"Admin","level":10}}' WHERE license = 'license:your_license_here';
 
-- Method 2: In-game command (if you have permissions)
/setjob admin 4

2. Basic Server Configuration

Configure basic server settings:

-- In qb-core/shared/config.lua
QBConfig.DefaultSpawn = {x = -254.88, y = -982.14, z = 31.22, h = 207.5} -- Customize spawn location
QBConfig.Money.MoneyTypes = {cash = 1000, bank = 10000, crypto = 0} -- Starting money

3. Job Configuration

Add or modify jobs in qb-core/shared/jobs.lua:

QBShared.Jobs = {
    ['unemployed'] = {
        label = 'Civilian',
        defaultDuty = true,
        offDutyPay = false,
        grades = {
            ['0'] = {
                name = 'Freelancer',
                payment = 10
            },
        },
    },
    ['police'] = {
        label = 'Law Enforcement',
        defaultDuty = true,
        offDutyPay = false,
        grades = {
            ['0'] = {name = 'Recruit', payment = 50},
            ['1'] = {name = 'Officer', payment = 75},
            ['2'] = {name = 'Sergeant', payment = 100},
            ['3'] = {name = 'Lieutenant', payment = 125},
            ['4'] = {name = 'Chief', isboss = true, payment = 150},
        },
    },
    -- Add more jobs as needed
}

Next Steps

After successful installation:

  1. QBCore Configuration - Learn about advanced configuration options
  2. Development Guide - Start developing custom resources
  3. Troubleshooting - Common issues and solutions
  4. Resource Management - Managing and updating QBCore resources

Congratulations! You now have a working QBCore server. Take time to familiarize yourself with the framework before adding custom resources.

Always backup your database and server files before making major changes or updates.