fivem-basics
Installation
SKILL.md
FiveM basics
Resource structure, fxmanifest, client/server split, events, exports and debugging for FiveM Lua.
Activation Contract
Load this skill when the user creates or edits any FiveM resource, fxmanifest.lua, client*.lua or server*.lua, asks how client/server, events or exports work, or reports a bug that needs server vs F8 logs.
Hard Rules
- Manifest:
fx_version 'cerulean'andgame 'gta5'(or'rdr3'/'common'); every client-served file goes infiles. - Register networked events with
RegisterNetEvent; local-only events useAddEventHandleralone, neverRegisterNetEvent. - Server handlers read the sender from
source; broadcast withTriggerClientEvent(event, -1, ...). GetInvokingResource()is nil for every net event that crosses the network; it is not an authentication check. Validate types, ranges and server-owned state instead.- Never handle money or item transactions on the client; validate and apply on the server.
- No game natives in
shared_scriptsunless guarded by environment. - Use
PlayerPedId()notGetPlayerPed(-1); use#(a - b)notGetDistanceBetweenCoords. - Prefer
local; prefer variableWait()over fixedWait(0). - Resource names use underscores, no spaces or special characters.