All resources

rsg-lawman — Developer Docs#

ox_lib migration status (v3.1.0) — fully migrated, no ox_lib dependency#

FeatureNow usesStatus
Locales@rsg-core/shared/locale.lua + locale()migrated
Client notifyRSGCore.Functions.Notify(data)migrated
Server notifyTriggerClientEvent('RSGCore:Client:Notify', src, data)migrated
cache.pedPlayerPedId()migrated
Law office menubuilt-in NUI (html/) via openUI({ action = 'openMenu', ... })migrated
Jail time inputbuilt-in NUI via inputDialog(title, label) (blocking, returns positive integer or nil)migrated

NUI#

  • html/index.html, style.css, script.js — menu panel and numeric input modal in the house RDR2 style.
  • NUI messages: openMenu { title, subtitle, options[{id,title,description,icon,disabled}] }, openInput { title, label, confirm, cancel }, close.
  • NUI callbacks: menuSelect { id }, inputSubmit { value|null }, close. Menu actions run client-side from a local action table, so the NUI can't trigger arbitrary events. Jail time is still validated by the server.
  • Esc closes, Enter confirms the input. Input accepts digits only.
  • Focus goes through applyNuiFocus(), and push-to-talk stays usable (Config.AllowPushToTalkWhileOpen, Config.PushToTalkControls).

Events#

  • rsg-lawman:client:lawmanAlert (coords, text) — map alert blip for on-duty leo job types.

  • rsg-lawman:client:getescorted (draggerSrc) — attach/detach escorted player.

  • rsg-lawman:server:lawmanAlert (text, coords) — sends an alert to on-duty leo players. Server-side: text must be a string (cut to 150 chars), at most one alert per player every 4s, and the position falls back to the sender's server-side position if missing or more than 250 units away.

Commands#

/testalert, /searchplayer, /lawbadge, /jail <id> <time>, /unjail <id>, /cuff, /escort.

Locales#

Keys live in locales/*.json. Required languages: en, de, el, es, fr, ja, nl, pl, pt-br, ro, ru. jail_player_header takes the player id (%s).

Changelog#

  • 3.1.0 — Replaced the ox_lib context menu and input dialog with built-in NUI; removed ox_lib entirely; added push-to-talk config; added cl_confirm/cl_cancel locale keys.
  • 3.0.2 — Migrated locales, notifications and cache.ped to rsg-core; fixed server-side lib.notify call in escort (now notifies the officer); fixed malformed alert blip text; added ja, nl, ro locales and missing jail-dialog keys.
<!-- BEGIN AUTO-REFERENCE (generated from the code; re-run the generator instead of editing by hand) -->

Technical reference#

Reputation (3.2.0): Config.Reputation = { Enabled, Action = 'arrest', MinMinutes, Cooldown }. jailPlayerByPlayer calls exports['rsg-reputation']:ApplyAction(lawmanSrc, Action) after a validated jail (LEO job check, min minutes, per-lawman/target cooldown, skipped if rsg-reputation is not started).

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

Dependencies#

rsg-core

Configuration#

OptionDefaultNotes
Config.Debugfalsedebug
Config.AddGPSRoutetruesettings
Config.AlertTimer60
Config.Keybind'J'
Config.StorageMaxWeight4000000
Config.StorageMaxSlots50
Config.TrashCollection1mins
Config.ArmouryAccessGrade1and greater than
Config.SearchTime10000
Config.SearchDistance2.5
Config.EnablePlayerDeathAlertsfalse
Config.EnableNPCDeathAlertsfalse
Config.AlertCooldown30000
Config.AlertDistance100.0
Config.LawOfficeLocations``Law Office Prompt Locations
Config.LawJobstable
Config.AllowPushToTalkWhileOpentrueWhile NUI is open, block game controls but allow push-to-talk.
Config.PushToTalkControlstable

Callbacks#

CallbackSideArgumentsFile
rsg-lawman:server:getlawserversource, cbserver/server.lua
-- client side
RSGCore.Functions.TriggerCallback('rsg-lawman:server:getlaw', 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-lawman:client:mainmenuclientjobaccess, nameclient/client.lua
rsg-lawman:client:openarmouryclient``client/client.lua
rsg-lawman:client:jailplayerclientplayerId, timeclient/client.lua
rsg-lawman:client:sendtojailclienttimeclient/client.lua
rsg-lawman:client:lawmanAlertclientcoords, textclient/client.lua
rsg-lawman:client:cuffplayerclient``client/client.lua
rsg-lawman:client:getcuffedclientplayerId, isSoftcuffclient/client.lua
rsg-lawman:client:escortplayerclient``client/client.lua
rsg-lawman:client:getescortedclientplayerIdclient/client.lua
rsg-lawman:client:lawbadgeclient``client/client.lua
rsg-lawman:client:searchplayerclient``client/client.lua
rsg-lawman:client:openstorageclient``client/client.lua
rsg-lawman:server:SearchPlayerserver``server/server.lua
rsg-lawman:server:lawmanAlertservertext, coordsserver/server.lua
rsg-lawman:server:jailplayerserverplayerId, minutesserver/server.lua
rsg-lawman:server:cuffplayerserverplayerId, isSoftcuffserver/server.lua
rsg-lawman:server:sethandcuffstatusserverisHandcuffedserver/server.lua
rsg-lawman:server:setescortstatusserverisEscortedserver/server.lua
rsg-lawman:server:escortplayerserverplayerIdserver/server.lua
rsg-lawman:server:storageserverjobnameserver/server.lua
rsg-lawman:server:updateoutlawstatusserveramount, reasonserver/server.lua
-- from a client script
TriggerServerEvent('rsg-lawman:server:SearchPlayer')
-- from a server script
TriggerClientEvent('rsg-lawman:client:mainmenu', source, jobaccess, name)

Commands#

CommandNotesFile
/testalertlocale('sv_test')server/server.lua
/searchplayerlocale('sv_searchplayer')server/server.lua
/lawbadgelocale('sv_lawbadge')server/server.lua
/unjaillocale('sv_unjail')server/server.lua
/jaillocale('sv_jail')server/server.lua
/cufflocale('sv_cuff')server/server.lua
/escortlocale('sv_escort')server/server.lua

Useable items#

handcuffs

Locales#

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

<!-- END AUTO-REFERENCE -->