modding-fivem-qbcore

SKILL.md

Modding FiveM (QBCore Framework)

When to use this skill

  • When the user asks to create or modify a FiveM resource (fxmanifest.lua).
  • When the user mentions QBCore, "city scripts", or RP framework logic.
  • When working with Lua scripts for GTA V.
  • When creating NUI (HTML/CSS/JS interfaces) for FiveM.

Workflow

  1. Resource Creation:

    • Create folder [script-name].
    • Create fxmanifest.lua (The manifest file).
    • Create client/main.lua and server/main.lua.
  2. QBCore Initialization:

    • In client/main.lua & server/main.lua, retrieve the core object:

      local QBCore = exports['qb-core']:GetCoreObject()
      
  3. Event Handling:

    • Listen for QBCore events (e.g., QBCore:Client:OnPlayerLoaded).
    • Register network events (RegisterNetEvent, TriggerServerEvent).
  4. UI Development (NUI):

    • Use SendNUIMessage (Lua) -> window.addEventListener('message') (JS).
    • Use fetch (https://resource-name/callback) to send data back to Lua.

Instructions

1. fxmanifest.lua Standard

fx_version 'cerulean'
game 'gta5'

description 'My QBCore Script'
version '1.0.0'

shared_scripts { 'config.lua' }
client_scripts { 'client/main.lua' }
server_scripts { 'server/main.lua' }

2. Client-Side Pattern (Lua)

  • Natives: Use FiveM Natives for game logic (spawning cars, drawing markers).
  • QBCore: Use QBCore.Functions.Notify('Message', 'success') for UI feedback.
  • Threads: Use CreateThread(function() ... end) for loops (like drawing markers every frame).

3. Server-Side Pattern (Lua)

  • Database: Use oxmysql (standard for QBCore) for SQL queries.

    MySQL.query('SELECT * FROM players WHERE citizenid = ?', {cid}, function(result) ... end)
    
  • Items: xPlayer.Functions.AddItem('item_name', 1)

4. NUI (HTML/CSS/React)

  • Scripts can open a web browser overlay.
  • Show: SetNuiFocus(true, true)
  • Hide: SetNuiFocus(false, false)

Resources

Weekly Installs
1
GitHub Stars
3
First Seen
Mar 1, 2026
Installed on
amp1
cline1
openclaw1
trae1
opencode1
cursor1