Conventions & Gotchas
The house style every Echo resource follows — and two pitfalls that will bite you if you don't know them.
Conventions
- Prefix everything with echo_ — resource names, exported globals, events, and SQL tables.
- Server-authoritative — validate on the server and never trust the client. Money, items, and job changes happen server-side only.
- Auto-install your SQL — create your own tables on first start with
CREATE TABLE IF NOT EXISTS. Don't ship a.sqlfile for the user to import. - Stay light — cache in memory and persist on an interval, not on every change and never on hot paths.
Gotchas
⚠️ Metatables are stripped across resources
exports.echo_core:GetPlayer(src) returns an OOP object. FiveM strips its metatable over the export boundary, so calling methods on it from another resource (:GetMoney(), :SetJob(), …) fails with a "nil value (method …)" error. Use the flat helpers instead — Echo.GetPlayerData, Echo.GetMoney, Echo.AddMoney, etc. — which return plain values.
⚠️ provide doesn't reroute exports
echo_ui declares provide 'ox_target' and echo_inventory declares provide 'ox_inventory'. That only makes GetResourceState('ox_target') report "started" — it does NOT make exports.ox_target:… route to echo_ui. Always call the real resource:
-- wrong (silently fails — no such export)
exports.ox_target:addBoxZone(...)
exports.ox_inventory:AddItem(...)
-- right
exports.echo_ui:AddBoxZone(...)
exports.echo_inventory:AddItem(...)