Frameworks: ESX and QBCore · Lesson 1/5 · 7 min

What a framework is and why you need it

A framework like ESX or QBCore gives you players, money, jobs and inventory already solved so you don't reinvent the wheel.

FiveM on its own gives you the game engine, but it doesn't know what a «player with money», a «police job» or an «inventory» is. That's provided by a roleplay framework. The two most used are ESX and QBCore.

What a framework solves for you

  • Money accounts (cash, bank) per player, saved in the database.
  • Jobs and grades (police, EMS, mechanic…).
  • Inventory and items.
  • A persistent player identity (their character) across sessions.
  • Ready-made functions so your script can talk to all of that.

Without a framework you'd have to program all of that from scratch. With ESX/QBCore, your script just asks «give 500€ to this player» and the framework handles the rest (validating, updating the DB, syncing).

How it's loaded into your resource

lua
-- In the fxmanifest.lua, import ESX:
shared_scripts {
  '@es_extended/imports.lua',
  'config/config.lua',
}

-- From there, in client and server you have the global ESX variable available.

fxmanifest.lua with ESX

Modern ESX Legacy uses imports.lua (you no longer need the old TriggerEvent('esx:getSharedObject')). In QBCore you import it with exports['qb-core']:GetCoreObject().

Practice what you learned

0/3
Test

¿Qué aporta un framework de roleplay como ESX o QBCore que FiveM por sí solo no da?

Rellena los huecos

Completa la línea del fxmanifest que importa ESX Legacy en shared_scripts.

1shared_scripts {
2 '@es_extended/',
3 'config/config.lua',
4}
Pista

ESX Legacy moderno se carga con imports.lua, no con el viejo esx:getSharedObject.

Test

En QBCore, ¿cómo obtienes el objeto del core?

Challenge: code it yourself

Explain in your own words what would happen if you tried to give money to a player WITHOUT using a framework.

Write it yourself in your editor (VS Code) and test it on your server. You learn here by doing it, not by copying.

Escribe aquí tu solución:

How was this lesson?