All resources

rsg-goldclaim — Developer & Server Owner Docs#

Version 3.2.0 · see README.md for install and player flow.

Contents#

  1. Architecture
  2. Data formats
  3. Server events
  4. Callbacks
  5. Client events
  6. Webhook API
  7. Security model
  8. Database schema
  9. Persistence
  10. How-tos
  11. Troubleshooting

Architecture#

FileSidePurpose
shared/config.luasharedAll gameplay settings
server/sv_config.luaserverWebhook settings (server only, never shared)
server/server.luaserverRocker state, validation, processing loop, degradation timer, auto database
server/webhooks.luaserverBatched Discord logging (Webhook.Log, Webhook.Suspicious)
server/versionchecker.luaserverGitHub version check
client/utils.luaclientNotify, model/anim loaders, DoTimedAction, busy state, blips
client/nui.luaclientContext menu + input dialog bridge to the NUI
client/placeprop.luaclientGhost-prop placement with prompts
client/main.luaclientRocker streaming, rsg-target options, claim zones, actions
html/NUILeather & gold menus and input dialog

Dependencies: rsg-core (locale, notify, callbacks), rsg-inventory, rsg-target, oxmysql. No ox_lib.

Data formats#

Rocker (Config.PlayerProps[i], synced to clients):

{ id = 123456, proptype = 'tool_goldrocker', x, y, z, h, hash = Config.GoldRocker,
  builder = 'CITIZENID', buildtime = os.time(), licensed = 0|1, claimname = 'string'|nil }

Pending outputs (server memory only): PendingOutputs[propid] = { cid, gold = n, paydirt = n }

Server events#

All take the rocker propid and are validated (player exists, rocker exists, player within range of the stored position).

EventArgsChecks
rsg-goldclaim:rocker:server:newPropcoords, headingdistance ≤ PlaceMaxDistance, spacing, max per character, has tool_goldrocker, 3s cooldown
rsg-goldclaim:rocker:server:destroyProppropidowner, quality 100, not processing, no uncollected outputs, CanAddItem
rsg-goldclaim:rocker:server:leodestroypropidjob type LeoJobType, unlicensed, cooldown
rsg-goldclaim:rocker:server:addpaydirt / addwaterpropidhas item, atomic capacity update, cooldown
rsg-goldclaim:rocker:server:processrockerpropidowner (if OwnerOnlyProcessing), lock, water/paydirt/quality > 0
rsg-goldclaim:rocker:server:pickupgold / pickuppaydirtpropidserver-produced pending output for this citizen, PickupDistance
rsg-goldclaim:rocker:server:repairrockerpropidwood, quality < 100, conditional update with refund
rsg-goldclaim:rocker:server:renameclaimpropid, namelicensed owner, 3–MaxClaimNameLength chars, sanitised, cooldown
rsg-goldclaim:rocker:server:digpaydirt / fillbucket—has tool, cooldown matched to action time

Callbacks#

rsg-core callbacks (RSGCore.Functions.AwaitCallback):

NameArgsReturns
rsg-goldclaim:server:getprops—all rockers
rsg-goldclaim:server:getpending—{ {propid, gold, paydirt} } for the caller
rsg-goldclaim:server:countprops—number of rockers the caller owns
rsg-goldclaim:server:getrockerdatapropidDB row + processing flag, only if within ClaimZoneRadius

Client events#

Server → client: updatePropData(props), removePropObject(propid), refreshclaim(propid, name), spawnoutputprop(propid, 'gold'|'paydirt', silent), processingcomplete(propid), goldpickupresult(amount), createprop, useshovel, usebucket (all prefixed rsg-goldclaim:rocker:client:).

Webhook API#

Webhook.Log('gold_pickup', src, 'Title', { { 'Field', value } }, { description = '...', ping = '<@&role>' })
Webhook.Suspicious(src, 'reason', { { 'Field', value } })

Console test: goldclaim_webhooktest (server console only).

Security model#

  • The client only requests; the server validates position, ownership, job, items and cooldowns.
  • Outputs can only be claimed if the server produced them for that citizen.
  • Paydirt/water/repair use conditional SQL updates and refund on a lost race.
  • Far-away requests (5× range) are logged to the security webhook.
  • Not checked server-side: whether the player is standing in water when digging/filling (the server has no water query). The cooldown limits the rate to one per action time.

Database schema#

