Skip to content
GAMPEONCreate
New project
Preview: this works today, but details can still change.

RP Starter

The RP Starter is GAMPEON’s own roleplay base. It gives a server characters, money, jobs, an inventory, a HUD and admin commands. Two bridges let resources written for ESX or QBCore run on it without changes, as long as they do not use GTA natives.

It is part of the GAMPEON SDK under starter/rp and licensed under MIT, so you can change it and ship it with your server. Ask the GAMPEON team for access while the SDK is not public yet. The design is in ADR 0028.

  • Characters: up to 4 per player account, chosen or created in a web page when the player joins, saved with their position.
  • Money: the accounts cash, bank and black_money. ESX calls cash money; the bridges translate.
  • Jobs with grades, salary and a boss flag. Each grade pays its salary to bank every 10 minutes.
  • Inventory by weight (30 kg by default) with usable items.
  • Callbacks from client to server, notifications and a HUD with cash, bank and job.
  • Admin commands setjob, givemoney, giveitem and charinfo for group.admin. Everyone has /use <item>, /logout and /inventory.
  • Saving with MySQL.*, to SQLite or MariaDB: when a player leaves, every 60 seconds after changes and when the resource stops.

Jobs, items, start money and limits are Lua files in gampeon_rp/shared/. The server decides everything: clients get a copy of their character, and no client event can change money, jobs or items.

gampeon-server --data starter/rp

The included server.cfg uses SQLite in data/rp.db and starts the core with both bridges:

server.cfg
set mysql_connection_string "sqlite:data/rp.db"
add_ace group.admin command allow
ensure chat
ensure gampeon_rp
ensure es_extended
ensure qb-core

Start only the bridges your resources need. On a game server, copy the [rp] folder into your resources folder.

The es_extended bridge keeps the usual entry points:

fxmanifest.lua
shared_script '@es_extended/imports.lua'
server.lua
ESX.RegisterUsableItem('water', function(source)
local xPlayer = ESX.GetPlayerFromId(source)
if xPlayer.removeInventoryItem('water', 1) then
xPlayer.showNotification('You drank some water.', 'success')
end
end)
ESX.RegisterServerCallback('myshop:wallet', function(source, cb)
local xPlayer = ESX.GetPlayerFromId(source)
cb(xPlayer.getMoney(), xPlayer.getAccount('bank').money)
end)

Covered: getSharedObject and esx:getSharedObject, @es_extended/imports.lua (keeps ESX.PlayerData current, calls OnPlayerData), @es_extended/locale.lua, GetPlayerFromId, GetPlayerFromIdentifier, GetExtendedPlayers, RegisterServerCallback, TriggerServerCallback, RegisterUsableItem, RegisterCommand with typed arguments, GetJobs, ShowNotification, and xPlayer with money, accounts, inventory, weight, job, metadata, set/get and coordinates. Events: esx:playerLoaded, esx:playerDropped, esx:setJob, esx:onAddInventoryItem, esx:onRemoveInventoryItem, and on the client esx:setAccountMoney, esx:addInventoryItem, esx:removeInventoryItem, esx:setPlayerData, esx:onPlayerLogout.

The identifier of an xPlayer is the character’s citizen ID.

server.lua
local QBCore = exports['qb-core']:GetCoreObject()
QBCore.Functions.CreateUseableItem('bread', function(source, item)
local Player = QBCore.Functions.GetPlayer(source)
if Player.Functions.RemoveItem(item.name, 1) then
Player.Functions.SetMetaData('hunger', Player.PlayerData.metadata.hunger + 25)
end
end)

Covered: GetCoreObject, QBCore.Functions (GetPlayer, GetPlayerByCitizenId, GetPlayers, GetQBPlayers, CreateCallback, TriggerCallback, CreateUseableItem, HasItem, Notify, HasPermission, GetPlayersOnDuty and more), Player.Functions for money, items, job, duty and metadata, PlayerData with charinfo, money, job, gang, metadata and items, QBCore.Commands.Add, QBCore.Shared.Items and Jobs, @qb-core/shared/locale.lua with Lang:t. Events: QBCore:Server:PlayerLoaded, QBCore:Server:OnPlayerUnload, QBCore:Server:OnJobUpdate, QBCore:Server:OnMoneyChange, and on the client QBCore:Client:OnPlayerLoaded, QBCore:Client:OnPlayerUnload, QBCore:Player:SetPlayerData, QBCore:Client:OnJobUpdate, QBCore:Client:SetDuty, QBCore:Notify.

From clients, the bridge accepts only using items, toggling duty, saving and setting hunger or thirst between 0 and 100.

New resources can use the core directly, without a bridge:

server.lua
local RP = exports.gampeon_rp:GetCoreObject()
RP.RegisterCallback('garage:fee', function(source, respond)
return RP.RemoveMoney(source, 'bank', 50, 'garage')
end)
AddEventHandler('gampeon_rp:playerLoaded', function(source, player, isNew)
print(player.name, player.job.label, player.getMoney('cash'))
end)

The full list of functions and events is in the README of starter/rp.

Gangs, weapons and loadouts, vehicles, slot inventories (QBCore items get slots in list order), ESX.UI menus, ESX.Game, Qbox exports (qbx_core), ox_lib and ox_inventory. The porting check lists every ESX and QBCore call in your resources that the bridges do not cover yet.

Report a problem with this pageOther ways to give feedback