All resources

rsg-goldpanning — Developer & Server Owner Docs#

Version 3.2.0

Contents#

  1. Architecture
  2. Pan flow
  3. Events
  4. Security model
  5. Configuration
  6. Webhooks & logs
  7. Persistence
  8. How-tos
  9. Troubleshooting

1. Architecture#

FileSidePurpose
shared/config.luasharedPan item, timings, rewards, anti-farm rules, allowed water zones
client/client.luaclientWater/foot checks, prop, animations, progress bar
server/sv_config.luaserverWebhook URLs and colours (never sent to clients)
server/webhook.luaserverSendGoldPanRewardWebhook, SendGoldPanExploitWebhook globals
server/server.luaserverUseable item, sessions, validation, rewards
server/versionchecker.luaserverGitHub version check on start

No ox_lib: locales come from @rsg-core/shared/locale.lua, notifications from RSGCore:Client:Notify, progress from RSGCore.Functions.ProgressBar.

2. Pan flow#

  1. Player uses Config.PanItem → server checks for an active session and the cooldown → rsg-goldpanning:client:tryPan.
  2. Client checks on foot, not mounted/swimming, and in a water zone listed in Config.WaterTypes (_GET_WATER_MAP_ZONE_AT_COORDS, 0x5BA7A68A346A5A91) → rsg-goldpanning:server:startPan.
  3. Server re-checks the pan item, cooldown and spot memory, picks a random duration (Config.PanTime.min–max), stores the session and position → rsg-goldpanning:client:beginPan(duration).
  4. Client attaches P_CS_MININGPAN01X, plays the scoop then shake animation, runs the progress bar (inv_busy set while panning).
  5. On finish → rsg-goldpanning:server:claimPan; on cancel → rsg-goldpanning:server:cancelPan.

3. Events#

EventDirectionArgs
rsg-goldpanning:client:tryPanserver → client—
rsg-goldpanning:client:beginPanserver → clientduration (ms)
rsg-goldpanning:server:startPanclient → server—
rsg-goldpanning:server:claimPanclient → server—
rsg-goldpanning:server:cancelPanclient → server—

No exports or callbacks.

4. Security model#

The client sends no data; the server decides everything.

  • Claims need a server session, consumed on first use (no replays).
  • Elapsed time must be within duration −1 s / +10 s.
  • Player must not drift more than Config.MaxDriftDistance from the start spot.
  • Spot memory (MinMovementDistance / SpotMemoryTime) is set on every claim, successful or not.
  • Pan item is re-checked at start and at claim; CanAddItem before AddItem.
  • Sessions older than duration + 10 s are dropped automatically.
  • Exploit flags are throttled to one per player per 10 s so webhook spam isn't possible.
  • Limitation: water type can only be read client-side. A cheater can start a pan outside water, but still has to wait the full timer, stand still, and move between spots, so it gives no speed advantage.

5. Configuration#

OptionDefaultDescription
Config.PanItemtool_goldpanUseable item
Config.Cooldown10Seconds between pan starts
Config.PanTimecrouch 6000, min 18000, max 34000ms
Config.RewardItems{ 'resource_gold_nugget' }One is picked at random
Config.GoldChance65% chance to find anything
Config.RewardTiers50/30/20 → 1/2/3Must total 100 (warning printed if not)
Config.MinMovementDistance1.5m from last spot
Config.SpotMemoryTime300000ms a spot stays panned out
Config.MaxDriftDistance3.0m allowed during a pan
Config.WaterTypes17 zones{ name, waterhash }
Config.Webhooks / Config.WebhookColorssee server/sv_config.luaDiscord

6. Webhooks & logs#

  • rsg-log:server:CreateLog with category goldpanning on every find.
  • SendGoldPanRewardWebhook(tier, playerName, charName, citizenid, itemLabel, amount, coords)
  • SendGoldPanExploitWebhook(reason, playerName, src, details)

7. Persistence#

Nothing is saved. Sessions, cooldowns and spot memory are in memory and cleared on playerDropped or restart. No database.

8. How-tos#

  • Add a river: add { name = 'My Creek', waterhash = <hash> } to Config.WaterTypes.
  • Add a reward: make sure the item is in rsg-core/shared/items.lua, then add it to Config.RewardItems. Missing items are reported in the console on start.
  • Change language: setr rsg:locale de in server.cfg.

9. Troubleshooting#

ProblemFix
"You need to be standing in a river" in a real riverZone not in Config.WaterTypes
Reward item error in consoleAdd the item to rsg-core shared items
Timing anomaly flags for normal playersServer hitching; raise CLAIM_LATE_TOLERANCE in server/server.lua
No webhooksSet Config.Webhooks.enabled and the URLs in server/sv_config.lua

rsg-skills integration#

Config.Skills = { Enabled, Skill, FindXP }. After the server has paid out a find in the pan event, it calls AddXP(src, 'mining', FindXP, 'gold panning'). Change Skill to use another skill key. Skipped when rsg-skills is not started.

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-goldpanning 3.2.0. Names, arguments and defaults below are read straight from the code.

Dependencies#

rsg-core, rsg-inventory

Configuration#

OptionDefaultNotes
Config.PanItem'tool_goldpan'useable item that starts panning (must match rsg-core/shared/items.lua)
Config.Cooldown10seconds between pans (counted from the start of a pan)
Config.PanTimetable
Config.RewardItemstable
Config.GoldChance65% chance to find anything at all
Config.RewardTierstabletiers are rolled after a successful find; chances should add up to 100
Config.MinMovementDistance1.5metres a player must move from their last pan spot
Config.SpotMemoryTime300000ms before a used spot can be panned again (5 minutes)
Config.MaxDriftDistance3.0max metres the player may move during a pan before the claim is rejected
Config.WaterTypestable
Config.Skillstablersg-skills integration (optional). Needs the rsg-skills resource; does nothing when it is not started.
Config.Enabledtrue
Config.Skill'mining'
Config.FindXP5

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-goldpanning:client:tryPanclient``client/client.lua
rsg-goldpanning:client:beginPanclientdurationclient/client.lua
rsg-goldpanning:server:startPanserver``server/server.lua
rsg-goldpanning:server:cancelPanserver``server/server.lua
rsg-goldpanning:server:claimPanserver``server/server.lua
-- from a client script
TriggerServerEvent('rsg-goldpanning:server:startPan')
-- from a server script
TriggerClientEvent('rsg-goldpanning:client:tryPan', source)

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 -->