player_goldrockers (id PK, citizenid, owner, properties TEXT json, propid UNIQUE, proptype,
                    licensed TINYINT, claimname, paydirt, water, quality)

Created automatically when Config.AutoDatabase = true; identical to installation/rsg-goldclaim.sql.

Persistence#

  • Rockers, contents, quality and claim names are saved in the database.
  • Processing state and pending outputs live in server memory: they survive a relog but not a resource/server restart.
  • Degradation runs every Config.DegradeInterval minutes; rockers at 0% are removed on the next run.

How-tos#

  • Change language: setr rsg:locale de in server.cfg.
  • Make claims licence-free: give players resource_gold_claim_license via a shop, or set Config.LicenseItem to an item you hand out.
  • Different LEO job: set Config.LeoJobType to the job type (not name).
  • Remove a rocker manually: delete its row from player_goldrockers and restart the resource.

Troubleshooting#

ProblemFix
database setup failed in consoleCheck oxmysql connection, or set AutoDatabase = false and import the SQL
No target options on rockerMake sure rsg-target starts before rsg-goldclaim
Locale keys shown instead of textrsg-core too old (needs shared/locale.lua) or bad rsg:locale value
Can't pack upRepair to 100%, wait for processing to end, collect all outputs
Shovel/bucket says "not in water"Stand in shallow river/lake water

Support the Project : https://rexshack.tebex.store/

<!-- BEGIN AUTO-REFERENCE (generated from the code; re-run the generator instead of editing by hand) -->

Technical reference#

Generated from the source of rsg-goldclaim 3.1.0. Names, arguments and defaults below are read straight from the code.

Dependencies#

rsg-core, rsg-inventory, rsg-target, oxmysql

Database#

Tables: player_goldrockers.

Tables are created automatically on start while Config.AutoDatabase = true (default). Nothing is ever dropped or overwritten. For a manual install set Config.AutoDatabase = false and import installation/rsg-goldclaim.sql once.

-- shared/config.lua
Config.AutoDatabase = true -- false = import the SQL file yourself

Configuration#

OptionDefaultNotes
Config.PlayerProps{}populated at runtime by the server, do not edit
Config.Debugfalse
Config.AutoDatabasetruecreate the database table automatically on start (set false to import installation/rsg-goldclaim.sql manually)
Config.NotifyPosition'top-right'rsg-core notification position: 'top' | 'top-right' | 'top-left' | 'bottom' | 'bottom-right' | 'bottom-left' |
Config.NotifyDuration10000default notification duration (ms)
Config.EnableVegModifiertrueclears vegetation around placed rockers
Config.GoldRockerp_goldcradlestand01xprop used for gold rocker
Config.MaxGoldRockers4maximum gold rockers per character
Config.DegradeChance5% chance (per rocker) of losing 1% quality each cron cycle
Config.DegradeInterval30minutes between degradation rolls
Config.RepairWoodAmount5amount of wood needed to repair
Config.LeoJobType'leo'job type allowed to destroy unlicensed claims
Config.OwnerOnlyProcessingtrueonly the owner can start processing (and receives the output)
Config.LicenseItem'resource_gold_claim_license'consumed on placement to make the claim licensed
Config.InteractDistance5.0max distance from a rocker to interact with it
Config.PickupDistance10.0max distance from a rocker to pick up its output
Config.PlaceMaxDistance6.0max distance between player and placed rocker
Config.MinRockerSpacing4.0min distance between two rockers
Config.PropDrawDistance60.0distance at which rocker props are streamed in
Config.ProcessingTime60000time in ms per processing cycle
Config.GoldChance50% chance of gold vs paydirt return
Config.AddPaydirtTime10000time in ms to add paydirt to rocker
Config.AddWaterTime10000time in ms to add water to rocker
Config.MaxPaydirt5max paydirt units a rocker can hold
Config.MaxWater5max water units a rocker can hold
Config.RepairTime10000time in ms to repair
Config.PackUpTime10000time in ms to pack up
Config.PlaceTime10000time in ms to set up a rocker
Config.DestroyTime10000time in ms for LEO to destroy an illegal claim
Config.PickupTime3000time in ms to pick up an output prop
Config.GoldOreItem'resource_gold_nugget'
Config.GoldOreAmount{ min = 1, max = 5 }
Config.ShovelDigTime10000time in ms to dig paydirt
Config.BucketFillTime8000time in ms to fill bucket
Config.GoldPropp_goldstack01xgold output prop
Config.PaydirtPropmp005_p_dirtpile_sca02_buriedpaydirt output prop
Config.PropSpawnOffset1.5distance to side of rocker to spawn output prop
Config.ShovelProptable
Config.DigDirtPiletabledirt pile spawned in front of the player after a successful dig (cosmetic, local only)
Config.Animstable
Config.ClaimZoneRadius20.0
Config.MaxClaimNameLength50
Config.ClaimBliptable
Config.ForwardDistance2.0

