How RSG Framework fits together#
An RSG server is a set of small resources that share one core. Knowing which resource owns what makes it much easier to decide where a feature belongs and which documentation to read.
The layers#
| Layer | Resource | What it owns |
|---|---|---|
| Core | rsg-core | Players and character data, money, jobs, gangs and multi-job, callbacks, notifications, locales, progress bars, prompts, commands, permissions, zones and the database tables it needs |
| Items | rsg-inventory | Item storage, weight and slots, stashes, drops and shops. Items themselves are defined in rsg-core's shared data |
| Banking | rsg-banking | Branch accounts, loans, lockboxes and the home branch that receives legacy bank money |
| Targeting | rsg-target | The eye-target system for entities and zones. It provides ox_target for older scripts |
| Organisations | rsg-society | Gang and job organisations: members, ranks, finances, payroll, fines and audit |
| World systems | rsg-economy, rsg-skills, rsg-reputation | Market prices and taxes, XP levels and perks, honor and standing |
| Gameplay scripts | Everything else | Jobs, activities and places that build on the layers above |
Who owns the data#
Each resource owns its own data and exposes it through exports, so other scripts ask instead of reaching into its tables.
- Players: read through
RSGCore.Functions.GetPlayer(source)on the server.Player.PlayerDataholds the character, money, job, gang and metadata, andPlayer.Functionschanges them. - Money: always through
AddMoney,RemoveMoney,SetMoneyandGetMoney, so player data, money items and the HUD stay in sync. - Items: always through the rsg-inventory exports. Check
CanAddItembeforeAddItem. - Jobs: job definitions live in the database and are managed with
/jobadmin. Players can hold several jobs. - XP, honor, prices: the owning resource stores them; your script reports events or asks for values through exports.
How a typical request flows#
Keep the client for input and display, and the server for every decision:
- The player interacts with something. rsg-target or a prompt triggers your client code.
- The client asks the server through an rsg-core callback or a net event. It sends only what the player chose, never prices or amounts.
- The server looks up the player, checks distance, job, items and cooldowns, and works out the amounts from its own config.
- The server changes money, items or data through the exports above and tells the client what happened with a notification.
Callbacks answer with cb(...). For the pattern in code see Your first RSG script.
What loads first#
oxmysql and rsg-core must start before the resources that depend on them, and every resource lists what it needs in dependencies. rsg-core creates its own tables on first start, and many resources do the same for theirs, so a manual SQL import is usually not needed. The txAdmin recipe on the home page sets the whole stack up in the right order.
Building on the framework#
- Use the layers instead of rebuilding them. Do not write your own money, item or notification system.
- Put shared values in your
config.lua, strings inlocales/*.json, and secrets in a server-only config file. - Document each resource with a
DOCS.md. The build publishes it here automatically.