All resources

rsg-target – Developer Docs#

Technical reference for server owners and developers. For a short overview see README.md.

Contents#

  1. Overview
  2. Files and architecture
  3. Installation and dependencies
  4. Configuration
  5. Controls
  6. Option reference
  7. Exports
  8. Zones
  9. Handler payload
  10. Sub-menus
  11. Events and callbacks
  12. NUI messages
  13. Legacy (qb-target style) exports
  14. Code examples
  15. Security model
  16. Performance notes
  17. Locales
  18. Troubleshooting
  19. Changelog
  20. ox_lib removed

Overview#

rsg-target is the targeting system for the RSG Framework. While the target key is held (or toggled) it raycasts from the camera, finds the entity or zone you are aiming at, filters the registered options (groups, items, distance, canInteract, ...) and shows the remaining ones in a NUI list. It also highlights nearby interactable things with eye icons.

It is a rewrite of ox_target in the RSG resource layout. The resource provides ox_target, so exports.ox_target:* calls from older scripts keep working, and it also exposes the legacy qb-target export names.

Files and architecture#

FilePurpose
fxmanifest.luaResource definition. provide 'ox_target'; client modules are listed under files because they are loaded with require (from @rsg-core/shared/require.lua)
shared/config.luaAll settings (see Configuration)
client/client.luaKey listener, targeting loop, option filtering, NUI callbacks, /targethighlight command
client/api.luaAll exports and the option storage (peds, vehicles, objects, players, models, networked entities, local entities, global options, zones)
client/highlight.luaScans nearby peds/vehicles/objects/zones that have usable options and draws eye markers through the NUI
client/utils.luaZone sprites, item checks, shared filter (passesFilters), cooldown helper, warnings
client/framework.luarsg-core bridge: keeps player data, item counts and held jobs in sync for groups / items / requiresDuty
client/state.luaActive / NUI-focus / disabled flags
client/debug.luarsg-target:client:debug handler and (with Config.Debug) demo zones and global options
client/compat/rsg-target.luaLegacy qb-target style exports (AddBoxZone, AddTargetModel, ...) converted to the current option format
client/compat/ox_target.luaAnswers exports.ox_target:* calls (the resource also provides ox_target)
server/server.luaFlags networked entities that have options, tells clients to drop options for deleted entities, answers the getJobs callback
server/versionchecker.luaCompares version in the manifest with Rexshack-RedM/rsg-versioncheckers on GitHub
html/NUI: index.html, style.css, js/main.js, js/fetchNui.js, assets/*.png
locales/*.json11 languages (en, de, el, es, fr, ja, nl, pl, pt-br, ro, ru)

Targeting loop (client.lua)#

  1. Target key pressed → startTargeting() sets the state active and starts a render thread (Wait(0): zone sprites, eye markers, control blocking, focus handling, quick select).
  2. The main loop runs every 50 ms (aiming at something) or 100 ms: camera raycast (RSGCore.Functions.RaycastCamera), alternating the flag between world (30) and world+entities (-1) when nothing is hit, resolves the entity type/model, finds zones containing the hit point.
  3. When the entity, zones or menu changed it asks api.getTargetOptions to collect option lists (__global, globalTarget, model, entity, localEntity) and every option is run through shouldHide.
  4. If anything changed it sends setTarget to the NUI with the option lists and zone options.
  5. When the key is released, the pause menu or map opens, a progress bar or the inventory opens, or an option is chosen, targeting stops and everything is reset (options:wipe(), menu history, NUI hidden).

Option storage and lookup order#

ListFilled byMatches
__globaladdGlobalOptionany target
globalTargetaddGlobalPed/Vehicle/Object/Playerby entity type (ped = 1, vehicle = 2, object = 3; players use the player list)
modeladdModelby model hash
entityaddEntityby network id
localEntityaddLocalEntityby local handle
zonesaddBoxZone/SphereZone/PolyZonewhen the aimed point is inside the zone

The NUI renders the lists in this order: __global, entity, globalTarget, localEntity, model, then zones. Options are then stably sorted by priority (higher first).

Installation and dependencies#

  • Dependencies: rsg-core (client zones, raycast, nearby scans, progress check, locale/require/table includes). rsg-inventory is not needed directly: item counts come from player data.
  • Start order: ensure rsg-core, then ensure rsg-target, then every resource that registers targets.
  • Stop or remove ox_target; rsg-target replaces it.
  • No database tables are used.
ensure rsg-core
ensure rsg-target
ensure my-resource

Configuration#

shared/config.lua

OptionDefaultDescription
Config.DebugfalseSpawns demo zones next to the player and global options on peds/vehicles/objects; selecting prints the payload
Config.Togglefalsetrue = press the target key to open/close, false = hold
Config.DefaultDistance7.0Interact distance for options without distance
Config.RaycastDistance20.0Camera raycast reach
Config.CleanupInterval10000(ms) server loop that clears deleted networked entities
Config.Keys.Target0x8AAA0AD4Left Alt, hold/toggle targeting
Config.Keys.Focus0x07B8BEAFLeft Mouse, focus the option list
Config.Keys.Close0x53296B75Right Mouse, close while focused
Config.QuickSelect.EnabledtrueQuick select key
Config.QuickSelect.Key0xCEFD9220E (INPUT_CONTEXT)
Config.QuickSelect.Label'E'Text shown on the top option
Config.UI.KeyboardNavtrueArrows / Enter / 1-9 while the menu is focused
Config.UI.GamepadtrueD-pad / A / B while the menu is focused (experimental)
Config.MultiJobtruegroups also matches every job the player holds
Config.DrawSprite24Max zone sprites per frame (0 = off, limit 32). Only used when the highlighter or its zones are off
Config.SpriteColour / Config.SpriteHovergrey / whiteZone sprite colours { r, g, b, a }
Config.Highlight.EnabledtrueDefault for the nearby eye icons (players can override with the command)
Config.Highlight.Command'targethighlight'Player command that toggles the icons, false to remove it
Config.Highlight.Radius10.0Scan radius
Config.Highlight.ScanInterval500(ms) rescan interval
Config.Highlight.MaxDrawn16Max markers (game limit is 32 draws per frame)
Config.Highlight.Peds/Vehicles/Objects/ZonestrueWhich kinds are scanned. Zones replaces the normal zone sprites
Config.Highlight.IncludeGlobalfalseAlso mark things that only have global options (e.g. every ped)
Config.Highlight.RequireLineOfSighttrueOnly mark entities you can see
Config.Highlight.HeightOffset0.15Marker height above the entity
Config.Highlight.Size / Pulse22 / trueEye size (px) and pulse animation
Config.Highlight.Colour / HoverColour#c8c8c8 / #6fbf73Normal and aimed-at (usable) colours

Controls#

InputAction
Hold / press Config.Keys.Target (Left Alt)Start targeting
Aim at a target and press Config.QuickSelect.Key (E)Run the top option without opening the menu
Left MouseFocus the option list (cursor appears)
Click an optionRun it
Up / Down + Enter, or 1-9 (menu focused)Keyboard selection
D-pad up/down + A, B (menu focused)Gamepad selection / close (experimental)
Right Mouse or Esc (menu focused)Close
/targethighlightToggle the nearby eye icons, saved per player (KVP key rsg-target:highlight)

Targeting closes automatically for the pause menu, map, inventory (LocalPlayer.state.invOpen) and progress bars, and will not start while any NUI has focus.

Option reference#

Every add* export takes one option table or an array of them.

FieldTypeNotes
namestringIdentifier. Unique per resource: adding the same name again replaces the old option (a warning is printed) and remove* uses it
labelstring or functionShown in the menu. A function function(entity, distance, coords, name) return 'text' end is re-evaluated while targeting
iconstringFont Awesome class, e.g. fa-solid fa-hand (default)
iconColorstringCSS colour for the icon
distancenumberMax distance from the player to the hit point. Default Config.DefaultDistance. Global options use distance 0
groupsstring / string[] / { [name] = minGrade }Job, gang or citizenid. With Config.MultiJob every held job counts. A hash needs grade >= minGrade
itemsstring / string[] / { [item] = amount }Items the player must carry (all of them, unless anyItem)
anyItembooleanOnly one of items is required
requiresDutybooleanActive job must be onduty
cooldownnumber (ms)After use the option is hidden for this long. Per option, client side
prioritynumberHigher first (default 0). The top option is the quick select target
canInteractfunctionfunction(entity, distance, coords, name) return boolean end, errors count as false
offsetvector3Restrict to a spot on the model (fraction of the bounding box unless absoluteOffset)
absoluteOffsetbooleanTreat offset as an offset in metres from the entity
offsetSizenumberRadius around the offset point (default 1.0)
openMenustringOpens a sub-menu with this name ('home' goes to the top)
menuNamestringOnly visible inside this sub-menu
onSelectfunctionCalled with the payload
exportstringCalls exports[<your resource>][export](nil, payload)
eventstringTriggerEvent(event, payload)
serverEventstringTriggerServerEvent(serverEvent, payload) (entity is sent as a net id)
commandstringExecuteCommand(command)

Action precedence when several are set: onSelect → export → event → serverEvent → command.

The checks run in this order: sub-menu → distance → requiresDuty → cooldown → groups → items → offset → canInteract. groups, items, requiresDuty, cooldown and canInteract are client side visibility checks only (see Security model).

Callbacks run in pcall; if one errors the console shows [rsg-target] option "<name>" (<resource>) failed: <error> and targeting closes normally.

Exports#

Available as exports['rsg-target']:<name>(...) and, through provide, as exports.ox_target:<name>(...). All are client side.

ExportArgumentsReturnsDescription
addBoxZonedatazone idBox zone, see Zones
addSphereZonedatazone idSphere zone
addPolyZonedatazone idPolygon zone
zoneExistsid (number or zone name)boolean
removeZoneid (number or zone name), suppressWarning?Name removal removes every zone with that name
addModelmodel | model[] (hash or name), optionsOptions for every entity with that model
removeModelmodel | model[], names?Without names removes the model completely
addEntitynetId | netId[], optionsNetworked entities. Also flags the entity on the server
removeEntitynetId | netId[], names?
addLocalEntityentity | entity[], optionsLocal handles (peds/objects you spawned)
removeLocalEntityentity | entity[], names?Call it when you delete the entity
addGlobalPed / removeGlobalPedoptions / namesEvery non-player ped
addGlobalVehicle / removeGlobalVehicleVehicles, wagons, boats
addGlobalObject / removeGlobalObjectEvery object
addGlobalPlayer / removeGlobalPlayerOther players
addGlobalOption / removeGlobalOptionShown on every target
disableTargetingbooleantrue closes targeting and blocks it until false
isActivebooleanTargeting currently open
getTargetOptionsentity?, type?, model?tableInternal option lookup (used by the highlighter)

Options are stored per resource: when a resource stops, its options (including global options) and zones are removed automatically (onClientResourceStop). Local entity entries are also cleaned every 60 s if the entity no longer exists.

Zones#

Zones come from @rsg-core/client/zones.lua. Fields used by rsg-target:

FieldApplies toNotes
nameallOptional, lets you removeZone('name')
coordsbox, spherevec3 centre
sizeboxvec3 (x width, y length, z height)
rotationboxheading in degrees
radiussphere
points, thicknesspolypoints is a list of vec3
debugallDraws the zone (a warning is printed)
drawSpriteallfalse hides the sprite / eye marker for this zone
optionsalloption table or array

Check rsg-core's zones.lua for the complete list of zone fields.

Handler payload#

onSelect, export and event receive a table, serverEvent receives the same with entity as a network id (0 when not networked):

FieldDescription
entityEntity handle the player aimed at (0 if none)
coordsWorld position the camera ray hit
distanceDistance from the player to coords
zoneZone id when the option came from a zone
name, label, resource, distance, ...Copy of the option's own plain fields

icon, groups, items, canInteract, onSelect, export, event, serverEvent, command, cooldownEnd and labelFn are removed from the payload. Options added through the legacy qb-target exports (qtarget = true) receive only the entity handle in onSelect.

Give the opening option openMenu = 'name' and the child options menuName = 'name'. A Go back entry (priority 1000, translated with go_back) is added automatically; nested menus keep a history. The menu resets to the top when targeting closes.

exports['rsg-target']:addLocalEntity(npc, {
    { name = 'shop:open',  label = 'Shop', icon = 'fa-solid fa-store', openMenu = 'shop' },
    { name = 'shop:buy',   label = 'Buy',  menuName = 'shop', onSelect = function() end },
    { name = 'shop:sell',  label = 'Sell', menuName = 'shop', onSelect = function() end },
})

Events and callbacks#

NameSideDescription
rsg-target:server:setEntityHasOptions (net event, netId)serverFlags a networked entity (hasTargetOptions state bag) so clients can be told when it is deleted. Validated: positive integer netId, entity exists, within 500 units of the player, max 30 requests / 5 s per player
rsg-target:client:removeEntity (net event, netIds[])clientSent to everyone when flagged entities no longer exist; removes their options
rsg-target:client:debug (event)clientPrints the payload as JSON (with archetype and model for entities). Used by the debug options
rsg-target:server:getJobs (rsg-core callback)serverReturns { [jobName] = grade } from exports['rsg-core']:GetPlayerJobs(source) (wrapped in pcall). Used for multi-job groups
RSGCore:Client:OnPlayerLoaded, OnPlayerUnload, RSGCore:Player:SetPlayerData, RSGCore:Client:OnJobUpdateclientListened to keep player data, items and jobs current
-- await the held jobs yourself (client)
local jobs = RSGCore.Functions.AwaitCallback('rsg-target:server:getJobs', 5000)

NUI messages#

Lua → NUI (SendNuiMessage)

eventPayload
visiblestate boolean, shows/hides the menu
setTargetoptions (lists), zones, quick (label or nil), keyboard, gamepad
leftTargetaimed target lost, eye turns grey
markersmarkers { x, y, a }[] in screen coordinates (a = aimed at), style (sent once)

NUI → Lua (RegisterNUICallback)

CallbackDataDescription
select[listKey, optionId, zoneIndex?]Runs an option. Validated as a table with a numeric id, list must exist
closenoneReleases focus and closes targeting

The NUI follows the RSG house style (Roboto, monochrome leather & gold, no vignette).

Legacy (qb-target style) exports#

Registered on rsg-target for older scripts. Options are converted: job/gang/citizenid → groups (with grades), item → items, action → onSelect, type = 'server'/'command' → serverEvent/command.

ExportNotes
AddBoxZone(name, center, length, width, options, targetoptions)minZ/maxZ are world heights; box is centred between them unless useZ
AddPolyZone(name, points, options, targetoptions)
AddCircleZone(name, center, radius, options, targetoptions)
RemoveZone(id)
AddTargetEntity(entities, options) / RemoveTargetEntity(entities, labels)Networked entities use addEntity, others addLocalEntity
AddTargetModel(models, options) / RemoveTargetModel(models, labels)
AddGlobalPed/Vehicle/Object/Player(options) and Remove...(labels)
AddTargetBone(bones, options)Bones are not supported: options are added to all vehicles and a warning is printed
AddEntityZone, RemoveTargetBoneNot supported (warning only)

Code examples#

Local entity (spawned NPC)#

local ped = CreatePed(model, coords.x, coords.y, coords.z, heading, false, false)

exports['rsg-target']:addLocalEntity(ped, {
    {
        name = 'trader:talk',
        icon = 'fa-solid fa-comments',
        label = locale('talk'),
        distance = 2.0,
        onSelect = function(data)
            TriggerEvent('my-resource:client:talk', data.entity)
        end,
    },
})

AddEventHandler('onResourceStop', function(resource)
    if resource ~= GetCurrentResourceName() then return end
    exports['rsg-target']:removeLocalEntity(ped)
    DeleteEntity(ped)
end)

Zone with job, duty and items#

local zone = exports['rsg-target']:addSphereZone({
    name = 'sheriff:armory',
    coords = Config.ArmoryCoords,
    radius = 1.5,
    options = {
        {
            name = 'sheriff:armory:open',
            icon = 'fa-solid fa-gun',
            label = locale('open_armory'),
            distance = 2.0,
            groups = { sheriff = 1, deputy = 0 }, -- sheriff grade 1+, or any deputy
            requiresDuty = true,
            items = 'badge',
            serverEvent = 'sheriff:server:openArmory',
        },
    },
})

Dynamic label, cooldown and priority#

exports['rsg-target']:addModel('p_chair01x', {
    {
        name = 'chair:sit',
        icon = 'fa-solid fa-chair',
        priority = 10,           -- shown first and used by quick select
        cooldown = 3000,         -- hidden for 3 s after use
        label = function(entity, distance)
            return ('%s (%.1fm)'):format(locale('sit'), distance)
        end,
        onSelect = function(data) TriggerEvent('my-resource:client:sit', data.entity) end,
    },
})

Server event (validate on the server!)#

-- client option
{ name = 'shop:buy', label = locale('buy'), serverEvent = 'my-resource:server:buy' }

-- server
RegisterNetEvent('my-resource:server:buy', function(data)
    local src = source
    local Player = RSGCore.Functions.GetPlayer(src)
    if not Player then return end

    -- never trust data.entity / data.coords / data.distance: re-check distance, job and items here
    local ped = GetPlayerPed(src)
    if #(GetEntityCoords(ped) - Config.ShopCoords) > 3.0 then return end
    if Player.PlayerData.job.name ~= 'trader' then return end

    -- ... then do the purchase with server-side prices
end)

Global options and cleanup#

exports['rsg-target']:addGlobalPlayer({
    { name = 'player:give', icon = 'fa-solid fa-hand-holding', label = locale('give'), distance = 2.0,
      onSelect = function(data) TriggerEvent('my-resource:client:give', data.entity) end },
})
-- removed automatically when your resource stops; manual removal:
exports['rsg-target']:removeGlobalPlayer('player:give')

Temporarily disable targeting#

exports['rsg-target']:disableTargeting(true)   -- e.g. during a cutscene
-- ...
exports['rsg-target']:disableTargeting(false)

if exports['rsg-target']:isActive() then end

Entity restricted to a part of the model#

exports['rsg-target']:addModel('p_door01x', {
    { name = 'door:knock', label = locale('knock'), offset = vec3(0.5, 0.0, 0.5), offsetSize = 0.6,
      onSelect = function() end },
})

See Sub-menus.

Update the label without re-registering#

label as a function is the supported way: the text is recomputed whenever the target is re-evaluated, no re-adding needed.

Security model#

  • groups, items, requiresDuty, cooldown, distance, offset and canInteract only decide what the client shows. A modified client can call your serverEvent directly.
  • Every serverEvent handler must resolve the player with RSGCore.Functions.GetPlayer(source), re-check job/grade, items, cooldowns and distance on the server, and use server-side prices and rewards. The payload (entity netId, coords, distance) is client supplied.
  • rsg-target itself only has one client-to-server event, rsg-target:server:setEntityHasOptions. It cannot give items or money and is rate limited and distance checked.
  • NUI callbacks (select, close) only act on options already registered in the local client; invalid input is ignored.
  • Labels are inserted with textContent in the NUI (no HTML injection).

Performance notes#

  • Idle cost is one Wait(0) thread polling the target key.
  • While targeting: one raycast (two when nothing is hit) every 50-100 ms, zone checks against every registered zone each loop, one NUI message only when the options changed.
  • The highlighter rescans every ScanInterval ms (line-of-sight raycasts only for usable entities) and only sends NUI updates when a marker moved.
  • Reduce load by lowering Config.Highlight.Radius/MaxDrawn, turning off Peds/Objects, and keeping IncludeGlobal = false.
  • Prefer addModel/addLocalEntity/zones over many addGlobal* options.

Locales#

locales/*.json, loaded by rsg-core (locale('key')). All 11 languages carry the same keys.

KeyUsed for
go_backSub-menu back entry
notify_title, highlight_on, highlight_off/targethighlight notification
debug_box, debug_sphere, debug_ped, debug_vehicle, debug_objectDebug options (Config.Debug)

Set the language with the rsg:locale convar, e.g. setr rsg:locale de.

Troubleshooting#

ProblemCause / fix
Nothing happens on Left AltCheck the resource started after rsg-core, no NUI has focus, and the console for client errors
Scripts using exports.ox_target failMake sure the real ox_target is stopped/removed and rsg-target is started before them
Option never showsDistance too small, groups/items/requiresDuty fail, option on cooldown, or canInteract returns false/errors. Turn on Config.Debug to test
Job option hidden for a second jobNeeds Config.MultiJob = true and rsg-core GetPlayerJobs; the list refreshes on load / job change
Quick select does nothingAnother script consumes E, or no option is visible. Change Config.QuickSelect.Key
Eye icons missing/targethighlight toggled off, Config.Highlight.Enabled = false, entity has only global options (IncludeGlobal), or no line of sight
Options stay after a script restartsThey are removed on onClientResourceStop; make sure the script re-adds them on start
[rsg-target] option ... failedThe callback of that option errored; fix it in the named resource
Console warning "Replacing existing target option"Same name added twice by one resource; harmless, the latter wins
Version check failsThe server cannot reach GitHub or rsg-versioncheckers has no entry for this resource

Changelog#

3.1.0#

  • Multi job groups: options now also match jobs the player holds but is not currently using (Config.MultiJob).
  • New option fields: requiresDuty, cooldown, priority, and label as a function.
  • Quick select key (default E) runs the top option without focusing; the NUI shows the key on that option.
  • Menu navigation: keyboard (arrows, Enter, 1-9) and experimental gamepad (D-pad, A, B) while focused.
  • Highlighter toggle: /targethighlight, saved per player.
  • New locale keys notify_title, highlight_on, highlight_off in all 11 languages.

3.0.2#

  • Fixed a syntax error in client/client.lua (\~=) that stopped the whole client script loading.
  • Fixed global options (addGlobalOption) from a stopped resource staying registered.
  • Fixed a broken onSelect / event / export in another resource leaving targeting stuck open; actions run in pcall.
  • Fixed the NUI select callback erroring when handed a non-table option list.
  • Security rsg-target:server:setEntityHasOptions is rate limited (30 per 5 s per player) and requires the entity to be within 500 units of the player.
  • Optimised highlighter only sends marker updates when a marker moved; server cleanup loop skips work while nothing is tracked.
  • Cleaned blocked controls are one table + loop; removed the exportHandler wrapper, unused variables and the escapeHtml helper.
  • UX option list scrolls (max 60% screen height); debug zones spawn next to the player.

3.0.1#

  • Fixed legacy exports dropping jobs/gangs/citizenids and keeping job grades; legacy AddBoxZone height/centre; sub-menu state reset on close; Esc closes the focused menu; removeTarget repeated-name bug; zone sprite limit off-by-one; netId validation on the server.

ox_lib removed#

  • Zones: @rsg-core/client/zones.lua. Raycast: RSGCore.Functions.RaycastCamera. Nearby scans: RSGCore.Functions.GetNearby*. Progress check: RSGCore.Functions.IsProgressActive.
  • Locales, require and table helpers come from the @rsg-core/shared/*.lua includes.
  • The context-menu close check was removed (rsg-core has no context menu). Targeting still closes for the inventory and progress bars, and won't open while any NUI has focus.

Support: 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-target 3.1.0. Names, arguments and defaults below are read straight from the code.

Dependencies#

rsg-core

Configuration#

OptionDefaultNotes
Config.Debugfalsespawns debug zones/options (see client/debug.lua)
Config.Togglefalsetrue: press key to open/close | false: hold key
Config.DefaultDistance7.0default interact distance when an option has none
Config.RaycastDistance20.0how far the camera raycast reaches
Config.CleanupInterval10000(ms) server cleanup of deleted networked entities
Config.Keystable
Config.Target0x8AAA0AD4
Config.Focus0x07B8BEAF
Config.Close0x53296B75
Config.QuickSelecttable
Config.Enabledtrue
Config.Key0xCEFD9220
Config.Label'E'
Config.UItable
Config.KeyboardNavtrue
Config.Gamepadtrue
Config.MultiJobtrue
Config.DrawSprite24max zone sprites drawn per frame (0 = disabled, limit 32)
Config.SpriteColour{ 155, 155, 155, 175 }r, g, b, a
Config.SpriteHover{ 255, 255, 255, 255 }r, g, b, a when looking at zone
Config.Highlighttable
Config.Command'targethighlight'
Config.Radius10.0
Config.ScanInterval500
Config.MaxDrawn16
Config.Pedstrue
Config.Vehiclestrue
Config.Objectstrue
Config.Zonestrue
Config.IncludeGlobalfalse
Config.RequireLineOfSighttrue
Config.HeightOffset0.15
Config.Size22
Config.Pulsetrue
Config.Colour'#c8c8c8'
Config.HoverColour'#6fbf73'

Exports#

Client

ExportArgumentsFile
AddBoxZonename, center, length, width, options, targetoptionsclient/compat/rsg-target.lua
AddPolyZonename, points, options, targetoptionsclient/compat/rsg-target.lua
AddCircleZonename, center, radius, options, targetoptionsclient/compat/rsg-target.lua
RemoveZoneidclient/compat/rsg-target.lua
AddTargetBone_, optionsclient/compat/rsg-target.lua
AddTargetEntityentities, optionsclient/compat/rsg-target.lua
RemoveTargetEntityentities, labelsclient/compat/rsg-target.lua
AddTargetModelmodels, optionsclient/compat/rsg-target.lua
RemoveTargetModelmodels, labelsclient/compat/rsg-target.lua
AddGlobalPedoptionsclient/compat/rsg-target.lua
RemoveGlobalPedlabelsclient/compat/rsg-target.lua
AddGlobalVehicleoptionsclient/compat/rsg-target.lua
RemoveGlobalVehiclelabelsclient/compat/rsg-target.lua
AddGlobalObjectoptionsclient/compat/rsg-target.lua
RemoveGlobalObjectlabelsclient/compat/rsg-target.lua
AddGlobalPlayeroptionsclient/compat/rsg-target.lua
RemoveGlobalPlayerlabelsclient/compat/rsg-target.lua
AddEntityZone``client/compat/rsg-target.lua
RemoveTargetBone``client/compat/rsg-target.lua
-- example
local result = exports['rsg-target']:AddBoxZone(name, center, length, width, options, targetoptions)

Callbacks#

CallbackSideArgumentsFile
rsg-target:server:getJobsserversource, cbserver/server.lua
-- client side
RSGCore.Functions.TriggerCallback('rsg-target:server:getJobs', 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-target:client:removeEntityclientarrclient/api.lua
RSGCore:Client:OnPlayerLoadedclient``client/framework.lua
RSGCore:Client:OnPlayerUnloadclient``client/framework.lua
RSGCore:Client:OnJobUpdateclient``client/framework.lua
RSGCore:Player:SetPlayerDataclientvalclient/framework.lua
rsg-target:server:setEntityHasOptionsservernetIdserver/server.lua
-- from a client script
TriggerServerEvent('rsg-target:server:setEntityHasOptions', netId)
-- from a server script
TriggerClientEvent('rsg-target:client:removeEntity', source, arr)

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