All resources

rsg-samples — Developer Docs#

Dependencies#

rsg-core, rsg-target, oxmysql, OneSync. No ox_lib (removed in 2.1.1).

Framework usage#

FeatureProvided by
Locales (locale(key, ...))@rsg-core/shared/locale.lua, files in locales/*.json, convar rsg:locale
Client notifyexports['rsg-core']:Notify({ title, description, type, duration })
Server notifyTriggerClientEvent('RSGCore:Client:Notify', src, data) (local notify() helper in server/main.lua)
Leaderboard interactionexports['rsg-target']:addSphereZone (client/target.lua)
Player pedPlayerPedId()
Databaseoxmysql; player_samples table auto-created (Config.AutoInstallDB), manual SQL in install/rsg-samples.sql

Languages#

en, de, el, es, fr, ja, nl, pl, pt-br, ro, ru — add more by copying locales/en.json.

Commands#

  • /samplesmenu — open the samples UI
  • /samplecert — show your certificate
  • /setfeatured <animal> — admin: set/clear the featured animal

Security#

Sample payouts are validated server-side (model, health, distance, duplicate checks) before any reward is paid.

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

Technical reference#

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

Dependencies#

/onesync, oxmysql, rsg-target, rsg-core

Database#

Tables: player_samples.

For a manual install set Config.AutoDatabase = false and import install/rsg-samples.sql once.

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

Configuration#

OptionDefaultNotes
Config.DebugClientfalsePrint client-side debug logs to F8 console
Config.DebugServerfalsePrint server-side debug logs to server console
Config.AutoInstallDBtruecreate the player_samples table automatically on resource start
Config.StoreSampleDatatruefalse = no DB writes; collections kept in memory until restart (testing only)
Config.SampleHoldTime4000ms — how long to hold the prompt to collect
Config.AnimalCleanupTime90000ms — how long before a sedated animal recovers (90s)
Config.SampleCooldown3000ms — server-side minimum gap between a player's sample submissions (anti-spam/exploit)
Config.LeaderboardLocationtable
Config.ShowBliptrue
Config.BlipSprite'blip_shop_trapper'blip sprite name (or hash)
Config.BlipColor'BLIP_MODIFIER_MP_COLOR_8'blip colour modifier ('' = default)
Config.BlipScale0.2
Config.MilestoneRewardstable
Config.FirstDiscoveryBonus500
Config.FeaturedAnimal''e.g. 'bear', 'moose', 'bison' — must match a name in hashToAnimalMap (server/main.lua)
Config.FeaturedMultiplier2reward is multiplied by this when sampling the featured animal

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-samples:client:openSamplesMenuclientdataclient/main.lua
rsg-samples:server:sampleAnimalservernetIdserver/main.lua
rsg-samples:server:requestMenuserver``server/main.lua
-- from a client script
TriggerServerEvent('rsg-samples:server:sampleAnimal', netId)
-- from a server script
TriggerClientEvent('rsg-samples:client:openSamplesMenu', source, data)

Commands#

CommandNotesFile
/samplesmenulocale('cmd_samplesmenu')server/main.lua
/samplecertlocale('cmd_samplecert')server/main.lua
/setfeaturedlocale('cmd_setfeatured')server/main.lua

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