Final project: a 24/7 store with QBCore · Lesson 1/4 · 6 min
Design the store
Before typing, define what it does and what files you need. A good plan is half the battle.
We're going to build a real resource that brings the whole course together: a 24/7 store. The player walks up to the clerk, opens a menu, picks an item and, if they have money, takes it. All validated on the server.
Scope (what it does and what it does NOT)
- There's a store zone (qb-target) at some Config coordinates.
- On interaction a menu opens (qb-menu or ox_lib) with the products.
- On selection, the client ASKS to buy; the server checks money and delivers the item.
- Prices and items come from Config on the server, never from the client.
Files
tienda_247/
├── fxmanifest.lua
├── config.lua -- coords + catalog (item, price)
├── client.lua -- qb-target + menu
└── server.lua -- validated purchase callbackStructure
Designing first avoids 90% of the mess. Server-authoritative from minute zero: the client opens the menu and asks; the server decides whether to charge and deliver.
Practice what you learned
0/3En la tienda 24/7, ¿quién decide el precio y si se cobra al jugador?
Ordena el flujo de una compra en la tienda, desde que el jugador interactúa hasta que recibe el item.
Coloca las líneas en el orden correcto con las flechas.
El jugador elige un item y el cliente manda su NOMBRE al servidorEl jugador interactúa con la zona qb-target del dependienteEl servidor entrega el item y notifica al jugadorEl servidor busca el precio en Config, comprueba el dinero y cobraEl cliente abre el menú con los productos de ConfigPista
Cliente: target → menú → pedir. Servidor: validar → cobrar → entregar.
Completa la estructura de archivos del recurso de la tienda: el archivo donde van las coordenadas y el catálogo.
tienda_247/├── fxmanifest.lua├── -- coords + catálogo (item, precio)├── client.lua└── server.luaPista
Es un archivo compartido (shared_script) con la tabla Config.
Challenge: code it yourself
Write in 3 lines what the server decides and what the client does in this store.
Write it yourself in your editor (VS Code) and test it on your server. You learn here by doing it, not by copying.
See hint
Client: target + menu + ask. Server: check money, charge and deliver the item.
Escribe aquí tu solución:
