Resource Scaffolding¶
This skill walks through creating a new FiveM or RedM resource with the correct directory structure, manifest, and boilerplate code.
Gather requirements¶
Before generating any files, ask the user for:
- Resource name - lowercase, alphanumeric with hyphens (e.g.
my-resource) - Game target -
gta5(FiveM),rdr3(RedM), or both - Language runtime - Lua, JavaScript, or C#
- Framework - ESX, QBCore, Qbox, ox_core, VORP (RedM), RSG (RedM), or standalone (none)
- Database needed? - yes/no (determines oxmysql dependency)
Directory structure¶
Generate the following structure based on language choice:
Lua (default)¶
JavaScript¶
C¶
resource-name/
fxmanifest.lua
MyResource.csproj
Client/
ClientMain.cs
Server/
ServerMain.cs
README.md
fxmanifest.lua generation¶
Always use this base structure:
fx_version 'cerulean'
games { 'gta5' } -- or { 'rdr3' } or { 'gta5', 'rdr3' }
author 'AuthorName'
description 'Resource description'
version '1.0.0'
Note: Do not add lua54 'yes' -- it is deprecated and ignored. All scripts run on Lua 5.4 by default.
Script declarations by language¶
Lua:
JavaScript:
C#:
Framework dependencies¶
Add the correct dependency directive based on the chosen framework:
- ESX:
dependency 'es_extended' - QBCore:
dependency 'qb-core' - Qbox:
dependency 'qbx_core' - ox_core:
dependency 'ox_core' - VORP (RedM):
dependency 'vorp_core' - RSG (RedM):
dependency 'rsg-core' - Standalone: no dependency directive
Database dependency¶
If the user needs database access, add to server_scripts:
Starter script content¶
Lua client boilerplate¶
local Config = Config or {}
CreateThread(function()
while true do
Wait(1000)
-- Main client loop
end
end)
Lua server boilerplate¶
local Config = Config or {}
RegisterNetEvent('resourceName:serverEvent', function(data)
local source = source
-- Validate source and handle event
end)
Config file¶
Post-generation checklist¶
After scaffolding, remind the user to:
- Update the
authorfield in fxmanifest.lua - Update the
descriptionfield - Add the resource folder to their server's
resources/directory - Add
ensure resource-nameto their server.cfg - Customize config.lua with their settings