Callbacks#

CallbackSideArgumentsFile
rsg-goldclaim:server:getpropsserver_, cbserver/server.lua
rsg-goldclaim:server:getpendingserversource, cbserver/server.lua
rsg-goldclaim:server:countpropsserversource, cbserver/server.lua
rsg-goldclaim:server:getrockerdataserversource, cb, propidserver/server.lua
-- client side
RSGCore.Functions.TriggerCallback('rsg-goldclaim:server:getprops', function(result)
    -- use result
end)

Events#

Server events can be fired by any client, so every handler re-validates the player, the arguments and any permission, distance or cooldown on the server. Never add a reward to a handler without those checks.

EventSideArgumentsFile
rsg-goldclaim:rocker:client:updatePropDataclient``client/main.lua
RSGCore:Client:OnPlayerLoadedclient``client/main.lua
rsg-goldclaim:rocker:client:removePropObjectclientpropidclient/main.lua
rsg-goldclaim:rocker:client:refreshclaimclientpropid, newnameclient/main.lua
rsg-goldclaim:rocker:client:mainmenuclientpropidclient/main.lua
rsg-goldclaim:rocker:client:checkrockerclientdataclient/main.lua
rsg-goldclaim:rocker:client:addpaydirtclientpropidclient/main.lua
rsg-goldclaim:rocker:client:addwaterclientpropidclient/main.lua
rsg-goldclaim:rocker:client:startprocessingclientdataclient/main.lua
rsg-goldclaim:rocker:client:processingcompleteclient``client/main.lua
rsg-goldclaim:rocker:client:spawnoutputpropclientpropid, resultType, silentclient/main.lua
rsg-goldclaim:rocker:client:goldpickupresultclientamountclient/main.lua
rsg-goldclaim:rocker:client:repairrockerclientdataclient/main.lua
rsg-goldclaim:rocker:client:renameclaimclientdataclient/main.lua
rsg-goldclaim:rocker:client:packuprockerclientdataclient/main.lua
rsg-goldclaim:rocker:client:destroyillegalclientpropidclient/main.lua
rsg-goldclaim:rocker:client:useshovelclient``client/main.lua
rsg-goldclaim:rocker:client:usebucketclient``client/main.lua
rsg-goldclaim:rocker:client:createpropclient``client/placeprop.lua
rsg-goldclaim:rocker:server:digpaydirtserver``server/server.lua
rsg-goldclaim:rocker:server:fillbucketserver``server/server.lua
rsg-goldclaim:rocker:server:newPropserverlocation, headingserver/server.lua
rsg-goldclaim:rocker:server:destroyPropserverpropidserver/server.lua
rsg-goldclaim:rocker:server:leodestroyserverpropidserver/server.lua
rsg-goldclaim:rocker:server:addpaydirtserverpropidserver/server.lua
rsg-goldclaim:rocker:server:addwaterserverpropidserver/server.lua
rsg-goldclaim:rocker:server:processrockerserverpropidserver/server.lua
rsg-goldclaim:rocker:server:pickupgoldserverpropidserver/server.lua
rsg-goldclaim:rocker:server:pickuppaydirtserverpropidserver/server.lua
rsg-goldclaim:rocker:server:repairrockerserverpropidserver/server.lua
rsg-goldclaim:rocker:server:renameclaimserverpropid, newnameserver/server.lua
-- from a client script
TriggerServerEvent('rsg-goldclaim:rocker:server:digpaydirt')
-- from a server script
TriggerClientEvent('rsg-goldclaim:rocker:client:updatePropData', source)

Commands#

CommandNotesFile
/goldclaim_webhooktestserver/webhooks.lua

Useable items#

tool_goldrocker, tool_rocker_shovel, tool_rocker_bucket_empty

Locales#

Language files in locales/: de, el, en, es, fr, ja, nl, pl, pt-br, ro, ru. Set the language with setr rsg:locale "en".

<!-- END AUTO-REFERENCE -->