Commands#
Crosshair Creator registers one chat command and one keybind, both for every player. Everything else is done from the panel.
Command / key | Where | Description |
|---|---|---|
| Chat | Opens the panel, or closes it if it is open. Renamed with |
|
Documentation
Crosshair Creator commands, keybinds and client exports: open the panel, read or apply a crosshair from your own FiveM scripts, the crosshair table and share code formats.
Crosshair Creator registers one chat command and one keybind, both for every player. Everything else is done from the panel.
Command / key | Where | Description |
|---|---|---|
| Chat | Opens the panel, or closes it if it is open. Renamed with |
|
Keybind
Same as the command. The default comes from |
Inside the panel:
Key | Does |
|---|---|
| Presets, Build, Draw, Library, Admin. |
| Opens or closes the player's settings. |
| Closes the settings, a dialog or the panel itself. |
The shortcuts are ignored while the player is typing in a text field.
For opening the panel or controlling the reticle from your own scripts — a radial menu entry, a phone app, a shooting range that hands out a training crosshair. All of them are client side.
exports['qs-crosshair']:Open() -- respects OnBeforeOpen; does nothing if already open
exports['qs-crosshair']:Close() -- safe to call when it is already closed
if exports['qs-crosshair']:IsOpen() then
-- the panel is on screen and has focus
endOpen waits briefly for the player's library and the server settings, so call it from a thread or an event handler, not from a tight loop.
local cfg = exports['qs-crosshair']:GetActiveBuild()
-- a copy of the active crosshair, or nil before it has loaded
if cfg then
print(cfg.shape, cfg.primary)
end
local on = exports['qs-crosshair']:IsEnabled()
-- true if the master switch is onThe table returned is a copy: changing it does not change the reticle. Use ApplyBuild for that.
exports['qs-crosshair']:ApplyBuild(cfg, skipPersist)
-- A permanent change: saved as the player's crosshair, kept on reconnect.
exports['qs-crosshair']:ApplyBuild({
shape = 'cross', thickness = 1.5, length = 8, gap = 4,
dot = true, dotSize = 1.5, dotInherit = true,
outline = true, outlineThickness = 1, outlineOpacity = 80, outlineColor = '#050812',
opacity = 100, rotation = 0, primary = '#00ff88',
})
-- A temporary one for an event: shown now, not saved.
-- The player's own crosshair comes back on their next respawn or reconnect.
exports['qs-crosshair']:ApplyBuild(eventCfg, true)It shows on screen immediately and calls OnApply. It does not switch the reticle on if the player turned it off.
What GetActiveBuild returns and ApplyBuild takes. Send a complete table — the easiest way to get one is to design the crosshair in the panel and read it back with GetActiveBuild.
Field | Type | Meaning |
|---|---|---|
| string |
|
| number | Arm thickness, arm length and the gap from the centre, in pixels. |
| string | The main colour, as hex — |
| bool · number · string · bool | The centre dot, its size, its colour, and whether it uses the primary colour instead. |
| bool · number · number · string | The contrast edge. Opacity is 0–100. |
| number | Visibility of the whole reticle, 0–100. |
| number | Degrees. |
| table | Which behaviours are on: |
Two kinds of code exist, and they are not interchangeable:
Format | Where it is used | Lasts |
|---|---|---|
| One build. Copied from Share, pasted into Import Code in the Library. Looked up on the server, so it only works on the server that issued it. | 30 days ( |
| A whole library, or the official crosshair. Exported and imported from the player's settings. Carries everything inside the string, so it works on any server running the script. | Forever |
Server side, Crosshair Creator does not expose exports — it exposes hooks instead. To react to shares or admin changes from another resource, fill
OnShareSentorOnAdminSaveinserver/custom/main.lua. See Hooks.