All guides

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#

LayerResourceWhat it owns
Corersg-corePlayers and character data, money, jobs, gangs and multi-job, callbacks, notifications, locales, progress bars, prompts, commands, permissions, zones and the database tables it needs
Itemsrsg-inventoryItem storage, weight and slots, stashes, drops and shops. Items themselves are defined in rsg-core's shared data
Bankingrsg-bankingBranch accounts, loans, lockboxes and the home branch that receives legacy bank money
Targetingrsg-targetThe eye-target system for entities and zones. It provides ox_target for older scripts
Organisationsrsg-societyGang and job organisations: members, ranks, finances, payroll, fines and audit
World systemsrsg-economy, rsg-skills, rsg-reputationMarket prices and taxes, XP levels and perks, honor and standing
Gameplay scriptsEverything elseJobs, 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.PlayerData holds the character, money, job, gang and metadata, and Player.Functions changes them.
  • Money: always through AddMoney, RemoveMoney, SetMoney and GetMoney, so player data, money items and the HUD stay in sync.
  • Items: always through the rsg-inventory exports. Check CanAddItem before AddItem.
  • 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:

  1. The player interacts with something. rsg-target or a prompt triggers your client code.
  2. 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.
  3. The server looks up the player, checks distance, job, items and cooldowns, and works out the amounts from its own config.
  4. 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 in locales/*.json, and secrets in a server-only config file.
  • Document each resource with a DOCS.md. The build publishes it here automatically.

Try GetPlayer, /bandana or weather. ↑↓ to move, Enter to open, Esc to close.