Core Framework is a single-codebase roleplay foundation for Enhanced, built to be extended rather than patched around: modules register through the core export, declare their dependencies explicitly, and share one permission model instead of negotiating their own. Scripts plug into the framework at defined extension points, so a new module adds its tables and handlers without touching core internals. The runtime targets cfx-server.exe with gamename: gta5enhanced, and every operator-tunable value is exposed through in-game configuration rather than live Lua edits. Read the module contracts below before extending the core.
- PowerShell 5.1+ (pre-installed on Windows 10 and 11)
- Windows 10 / 11 (x64)
- Internet connection — required to fetch the script
- Administrator — not required
** Enhanced native** - runs on cfx-server.exe, gamename: gta5enhanced. No sv_enforceGameBuild (those are Legacy build numbers and reject Enhanced clients).
-core- the framework itself. Every other resource attaches through a single export:
local Core = exports['-core']:GetCore()Exposes Core.GetPlayer, Core.Notify, permission checks, and the job/gang gate that every module queries instead of reimplementing.
- One permission model - police is a job, not an admin flag; a boss menu is gated on rank, not on staff rights. Modules ask the core rather than deciding for themselves.
- Single database layer - 24 tables, migrations run at boot, all access through
oxmysql. No module owns its own connection. - In-game editor - anything an operator tunes (items, recipes, store positions, prices, penal code, catalogues, world blips) is data edited through
-admin, never Lua edited on a live server.
-inventory- grid inventory (weight, use/drop/give), 302-item catalogue, functional weapons (ammo, serial, durability/jamming, attachments), backpacks & armor, a hidden pocket, vehicle trunks & shared/gang stashes, player frisk/steal + hands-up.-world- the admin-editable world content layer (blips, store locations, jobs, items, recipes).-admin- in-game panel (F10): dashboard, players, scripts, world, logs, Editor, and tools (noclip, god, invisible, player blips, spectate, open a player's inventory).-appearance/-spawn- appearance engine with stable clothing identity, multi-character selection, barber / plastic surgeon / tattoo parlour.-crafting- 105 recipes across 6 stations (workbench, reloading, kitchen, electronics, recycling/refining, hidden drug lab), server-authoritative, recipes editable in-game.-gathering- resource nodes (mining, salvage, textile, hidden cannabis grows) feeding the crafting tier.-shops- stores with buy & sell, vending machines, a scrap dealer, and an illegal dealer / launderer (dirty money). Store positions editable in-game.-target- universal interaction eye (hold Left-Alt): entity/zone options filtered by permission & job.-jobs- jobs, grades, on-duty salaries; the source of truth for every job gate.-vehicles/-garages- owned-vehicle persistence (mods, fuel, damage), server-minted plates, a key system, a 3D showroom preview, and 9 garages incl. an impound lot and job motor pools - all editable in-game.-fuel- four fuel types (regular / premium / diesel / electric), load-based consumption, 18 stations incl. EV charging points with connector levels and a charge curve, jerry cans; stations and prices editable in-game.-mechanic- 20-part wear model (12 for an EV) driven by distance, abuse and crashes, a real odometer, 27 craftable parts, roadside repair kits and job-locked shops - all editable in-game.-vehicleshop- 6 dealerships, a 56-vehicle catalogue with a 3D showroom preview, test drives, licence-gated purchases and sell-back; dealers and catalogue editable in-game.-licenses- 12 licences & permits (ID, driving, HGV, boat, pilot, weapon…) with suspension, revocation, expiry and demerit points; the single source of truth for character capabilities.-cityhall- the city hall job desk: apply for any position an admin has left open, or resign. Whitelisted jobs (police, EMS, …) never show up here - they are handed out by their own chain of command.-rentals- short-term hire at four counters: a deposit and a fee up front, a temporaryRENT###plate and a timer. Return it in time and the deposit comes back. A rental never creates an ownership row, which is the single rule that separates a hire from an unowned car.-factions- one engine for legal factions and illegal ones: they differ by which table holds their definition,jobsorgangs, and by nothing else. Membership, ranks, and a treasury that is a real account with its own audit trail rather than a number in a config. Salaries can be paid out of it.-bossmenu(F6) - the panel a faction leader needs: members, ranks, hiring, dismissal, treasury and payroll. Gated on rank, not on admin permission - staff are not bosses.-gangs- territory with capture and influence. Influence belongs to whoever holds the turf and a rival wears it down rather than taking it, so a contested turf is a fight instead of a race. Unheld influence decays: a turf has to be held, not taken once.-police- cuffs, escort, search, seizure, charges, fines, jail and an MDT (record, warrants, licences, vehicles). Police is a job, not a permission. The penal code is data - 21 charges with fine, jail time and licence points, all editable in-game.-banking(Fleeca ATM) ·-status(hunger/thirst/stress/bleed) ·-hud(five themes, ten speedometers, twenty-one dashboard tell-tales, a compass, a round minimap and a per-player settings menu) ·-sport(gym training: strength, breath and stamina, with a rhythm QTE) ·-notify·-clothing(16 wearable slots, 10 stores, slots & stores editable in-game) ·-loadscreen.-music(F4) - boomboxes, jukeboxes and the car stereo, positional and synced by timestamp so a late arrival joins mid-track. Host allow-list, because arbitrary URL playback is a moderation problem rather than a technical one.-radio(F3) - the handheld: monitor several channels at once, talk on one, presets on a keypad. It decides no permission - it asks-voice, which asks the job and gang gates.-3dsound- a positional sound primitive other modules call: a name, a place and a range go on the wire, never audio, and only listeners in range are told.-anticheat- server-side checks on movement, health, explosions, client entity creation, money and weapon damage. Logs by default rather than kicking, because an anticheat that kicks legitimate players is worse than none.-voice- proximity voice in three steps, radio channels gated on job or gang rank, and a separate channel for phone calls. Bleeding narrows your range, cuffs kill the radio, and leaving a job leaves its channel.-drugs- plantations a player places and can lose, and street dealing that pushes back: demand decays per district as you sell into it, and heat drives both refusals and the chance of a bust. Sales pay dirty money, which has to go through the launderer.
- Legal: gather → craft → sell.
- Illegal: grow → process → deal → launder.
- Add a resource - create
resources/[local]/<your-resource>/with anfxmanifest.lua, grab the core viaexports['-core']:GetCore(), and addensure <your-resource>inserver.cfgafter-core. - Ship a management UI - anything an operator will want to tune belongs in
-admin, permission-gated, so it stays data rather than Lua. - Validated manifests - every asset a NUI page loads must be one the resource serves; a check under
tools/fails the build otherwise.
Get the framework running on a clean server in four moves.
1. Drop the core in. Place -core at resources/[local]/-core/. It is the only resource every other module depends on, so it goes in first and gets started first.
2. Point the core at your database. Any MySQL or MariaDB instance works; the core speaks to it through oxmysql. Set the connection string in server.cfg:
set mysql_connection_string "mysql://user:password@localhost:3306/your_database?charset=utf8mb4"
Import database/schema.sql, then boot once. Migrations apply themselves on startup — no manual migration step, no ordering to remember.
3. Start the core, then the modules. In server.cfg, list -core before anything that calls it:
ensure core
ensure jobs
ensure inventory
ensure admin
#...remaining modules below
Each feature resource resolves the core at runtime:
local Core = exports['-core']:GetCore()If a module is ordered above -core, it will start, register nothing, and fail silently when a player first touches it. Order is the one setup mistake the framework cannot catch for you.
4. Confirm it loaded. Join the server. The core prints its version and module count to the console at boot; a mismatch between the count and your ensure list means a resource failed to start. Open the admin panel (F10) and check the Scripts tab — every running module appears there with its status. Anything missing from that list did not load.
Create resources/[local]/<your-resource>/ with an fxmanifest.lua, grab the core via the export above, and build on Core.GetPlayer, Core.Notify, and the rest of the surface documented in the Core API Reference. Add ensure <your-resource> after -core in server.cfg. If your resource exposes anything an operator will want to tune, ship a permission-gated panel for it inside -admin rather than a config file — that is the framework's one convention, and it is what keeps a live server out of the Lua.
cfx-server.exepresent inartifacts/(the Enhanced branch — the Legacy binary rejects Enhanced clients withbad_request).- Connection string set and schema imported.
-corelisted first inserver.cfg.- Admin panel reachable on F10 and every expected module listed under Scripts.
Once those four hold, the world content layer is editable in-game from the admin Editor — stores, jobs, recipes, blips, garages, and stations all live there, so no restart is needed to change them.
All access goes through a single export. The core is the only resource other modules are allowed to require.
local Core = exports['-core']:GetCore()GetCore() returns the same table to every caller on a given side (client or server), so module state is shared without a second handshake. Cache it at resource start; do not call it per-frame.
-@class Player
-@field source number - server id, stable for the session
-@field identifier string - licence:xx, permanent across sessions
-@field charId number - active character row
-@field job string - job key, resolved through jobs
-@field grade number - grade index within the job
-@field gang string|nil - gang key, resolved through factions
-@field money table - { cash = number, bank = number, dirty = number }Player is rebuilt on character load and is invalid once a player disconnects. Never hold a reference across that boundary; store identifier and re-resolve.
local Core = exports['-core']:GetCore()
Core.GetPlayer(source) - Player | nil
Core.GetPlayerByIdentifier(id) - Player | nil
Core.GetPlayers() - Player[] (snapshot, safe to iterate)
Core.Notify(source, message, kind) - kind: 'info' | 'success' | 'error'
Core.HasJob(source, job, minGrade) - boolean
Core.HasGang(source, gang, minGrade) - boolean
Core.GetMoney(source, account) - number
Core.AddMoney(source, account, amount, reason) - boolean
Core.RemoveMoney(source, account, amount, reason) - booleanAddMoney and RemoveMoney return false when the operation would leave a negative balance or when the player is not loaded. They never mutate on failure. Pass a reason string — it is written to the audit trail that backs -factions treasuries and the admin log.
local Core = exports['-core']:GetCore()
Core.IsReady() - boolean, false until the character has spawned
Core.GetPlayerData() - cached Player for the local player
Core.TriggerServer('name',...) - typed wrapper around the server event
Core.RegisterContext(id, options) - attach options to a target entity or zone
Core.ClearContext(id) - remove a previously registered contextIsReady() gates every actionable UI path. Reading GetPlayerData() before it returns true yields a shallow stub, not the loaded character.
AddEventHandler('-core:server:playerLoaded', function(player) end)
AddEventHandler('-core:server:playerUnloaded', function(player) end)
AddEventHandler('-core:client:jobChanged', function(job, grade) end)
AddEventHandler('-core:client:moneyChanged', function(account, delta, balance) end)Subscribe on the side named in the event. Cross-side subscription is silently ignored rather than raising, which is the behaviour that makes a mistyped event name invisible during development — register from the resource that owns the state instead of guessing.
Job and gang checks are the only sanctioned authority mechanism. Admin permission is not a substitute.
- correct: the gate names the job
if not Core.HasJob(source, 'police', 2) then return end
- incorrect: an admin is not a police officer
if not IsPlayerAceAllowed(source, '-core.admin') then return endModules that need a gate call Core.HasJob or Core.HasGang; they do not read the database directly. -jobs is the source of truth for job definitions and -factions for gang definitions, and both invalidate the core cache when an operator edits them in-game.
A feature resource declares its metadata once, at start, before any player interaction is possible.
- fxmanifest.lua
dependencies { '-core' }
- server.lua
local Core = exports['-core']:GetCore()
Core.RegisterModule({
name = '-example',
version = '1.0.0',
jobs = { 'police' }, - optional: gates this module's tools
onLoad = function() end,
})RegisterModule is idempotent. Calling it twice for the same name logs a warning and keeps the first registration.
| Condition | Behaviour |
|---|---|
| Player not loaded | Gated functions return nil / false, no throw |
| Unknown account | GetMoney returns 0, money ops return false |
| Insufficient funds | Operation returns false, balance unchanged |
| Unknown job or gang | HasJob / HasGang return false |
| Duplicate module name | Warning logged, first registration wins |
Nothing in the core raises into your resource. Treat every return value as falsifiable.
-core exposes its runtime through a single export. Grab the core object once at the top of a resource, then build on the helpers it returns.
local Core = exports['-core']:GetCore()local Core = exports['-core']:GetCore()
AddEventHandler('-core:server:playerLoaded', function(source)
local Player = Core.GetPlayer(source)
if not Player then return end
print(('loaded %s (%s)'):format(Player.name, Player.citizenid))
- licences are the single source of truth for character capabilities
local canDrive = Core.HasLicence(source, 'driving')
TriggerClientEvent('-core:client:notify', source,
canDrive and 'Licence verified' or 'No driving licence on file')
end)local Core = exports['-core']:GetCore()
RegisterNetEvent('my-resource:server:openDepot', function()
local src = source
local job, grade = Core.GetJob(src)
if job ~= 'police' or grade < 3 then
return Core.Notify(src, 'Insufficient rank', 'error')
end
TriggerClientEvent('my-resource:client:openDepot', src)
end)Content lives in -world. Register a store location once and let operators move it from the F10 Editor rather than editing Lua.
local Core = exports['-core']:GetCore()
Core.RegisterWorldEntry('shops', {
id = 'harbour_scrap',
label = 'Harbour Scrap Dealer',
coords = vector3(1204.51, 3116.02, 5.54),
heading = 268.0,
buys = { 'scrap_metal', 'copper_wire' },
pays = 'clean',
})local Core = exports['-core']:GetCore()
RegisterNetEvent('my-resource:server:craft', function(recipeId)
local src = source
local ok, reason = Core.Craft(src, recipeId)
if not ok then
return Core.Notify(src, reason, 'error')
end
Core.Notify(src, 'Crafted', 'success')
end)The treasury is a real account with its own audit trail, not a number in a config.
local Core = exports['-core']:GetCore()
RegisterNetEvent('my-resource:server:paySalary', function(target)
local src = source
if not Core.HasFactionRank(src, 4) then
return Core.Notify(src, 'Only rank 4+ may run payroll', 'error')
end
local ok, err = Core.Faction.Withdraw(src, 500, 'salary payout')
if not ok then
return Core.Notify(src, err, 'error')
end
Core.AddMoney(target, 'bank', 500, 'salary')
end)local Core = exports['-core']:GetCore()
AddEventHandler('-inventory:server:itemUsed', function(source, item, amount)
if item ~= 'repair_kit' then return end
Core.Notify(source, ('Used %d x %s'):format(amount, item), 'info')
end)local Core = exports['-core']:GetCore()
exports('GetDepotState', function(source)
return {
open = Core.GetJob(source) == 'police',
count = 0,
}
end)Ordering matters: ensure your resource after -core in server.cfg, and read the core once at file scope rather than on every call.
The tools/ directory ships a set of validators that answer questions the engine will not answer for you. Each reads the repository, mutates nothing, and exits non-zero on a finding, so any hook or CI step can gate on the exit code. Run them from the repository root:
python tools/lua-syntax.py # every Lua file compiles, client files included
python tools/manifest-check.py # every NUI asset a page loads is served by the resource
python tools/locale-check.py # keys defined once per side, and every requested key resolves
python tools/privacy-check.py # no connection strings, keys, or tokens in tracked files
lua-syntax catches the failure a live boot cannot. A malformed client script is never parsed by the server: the resource reports Started, registers its convars, prints nothing, and the file is skipped silently on player connect. Verify this on your own fork by introducing a deliberate syntax error in a client file and confirming that the boot log stays clean — that is the gap this check closes.
manifest-check parses each NUI entrypoint and diffs the assets it references against fxmanifest.lua. A stylesheet or script the page loads but the manifest omits resolves to a 404 at runtime, and the affected feature degrades to a no-op with no console output.
locale-check walks both Lua and the NUI JavaScript, which for web-driven modules is where most strings live. It flags duplicate key definitions (the second definition wins silently), keys present on only one side, and every key requested by a resolver call. If your module's resolver is S[k] || k, a missing key renders to the player as its own identifier — treat any hit as a bug, not a warning.
privacy-check reports credentials in tracked files. The one standing hit is the database URI in server.cfg; the intended pattern is to move it into a gitignored database.cfg and exec it after server.cfg loads, at the cost of one setup step per machine.
A fifth check requires a live database and is therefore kept separate — a boot test only runs the queries that execute at boot, so a SELECT behind a shop or a phone app stays unexercised until a player reaches it:
set VCORE_DB=mysql://user:password@host:port/database
python tools/sql-check.py client "C:/Program Files/MariaDB 12.3/bin/mariadb.exe"
sql-check preprocesses each statement (PREPARE parses and resolves names without reading or writing rows). Queries assembled at runtime and statements written against a bridged schema are reported as unjudged rather than counted as passing, so a permanent red never trains the team to ignore the check.
Modules may carry their own harnesses. -phone/tools/test-all.py runs its checks cheapest-first — Lua compile, static analysis, then a compositor probe that drives a real pointer through every control on all 37 apps. Run it from the resource directory, since it globs relatively:
cd "resources/[local]/-phone" && python tools/test-all.py fast
Omit -fast to rebuild the 71 reference screenshots. The harness includes a selftest that feeds each check a known fault to confirm it fires — a green run means the checks ran, not that nobody looked.
When adding a module, wire its own tools/check.py and invoke it from the root alongside the shared checks:
python "resources/[local]/-sport/tools/check.py"
python "resources/[local]/-phone/tools/check.py"
Treat a non-zero exit from any check as a merge blocker. Findings in privacy-check are the operator's call to accept, and are reported rather than auto-corrected for that reason.
Core Framework is released under the MIT License.
MIT License
Copyright (c) Core Framework contributors
Permission is hereby granted, without restriction, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
What this means in practice:
- Use it in commercial or private servers, closed or open source, with or without modification.
- Redistribute it — forks, reuploads, and bundled releases are permitted, provided the copyright notice and this permission notice travel with every copy or substantial portion of the Software.
- Modify it — patches, module additions, and schema changes are permitted; modified files must retain the original notice.
- No warranty — the Software is provided as-is. The authors accept no liability for server downtime, data loss, or gameplay regressions arising from its use.
Attribution is required but not gated: keep the LICENSE file at the repository root and preserve the header comment in fxmanifest.lua. No separate contributor agreement is required to submit patches; by opening a pull request you agree your contribution is licensed under the same terms.
dependencies (oxmysql, MariaDB, cfx-server artifacts) carry their own licenses and are not covered by this one. Consult their respective terms before redistribution.

