esx-framework
ESX Framework Development
This skill provides guidelines and patterns for developing resources using the ESX Framework (Legacy).
1. Core Object Retrieval
ESX Legacy (New Way):
local ESX = exports["es_extended"]:getSharedObject()
Legacy / Backwards Compatible:
local ESX = nil
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
2. Key Concepts
Player Data (Server-side)
- xPlayer: The main object for player interaction server-side.
- ESX.GetPlayerFromId(source): Retrieves the xPlayer object.
- xPlayer Methods:
xPlayer.addMoney,xPlayer.setJob,xPlayer.addInventoryItem.
Callbacks (Server -> Client Data)
- ESX.RegisterServerCallback (Server): Respond to client requests.
- ESX.TriggerServerCallback (Client): Request data from server.
Items & Database
- Items are defined in the database (
itemstable) orox_inventory. - Database typically uses oxmysql.
3. Standard Resource Structure
my-resource/
├── fxmanifest.lua
├── config.lua
├── client/
│ └── main.lua
├── server/
│ └── main.lua
└── locales/
└── en.lua
4. Best Practices
- Use New Exports: Prefer
exports["es_extended"]:getSharedObject()over the event trigger. - Validate xPlayer: Always check
if xPlayer thenbefore using it. - Secure Events: Use
ESX.SecureNetEvent(if available) or manual checks. - OneSync: Develop with OneSync Infinity in mind (server-side entity creation).
5. Documentation
- Official Docs: https://documentation.esx-framework.org/
- Github: https://github.com/esx-framework/esx_core
More from proelias7/fivem-skill
fivem-development
Develops resources for FiveM using vRP Creative Network with Lua. Covers resource creation, Proxy/Tunnel system, inventory, money, groups, identity, NUI, database (oxmysql), security, and performance. Use when the user works with FiveM, vRP, Lua scripts for GTA V servers, or mentions resources, client/server scripts, natives, NUI, or any system of the vRP Creative Network framework.
101qbox-framework
Develops resources for FiveM using the Qbox Project (qbx_core). Covers the exports-based API, bridge compatibility, Ox integration (ox_lib, ox_inventory), and best practices. Use when the user works with FiveM, Qbox, qbx_core, or mentions `exports.qbx_core`, `QBX.PlayerData`, or `ox_lib`.
44qbcore-framework
Develops resources for FiveM using the QBCore Framework. Covers resource creation, Core Object usage, Player management, Callbacks, Events, Items, Jobs, Gangs, Database (oxmysql), and best practices. Use when the user works with FiveM, QBCore, Lua scripts for QBCore servers, or mentions `QBCore.Functions`, `GetCoreObject`, `CitizenID`, or any system of the QBCore Framework.
35qbcore-development
Develops resources for FiveM using the QBCore Framework. Covers resource creation, Core Object usage, Player management, Callbacks, Events, Items, Jobs, Gangs, Database (oxmysql), and best practices. Use when the user works with FiveM, QBCore, Lua scripts for QBCore servers, or mentions `QBCore.Functions`, `GetCoreObject`, `CitizenID`, or any system of the QBCore Framework.
1