RSG Framework: the foundation your RedM server is built on.
RSG Framework gives a Red Dead roleplay server its foundations: players, money, jobs, inventory, banking, targeting and security, all working together from the first boot.
Get the core once, then read everything about a player from one object.
local RSGCore = exports['rsg-core']:GetCoreObject()
local Player = RSGCore.Functions.GetPlayer(src)
if not Player then return endlocal data = Player.PlayerData
-- data.citizenid, data.charinfo, data.job,-- data.gang, data.money, data.metadata ...print(data.charinfo.firstname, data.job.label)
Four money types. Failed payments return false, so you never hand out goods for free.
-- cash, gold, bank, bloodmoneyif Player.Functions.RemoveMoney('cash', 12, 'general-store') then
exports['rsg-inventory']:AddItem(src, 'bread', 1)
else
RSGCore.Functions.Notify(src, 'Not enough cash', 'error')
end
Players can hold several jobs and switch between them. Built into the core.
local ok, reason = RSGCore.Functions.AddPlayerJob(src, 'sheriff', 1)
if not ok then-- invalid_job, invalid_grade, max_jobs ...endlocal held, grade = RSGCore.Functions.HasPlayerJob(src, 'sheriff')
local jobs = RSGCore.Functions.GetPlayerJobs(src)
Check the space first, then add. Notifications and logging happen for you.
if exports['rsg-inventory']:CanAddItem(src, 'resource_wood', 5) then
exports['rsg-inventory']:AddItem(
src, 'resource_wood', 5, nil, nil, 'woodcutting'
)
end-- stashes and shops use the same exports
exports['rsg-inventory']:OpenInventory(src, 'sheriff-stash', {
maxweight = 100000, slots = 50
})
Add interactions to peds, props, models and zones, limited by job, gang or item.
Ask the server a question from the client and wait for the answer.
-- server
RSGCore.Functions.CreateCallback('res:server:getThing', function(source, cb)
cb(result)
end)
-- clientlocal result = RSGCore.Functions.AwaitCallback('res:server:getThing', 5000)
Everything a roleplay server needs in the core.
The pieces most servers build first are already here and already connected, so your own scripts can focus on gameplay.
Player data and characters
One player object holds identity, money, job, gang, metadata, position and items. Look players up by source, citizen ID, license or character details, online or offline.
Health, hunger, thirst, cleanliness and stress in metadata
Reputation tracking per player
Extend the player with your own methods and fields
Money that fits the setting
Cash, gold, bank and blood money, with optional money items so cash can sit in the inventory like it would in a satchel.
cashgoldbankbloodmoney
Multi-job
Players hold several jobs and switch with /myjobs. Admins create and edit jobs in game with /jobadmin. Definitions live in the database.
Inventory
Slots and weight, stashes, drops and shops. Add items safely with space checks, and register new items at runtime.
Banking
Branch-based accounts with a home branch, loans and lockboxes, available to every script through exports.
Targeting
rsg-target gives you eye-targeting on entities, models and zones, built in the RSG resource structure.
Prompts and notifications
Press-to-interact prompts and prompt groups at world coordinates, plus a notification UI with titles, icons and positions.
Commands and permissions
Register commands with argument help and a permission level from helper up to god.
Change the world while it runs
Add, update and remove items, jobs and gangs from the server without a restart. Connected clients receive the changes straight away, so shop scripts, job tools and admin panels can manage content live.
Callbacks and events
Client-to-server and server-to-client callbacks with timeouts, and a clear set of player load, job, money and duty events.
Safer by default.
Roleplay servers get tested by players. The core closes the common holes so your scripts start from a safe place.
Clients can only write what they shouldOnly a short list of metadata, such as hunger and thirst, can be set from the client. Everything else is set on the server.
Money calls tell you if they failedRemoving money returns false when the player can't pay, and amounts must be valid numbers.
Exploit attempts have a built-in answerBan an exploiter with one call, and protect sensitive events with the core's CSRF token.
Database access is parameterisedScripts use oxmysql with placeholders, so player input never becomes SQL.
Every resource has its documentation.
Each RSG resource keeps a DOCS.md next to its code, and every one is published here. Pick a resource to read it.
The RSG recipe builds the whole server for you: database, dependencies, framework, community scripts and map mods. You need a RedM server with txAdmin, a MySQL or MariaDB database and a Cfx.re key.
Make an empty MySQL or MariaDB database for your server and note the host, user, password and database name.
Open the txAdmin deployer
In txAdmin, start a new server and choose to deploy from a remote recipe URL. Paste the recipe URL above.
Enter your database details
The recipe connects to your database and imports the RSGCore SQL for you, so there is no manual import.
Run the recipe
txAdmin downloads and sets everything up. It pauses between batches to avoid GitHub rate limits, so give it a few minutes.
Start the server and join
Review the generated server.cfg, add your licence key, start the server and create your first character.
What the recipe installs
[cfx-default]The default FiveM and RedM server data resources, without the stock chat.
[standalone]oxmysql, ox_lib, PolyZone, xsound, interact-sound, menu_base, rNotify and redm-female-fix.
[framework]rsg-core, rsg-inventory, rsg-character and the RSG gameplay resources.
[community]Nt_Blackjack and Nt_Holdem.
[mapmods]rsg-mapping and redm-ymaps.
Prefer to do it by hand? Clone the resources into the same folders and ensure oxmysql, ox_lib and rsg-core in that order. The recipe repository shows exactly what it installs.
Help keep RSG Framework moving.
RSG Framework is built and maintained by RexShack. Your support pays for the time that goes into new resources, fixes and documentation.