You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add four example resources and harden drug-sell
New complete, runnable reference resources under examples/:
- doorlock: replicated GlobalState lock state + change handlers (state-bags)
- playtime-tracker: oxmysql parameterised queries + migration (database)
- speedometer-hud: rate-limited vanilla NUI HUD (nui + performance)
- secure-shop: server-authoritative purchase flow (patterns + security)
Harden drug-sell:
- enforce the sale cooldown server-side (client cooldown is bypassable)
- server picks the drug the player actually holds (was a random pick that
failed most sales) and rolls the outcome authoritatively
- replace the per-frame key poll with RegisterKeyMapping (0.00ms idle)
- dispatch the police alert from the server with server-read coords
- clean per-player cooldown tables on playerDropped
Add examples/README.md index and register examples/ in the architecture tree.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Complete, ready-to-use CFX resources that demonstrate the skills and rules in this repo. Unlike `templates/` (blank per-framework skeletons), each folder here is a finished resource you can drop into a server and run.
4
+
5
+
Every example follows the repo conventions: `fxmanifest.lua` declares `fx_version 'cerulean'`, `games { 'gta5' }`, and `lua54 true`; logic is server-authoritative; and no credentials are hardcoded.
6
+
7
+
| Example | Demonstrates | Notes |
8
+
|---------|--------------|-------|
9
+
|[`drug-sell`](drug-sell/)| client-server patterns, server-side anti-cheat | Sell drugs to nearby peds. Server owns the cooldown, drug selection, payout, and cop-alert. ESX / QBCore / standalone bridge. |
10
+
|[`doorlock`](doorlock/)|`state-bags`| Lock/unlock doors via replicated `GlobalState` and a `AddStateBagChangeHandler`. Server validates range. Pure Lua, no dependencies. |
11
+
|[`playtime-tracker`](playtime-tracker/)|`database-integration`| Tracks lifetime playtime in MySQL via oxmysql with parameterised queries and a migration. Requires `oxmysql`. |
12
+
|[`speedometer-hud`](speedometer-hud/)|`nui-development`, `performance-optimization`| Vanilla NUI HUD fed by rate-limited, change-gated `SendNUIMessage`, in-vehicle only. No build tooling. |
13
+
|[`secure-shop`](secure-shop/)|`client-server-patterns`, `security-best-practices`| Server-authoritative purchase flow. The client sends only an item id and quantity; the server owns prices and validates everything. |
14
+
15
+
Each example has its own `README.md` with install steps and the specific pattern it teaches.
0 commit comments