Scooby API Reference — FiveM
Documentation
Reference for the Scooby executor surface and the CitizenFX scripting helpers the in-game console exposes. Each entry shows the signature, a short description, and a runnable Lua/JavaScript example.
Scooby Executor
ScoobyShowDui(url, w, h)
Spawn a DUI surface at the given URL. Returns a duiId for the other Scooby* DUI helpers.
Example
local dui = ScoobyShowDui('https://example.com', 1280, 720)
ScoobyHideDui(duiId)
Hide a DUI surface. Keeps it alive — use ScoobyDestroyDui to free.
Example
ScoobyHideDui(dui)
ScoobyShowDuiAgain(duiId)
Re-show a previously hidden DUI surface.
Example
ScoobyShowDuiAgain(dui)
ScoobyDestroyDui(duiId)
Tear down a DUI surface and free its resources.
Example
ScoobyDestroyDui(dui)
ScoobySetDuiUrl(duiId, url)
Navigate the DUI to a new URL.
Example
ScoobySetDuiUrl(dui, 'https://new.url/')
ScoobyExecuteDuiScript(duiId, jsSource)
Run arbitrary JavaScript inside the DUI surface.
Example
ScoobyExecuteDuiScript(dui, 'document.body.style.background="red"')
ScoobyReloadDui(duiId)
Reload the DUI surface's current page.
Example
ScoobyReloadDui(dui)
ScoobySendDuiMessage(duiId, msgTable)
postMessage into the DUI's window.
Example
ScoobySendDuiMessage(dui, { action = 'show' })
ScoobyNotify(title, body, type)
Push a toast through Scooby's notification system. type ∈ Info / Success / Warning / Error.
Example
ScoobyNotify('My Script', 'Hello!', 'Info')
ScoobyLog(line)
Write a line to the Scooby Lua console.
Example
ScoobyLog('Hello from script')
ScoobyGetVersion()
Returns the menu version string.
Example
ScoobyGetVersion()
ScoobyIsKeyDown(vkCode)
Polled keyboard state. Use VK_* codes (0x70 = F1).
Example
if ScoobyIsKeyDown(0x74) then end -- F5
ScoobyOpenMenu()
Force the Scooby menu open from script.
Example
ScoobyOpenMenu()
ScoobyCloseMenu()
Force the Scooby menu closed from script.
Example
ScoobyCloseMenu()
ScoobyToggleMenu()
Toggle the Scooby menu.
Example
ScoobyToggleMenu()
ScoobyIsMenuOpen()
true while the Scooby menu is open.
Example
ScoobyIsMenuOpen()
ScoobyExecuteCode(luaSource)
Run another Lua snippet through the exec pipeline.
Example
ScoobyExecuteCode([[ print('nested') ]])
ScoobyStopResource(name)
Stops a target resource by name (same path as the Uninject button).
Example
ScoobyStopResource('targetResource')
ScoobyInjectInto(name, luaSource)
Run code inside an existing resource's lua_State (true injection, not masquerade).
Example
ScoobyInjectInto('targetResource', [[ print(GetCurrentResourceName()) ]])
ScoobyGetResources()
Table of every currently-running resource name.
Example
for _,n in ipairs(ScoobyGetResources()) do print(n) end
ScoobyHttpGet(url, headers)
Blocking HTTP GET. Returns body string; nil on failure.
Example
local body = ScoobyHttpGet('https://api.example.com/data')
ScoobyHttpPost(url, body, headers)
Blocking HTTP POST.
Example
ScoobyHttpPost('https://api.example.com', '{}', { ['Content-Type'] = 'application/json' })
ScoobyReadFile(path)
Read a file from disk (sandboxed to C:\scooby\fivem\lua\).
Example
local s = ScoobyReadFile('mydata.json')
ScoobyWriteFile(path, content)
Write a file (sandboxed).
Example
ScoobyWriteFile('mydata.json', s)
ScoobyFileExists(path)
Returns true if the sandboxed file exists.
Example
ScoobyFileExists('mydata.json')
ScoobyShowImage(path, x, y, w, h)
Render a PNG/JPG overlay. Returns an imgId.
Example
local img = ScoobyShowImage('logo.png', 100, 100, 256, 256)
ScoobyHideImage(imgId)
Hide a previously-shown image overlay.
Example
ScoobyHideImage(img)
ScoobyDrawText(text, x, y, size, color)
One-frame text draw. Call every tick to keep on-screen.
Example
ScoobyDrawText('Hello', 200, 200, 16, 0xFFFFFFFF)
ScoobyDrawRect(x, y, w, h, color, filled)
One-frame rectangle.
Example
ScoobyDrawRect(100,100,200,80,0x80FF0000,true)
ScoobyDrawLine(x1, y1, x2, y2, color, thick)
One-frame line.
Example
ScoobyDrawLine(0,0,400,400,0xFFFFFFFF,1.5)
ScoobyDrawCircle(x, y, r, color, segments)
One-frame circle (filled).
Example
ScoobyDrawCircle(300,300,50,0x8000FF00,32)
ScoobyGetScreenSize()
Returns w, h of the current backbuffer.
Example
local w, h = ScoobyGetScreenSize()
ScoobyWorldToScreen(x, y, z)
Returns sx, sy or nil if off-screen.
Example
local sx, sy = ScoobyWorldToScreen(0.0, 0.0, 0.0)
ScoobyGetFps()
Current frames-per-second (smoothed).
Example
ScoobyGetFps()
ScoobyTimeMs()
Monotonic millisecond timestamp.
Example
ScoobyTimeMs()
ScoobyRandom(min, max)
Uniform random integer in [min, max].
Example
ScoobyRandom(1, 100)
ScoobyHash(str)
joaat hash of the input.
Example
ScoobyHash('weapon_pistol')
ScoobyOnTick(fn)
Per-frame callback. Returns a handle for ScoobyOffTick.
Example
local t = ScoobyOnTick(function(dt) end)
ScoobyOffTick(handle)
Detach a tick callback.
Example
ScoobyOffTick(t)
ScoobyOnKey(vk, fn)
Edge-triggered key callback.
Example
ScoobyOnKey(0x74, function() ScoobyNotify('F5','pressed') end)
ScoobyDrawTextOutlined(text, x, y, size, color, outlineColor)
One-frame text with a 1px outline for readability over busy backgrounds. Call every tick.
Example
ScoobyDrawTextOutlined('HP', 200, 200, 16, 0xFFFFFFFF, 0xFF000000)
ScoobyDrawRectGradient(x, y, w, h, colTop, colBottom)
One-frame vertical-gradient rectangle.
Example
ScoobyDrawRectGradient(0,0,200,40,0xFF00D4FF,0x000E1016)
ScoobyMeasureText(text, size) -> (w, h)
Pixel size of a string at the given font size. Free function alias of Scooby.UI.MeasureText.
Example
local w, h = ScoobyMeasureText('Hello', 16)
ScoobyIsAvailable() -> boolean
true once the Scooby script API runtime has finished registering its handlers. Use to gate paste-compatible scripts before calling Scooby.* helpers.
Example
if ScoobyIsAvailable() then ScoobyNotify('hi','ready','Info') end
Scooby.UI.MeasureText(text, size) -> px
Pixel width of a string at the given ImGui font size. Returns 0 if no frame has been drawn yet.
Example
local w = Scooby.UI.MeasureText('Hello', 14)
User & Session
Scooby.User.GetId()
Numeric account id of the signed-in user.
Example
local uid = Scooby.User.GetId()
Scooby.User.GetName()
Display name of the signed-in user.
Example
local name = Scooby.User.GetName()
Scooby.User.GetSubscription()
Subscription tier string (e.g. 'lifetime' / 'monthly' / nil).
Example
local tier = Scooby.User.GetSubscription() or 'N/A'
Scooby.User.GetDiscordAccount(type)
Linked Discord id. type ∈ Account (loader-linked) / Game (currently launched).
Example
local d = Scooby.User.GetDiscordAccount('Account')
Scooby.User.GetDefaultLanguage()
ISO 639-1 language string the user picked in the loader.
Example
local lang = Scooby.User.GetDefaultLanguage()
Scooby.Server.GetName()
Current FiveM/RedM server name.
Example
local s = Scooby.Server.GetName()
Scooby.Server.GetCode()
cfx.re join code (e.g. 'xz3vrk').
Example
local c = Scooby.Server.GetCode()
Scooby.Server.GetPlayerCount()
Current player count reported by the server.
Example
local n = Scooby.Server.GetPlayerCount()
Scooby.Client.GetCurrentBranch()
Game client branch / build number string.
Example
local b = Scooby.Client.GetCurrentBranch()
Scooby.Client.AreEventsEnabled()
true when client-side CitizenFX events are flowing (off during disconnect).
Example
if Scooby.Client.AreEventsEnabled() then end
Scooby.System.GetClipboard()
Returns the Windows clipboard as UTF-8 text.
Example
local txt = Scooby.System.GetClipboard()
Scooby.System.SetClipboard(text)
Write a UTF-8 string into the Windows clipboard.
Example
Scooby.System.SetClipboard('hello')
Scooby.System.OpenUrl(url)
Open a URL in the default browser.
Example
Scooby.System.OpenUrl('https://example.com')
Scooby.Input.IsKeyPressed(vk)
Polled keyboard state (level, not edge). Mirrors GetAsyncKeyState.
Example
if Scooby.Input.IsKeyPressed(0x74) then end
Scooby.Input.SetControlMode(mode)
Globally gate input. mode ∈ Keyboard / Mouse / Both / Disabled.
Example
Scooby.Input.SetControlMode('Disabled')
Scooby.UI.LoadFontFromData(bytes, size, ...)
Load a TTF/OTF blob into the menu's font atlas. Returns a font handle.
Example
local f = Scooby.UI.LoadFontFromData(bytes, 16)
Scooby.UI.LoadImageFromData(bytes)
Decode a PNG/JPG blob and return an imageId.
Example
local img = Scooby.UI.LoadImageFromData(pngBytes)
Memory
Scooby.Memory.ResolveExport(dll, symbol) -> addr
Returns the address of an exported symbol in a loaded DLL (GetModuleHandleA + GetProcAddress). Returns 0 if the module isn't loaded or the symbol is missing.
Example
local addr = Scooby.Memory.ResolveExport('kernel32.dll', 'GetTickCount')
Camera
Scooby.Camera.Lock(on)
Pin the camera to a script-owned transform. Pass false to release.
Example
Scooby.Camera.Lock(true)
Scooby.Camera.SetPos(x, y, z)
Set the locked camera's world position. Only takes effect while Scooby.Camera.Lock is on.
Example
Scooby.Camera.SetPos(0.0, 0.0, 100.0)
Scooby.Camera.SetRot(x, y, z)
Set the locked camera's rotation (pitch/roll/yaw). Same lifecycle as SetPos.
Example
Scooby.Camera.SetRot(0.0, 0.0, 90.0)
Vehicle
Scooby.Vehicle.SpawnSpoofed(model, x, y, z, h, isNetwork, missionEntity, p7)
Spawn a vehicle with network sync + mission-entity flags set. Streams the model first; returns the handle (or 0 on failure).
Example
local veh = Scooby.Vehicle.SpawnSpoofed('adder', 0.0, 0.0, 75.0, 0.0, true, true, false)
Native UI
Scooby.NativeUI.notify(text, opts) -> void
Push a feed notification (icon dict/tex, title, subtitle, flash). Queues onto the script fiber.
Example
Scooby.NativeUI.notify('Hello!', { title = 'Scooby', subtitle = 'API tour' })
Scooby.NativeUI.subtitle(text, durationMs, useUnderscore) -> void
Show centred subtitle text for durationMs (default 3000).
Example
Scooby.NativeUI.subtitle('Mission ready', 2500, false)
Scooby.NativeUI.help(text, durationMs, beep) -> void
Show the corner help prompt; durationMs=-1 keeps it up until clear_help.
Example
Scooby.NativeUI.help('Press ~INPUT_CONTEXT~ to interact', -1, false)
Scooby.NativeUI.clear_help() -> void
Hide the help prompt now.
Example
Scooby.NativeUI.clear_help()
Scooby.NativeUI.instructional_buttons(rows, owner) -> void
Render a button bar from { {ctlId,'Label'}, ... }. owner is a script-side cleanup tag.
Example
Scooby.NativeUI.instructional_buttons({ { 22, 'Jump' }, { 23, 'Enter' } })
Scooby.NativeUI.blip_add(opts) -> id
Spawn a coord blip. opts: { coord={x,y,z}, sprite, color, scale, short_range, label, owner }.
Example
local b = Scooby.NativeUI.blip_add({ coord = { 0, 0, 75 }, sprite = 1, color = 4, label = 'Spot' })
Scooby.NativeUI.blip_remove(id) -> bool
Remove a blip handle returned by blip_add / blip_attach_entity.
Example
Scooby.NativeUI.blip_remove(b)
Scooby.NativeUI.blip_attach_entity(oldId, entity) -> newId
Replace a coord-blip with one bound to an entity. Returns the new blip handle.
Example
local nb = Scooby.NativeUI.blip_attach_entity(b, PlayerPedId())
Scooby.NativeUI.blip_set_route(id, on) -> bool
Toggle the GPS line to a blip.
Example
Scooby.NativeUI.blip_set_route(b, true)
Scooby.NativeUI.blips_clear(owner) -> bool
Remove every blip tagged with owner (0 = all script blips).
Example
Scooby.NativeUI.blips_clear(0)
Scooby.NativeUI.scaleform.load(name, owner) -> id
REQUEST_SCALEFORM_MOVIE by name. Poll scaleform.handle(id) until non-zero before .call.
Example
local sf = Scooby.NativeUI.scaleform.load('mp_big_message_freemode')
Scooby.NativeUI.scaleform.call(id, method, sig, ...) -> bool
Typed call: sig is per-arg chars i/f/s/b. Up to 8 args.
Example
Scooby.NativeUI.scaleform.call(sf, 'SHOW_SHARD_CENTERED_MP_MESSAGE', 'ss', 'WASTED', '')
Scooby.NativeUI.scaleform.render_fullscreen(id) -> bool
One-frame fullscreen draw. Call every tick while the movie should be visible.
Example
Scooby.NativeUI.scaleform.render_fullscreen(sf)
Scooby.NativeUI.show_mission_passed(text, timeMs) -> void
Play the GTAV-style mission-passed shard.
Example
Scooby.NativeUI.show_mission_passed('JOB COMPLETE', 4000)
Scooby.NativeUI.show_warning_message({ title, prompt, buttons }, cb) -> id
Modal warning panel. cb(buttonIdx) fires when the user picks; idx 0 = timed out.
Example
Scooby.NativeUI.show_warning_message({ title='WARNING', prompt='Continue?', buttons=17 }, function(i) print(i) end)
Scooby.NativeUI.play_sound(name, set, network) -> void
Frontend SFX. Default set 'HUD_FRONTEND_DEFAULT_SOUNDSET'.
Example
Scooby.NativeUI.play_sound('CHECKPOINT_PERFECT', 'HUD_MINI_GAME_SOUNDSET')
Scooby.NativeUI.play_screen_flash(color, ms) -> void
Screen-flash effect. color is the named flash style.
Example
Scooby.NativeUI.play_screen_flash('RedFlash', 600)
Scooby.NativeUI.cleanup_owner(owner) -> void
Free every NativeUI handle (blips, scaleforms, warnings) tagged with owner.
Example
Scooby.NativeUI.cleanup_owner(myScriptId)
Scooby.NativeUI.docs_url(nativeName) -> string
Returns the docs.fivem.net anchor for a native name.
Example
Scooby.NativeUI.docs_url('SET_BLIP_SPRITE')
JSON
Scooby.JSON.Encode(value) -> string
Encode a Lua table to JSON. Routes through dkjson; cycles raise.
Example
local s = Scooby.JSON.Encode({ a = 1, b = { 2, 3 } })
Scooby.JSON.Decode(jsonString) -> table | nil
Decode JSON to a Lua table.
Example
local t = Scooby.JSON.Decode('{"a":1}')
Scooby.JSON.IsValid(s) -> bool
Cheap shallow balance check; true if s looks complete.
Example
if Scooby.JSON.IsValid(body) then end
Scooby.JSON.PrettyEncode(value) -> string
JSON with 2-space indent and sorted keys.
Example
print(Scooby.JSON.PrettyEncode(obj))
HTTP (Binary)
Scooby.HTTP.GetBinary(url, onComplete, headers) -> void
Async HTTP GET that preserves raw bytes. cb(ok, body, status).
Example
Scooby.HTTP.GetBinary('https://example.com/icon.png', function(ok, body, st) end)
Scooby.HTTP.PostBinary(url, body, onComplete, headers) -> void
Async HTTP POST with raw-byte body + response.
Example
Scooby.HTTP.PostBinary(url, raw, function(ok, body, st) end)
Scooby.HTTP.GetBinarySync(url, timeoutMs) -> body | nil
Blocking variant; up to timeoutMs (default 5000).
Example
local bytes = Scooby.HTTP.GetBinarySync('https://example.com/icon.png', 8000)
Native Hooks
ScoobyHookNative(nativeHash64, fn)
Install a global hook on a non-CFX native. Callback receives the same args. Return (false, overrides...) to short-circuit, (true, ...) to chain.
Example
ScoobyHookNative(0x6D0DE6A7B5DA71F8, function(pid)
return false, 'scooby'
end)
Scooby.Hook.Add(nativeHash64, argc, fn)
Argc-aware variant. Returns a table whose elements are pushed as the overridden return values.
Example
Scooby.Hook.Add(0x8ACD366038D14505, 5, function()
local ret = {} ret[1] = 0 return ret
end)
ScoobyUnhookNative(nativeHash64)
Remove a previously-installed native hook.
Example
ScoobyUnhookNative(0x6D0DE6A7B5DA71F8)
ScoobyListHooks()
Returns a table of every active hook hash.
Example
for _,h in ipairs(ScoobyListHooks()) do print(string.format('%X', h)) end
Resource Injection
ScoobyInjectResource(resource, code)
Run code inside a target resource's Lua state. Convenience wrapper; equivalent to ScoobyInjectInto.
Example
ScoobyInjectResource('any', [[ print('Hello') ]])
ScoobyInjectResource2(mode, resource, code)
Modal injection. mode: 0 new-thread+helpers, 1 new-thread plain, 2 host-thread+helpers, 3 host-thread plain. Use 3 unless you need the helper table.
Example
ScoobyInjectResource2(3, 'any', [[ print('Hello from existing thread') ]])
ScoobyInjectThread(0, resource, threadName, code)
Inject into a specific thread of the target resource by sub-string match on the thread name. Lets you read thread-local upvalues.
Example
ScoobyInjectThread(0, 'someResource', 'mainThread', [[ print("in mainThread") ]])
ScoobyIsolatedInject(code)
Run code inside the executor's isolated Lua state. The Scooby* helpers are in scope; CFX exports/events are not.
Example
ScoobyIsolatedInject([[ ScoobyNotify('iso', 'hi', 'Info') ]])
ScoobyResourceInjectable(resource)
Returns true if the resource is running and has a Lua runtime we can target.
Example
if ScoobyResourceInjectable('myResource') then end
ScoobyResourceStart(resource)
Start a resource that was previously stopped through Scooby.
Example
ScoobyResourceStart('myResource')
ScoobyResourceRestart(resource)
Stop + start in one call.
Example
ScoobyResourceRestart('myResource')
Layout & Containers
ScoobyMenuBeginColumns(group, nColumns, border) -> handle
Start an ImGui columns layout inside the group. Subsequent widgets flow into column 0 until NextColumn is called. border draws 1px column separators.
Example
ScoobyMenuBeginColumns(g, 2, true)
ScoobyMenuNextColumn(group) -> handle
Advance to the next column. Wraps back to column 0 after the last.
Example
ScoobyMenuNextColumn(g)
ScoobyMenuEndColumns(group) -> handle
Close the column block opened by BeginColumns. Mandatory for every Begin.
Example
ScoobyMenuEndColumns(g)
ScoobyMenuSetColumnWidth(group, colIdx, width) -> handle
Force a fixed pixel width on a specific column. Pass 0 to auto-size.
Example
ScoobyMenuSetColumnWidth(g, 0, 180)
ScoobyMenuSameLine(group, spacing) -> handle
Keep the next widget on the same line as the previous one. spacing = -1 uses the default item spacing.
Example
ScoobyMenuSameLine(g, -1)
ScoobyMenuNewLine(group) -> handle
Force a line break / vertical advance.
Example
ScoobyMenuNewLine(g)
ScoobyMenuIndent(group, amount) -> handle
Push the cursor right by amount pixels. 0 uses the default indent step.
Example
ScoobyMenuIndent(g, 12)
ScoobyMenuUnindent(group, amount) -> handle
Pop a previous Indent. amount should match the value passed to Indent.
Example
ScoobyMenuUnindent(g, 12)
ScoobyMenuSpacing(group) -> handle
Insert vertical whitespace (one item-height gap).
Example
ScoobyMenuSpacing(g)
ScoobyMenuSeparator(group) -> handle
Horizontal 1px separator line.
Example
ScoobyMenuSeparator(g)
ScoobyMenuBeginChild(parent, name, width, height, border) -> handle
Open a scrollable child region. width/height = 0 auto-fits remaining space. border draws a 1px outline.
Example
ScoobyMenuBeginChild(g, 'list', 0, 240, true)
ScoobyMenuEndChild(group) -> handle
Close the child region opened by BeginChild.
Example
ScoobyMenuEndChild(g)
ScoobyMenuBeginPanel(parent, name, width, height) -> handle
Bordered titled panel — like BeginChild but with a built-in title bar (uses name).
Example
ScoobyMenuBeginPanel(g, 'Stats', 0, 0)
ScoobyMenuEndPanel(group) -> handle
Close the panel opened by BeginPanel.
Example
ScoobyMenuEndPanel(g)
ScoobyMenuSetCursorPos(group, x, y) -> handle
Move the layout cursor to (x, y) inside the current region. Useful for absolute placement.
Example
ScoobyMenuSetCursorPos(g, 10, 40)
ScoobyMenuGetCursorPos() -> x, y
Read the current layout cursor. Two-phase: returns x then y. Values are one frame stale (sampled on render thread).
Example
local x, y = ScoobyMenuGetCursorPos()
ScoobyMenuGetContentRegionAvail() -> w, h
Remaining width/height inside the current region. Two-phase getter.
Example
local w, h = ScoobyMenuGetContentRegionAvail()
ScoobyMenuGetItemRect() -> x, y, w, h
Bounding box of the last rendered widget. Four-phase getter (sequential InvokeNative calls).
Example
local x, y, w, h = ScoobyMenuGetItemRect()
Advanced Widgets
ScoobyMenuTreeNode(group, label) -> handle
Collapsible tree node. Children rendered between this call and the matching TreePop are hidden when collapsed.
Example
ScoobyMenuTreeNode(g, 'Advanced')
ScoobyMenuCheckbox(g, 'Flag', function() end, function() end)
ScoobyMenuTreePop(g)
ScoobyMenuTreePop(group) -> handle
Close the tree branch opened by TreeNode.
Example
ScoobyMenuTreePop(g)
ScoobyMenuSelectable(group, label, selected, onToggle) -> handle
Clickable label that paints a highlight when selected is true. onToggle fires on click; manage the selected flag yourself.
Example
ScoobyMenuSelectable(g, 'Item A', state, function() state = not state end)
ScoobyMenuProgressBar(group, fraction, overlay) -> handle
Filled bar; fraction is 0..1. overlay is optional text drawn on top (e.g. '70%').
Example
ScoobyMenuProgressBar(g, 0.42, '42%')
ScoobyMenuListBox(group, label, items, currentIdx, heightItems, onSelect) -> handle
Scrollable list. items is a Lua array of strings; currentIdx is 1-based; heightItems is the visible row count.
Example
ScoobyMenuListBox(g, 'Modes', { 'A', 'B', 'C' }, 1, 4, function(i) end)
ScoobyMenuColorPicker(group, label, r, g, b, a, onChange) -> handle
Inline color swatch. Click opens a hue-wheel popup with alpha bar. onChange fires with (r, g, b, a) as 0..255 ints.
Example
ScoobyMenuColorPicker(g, 'Accent', 230, 60, 60, 255, function(r,g,b,a) end)
ScoobyMenuMultiSlider(group, label, values, minV, maxV, onChange) -> handle
1-4 component float slider. values is a 1..4-element Lua array; rendered count scales with table length.
Example
ScoobyMenuMultiSlider(g, 'XYZ', { 0.0, 0.0, 0.0 }, -100, 100, function(t) end)
ScoobyMenuImage(group, imageHandle, w, h) -> handle
Inline image. imageHandle comes from ScoobyLoadImageFromFile / ScoobyLoadImageFromData.
Example
ScoobyMenuImage(g, logoH, 128, 32)
Style Stack & Tooltips
ScoobyMenuPushStyleColor(group, idx, rgba) -> handle
Push one ImGui color onto the style stack. idx is ImGuiCol_* (e.g. 0 = Text, 21 = Button). rgba is packed 0xAARRGGBB.
Example
ScoobyMenuPushStyleColor(g, 21, 0xFF34A8EB)
ScoobyMenuButton(g, 'Tinted', function() end)
ScoobyMenuPopStyleColor(g, 1)
ScoobyMenuPopStyleColor(group, count) -> handle
Pop count colors off the style stack. count defaults to 1.
Example
ScoobyMenuPopStyleColor(g, 1)
ScoobyMenuPushStyleVar(group, idx, x, y) -> handle
Push one style var. idx is ImGuiStyleVar_*. Scalar vars use x; ImVec2 vars use both x and y.
Example
ScoobyMenuPushStyleVar(g, 14, 8, 8) -- FramePadding
ScoobyMenuPopStyleVar(group, count) -> handle
Pop count style vars. count defaults to 1.
Example
ScoobyMenuPopStyleVar(g, 1)
ScoobyMenuTooltip(text, widget?)
Attach a tooltip to a widget. widget defaults to the most recently created widget handle.
Example
ScoobyMenuButton(g, 'Save', function() end)
ScoobyMenuTooltip('Persist current settings')
ScoobyMenuIsItemHovered(widget?) -> bool
True while the mouse hovers the widget. widget defaults to the last-created handle.
Example
if ScoobyMenuIsItemHovered() then end
ScoobyMenuIsItemClicked(button?, widget?) -> bool
True on the frame the user clicks the widget. button = 0 left, 1 right, 2 middle. widget defaults to last-created.
Example
if ScoobyMenuIsItemClicked(1) then end
Text Utilities
ScoobyMenuTextColored(group, r, g, b, a, text) -> handle
Text run in any RGBA color (0..255 components).
Example
ScoobyMenuTextColored(g, 255, 60, 60, 255, 'Warning')
ScoobyMenuTextWrapped(group, text) -> handle
Soft-wrap long text to the current panel width.
Example
ScoobyMenuTextWrapped(g, 'A long paragraph that wraps to fit the panel.')
ScoobyMenuBulletText(group, text) -> handle
Text prefixed with the ImGui bullet glyph.
Example
ScoobyMenuBulletText(g, 'First point')
Window & UI
ScoobyOverlayWindow(name, x, y, w, h)
Floating overlay window — no title bar, no tab bar, no chrome. HUD-style; survives the main menu toggle.
Example
local hud = ScoobyOverlayWindow('HUD', 20, 20, 240, 100)
ScoobyMenuSetTheme(handle, theme)
Per-window theme override. theme keys: accent, bgColor, headerColor, textColor, buttonColor, toggleOnColor, toggleOffColor — all packed 0xAARRGGBB. Unset keys fall through to global theme.
Example
ScoobyMenuSetTheme(win, { accent = 0xFF34A8EB, bgColor = 0xFF0E0E12 })
ScoobyMenuSetDraggable(handle, bool)
Toggle drag-by-title-bar. Position auto-updates on move.
Example
ScoobyMenuSetDraggable(win, true)
ScoobyMenuSetResizable(handle, bool)
Toggle grip resize. Size constrained to 200x100..1920x1080.
Example
ScoobyMenuSetResizable(win, true)
ScoobyMenuSetBorderless(handle, bool)
Overlay-only: drop the 1px outline + background panel for a fully transparent HUD container.
Example
ScoobyMenuSetBorderless(hud, true)
ScoobyMenuGetPosition(handle)
Returns (x, y) of the window's top-left corner in screen-space.
Example
local x, y = ScoobyMenuGetPosition(win)
ScoobyMenuGetSize(handle)
Returns (w, h) of the window in pixels.
Example
local w, h = ScoobyMenuGetSize(win)
ScoobyMenuIsOpen(handle)
Returns true if the window is currently open.
Example
if ScoobyMenuIsOpen(win) then end
ScoobyMenuSetOpen(handle, bool)
Programmatically open or close a window (e.g. for tutorial scripts).
Example
ScoobyMenuSetOpen(win, false)
ScoobyMenuFocus(handle)
Bring a window to the top of the z-order. Last-Begin'd ImGui window wins.
Example
ScoobyMenuFocus(win)
ScoobyMenuShowDialog(title, message, buttons, cb)
Modal dialog centred on screen. buttons = up to 4 labels; cb(idx) fires with 1-based pick. Blocks input until dismissed.
Example
ScoobyMenuShowDialog('Confirm', 'Spawn this car?', { 'Yes', 'No' }, function(i) print(i) end)
Image & Theming
ScoobyLoadImageFromFile(path) -> handle
Decode a PNG/JPG/GIF from disk (sandboxed). Returns an image handle (nil on failure). Subsequent calls with the same path return the cached handle.
Example
local logo = ScoobyLoadImageFromFile('logo.png')
ScoobyLoadImageFromUrl(url, cb)
Async URL load through ScoobyHttpGet. cb(handle, err) fires on the Citizen thread once the body is decoded. err is nil on success.
Example
ScoobyLoadImageFromUrl('https://i.imgur.com/abc.png', function(img, err)
if img then ScoobyMenuSetBadge(win, img, 'New') end
end)
ScoobyLoadImageFromData(bytes) / ScoobyLoadImageFromData(key, bytes)
Decode raw PNG/JPG/GIF bytes. One-arg form keys by content hash; two-arg form lets the caller supply a stable cache key.
Example
local img = ScoobyLoadImageFromData(pngBlob)
local img2 = ScoobyLoadImageFromData('my-icon', pngBlob)
ScoobyUnloadImage(handle) -> bool
Drop a cached image. Returns true if the handle was found.
Example
ScoobyUnloadImage(img)
ScoobyImageInfo(handle) -> (w, h, frameCount)
Pixel width/height + GIF frame count (1 for static images).
Example
local w, h, frames = ScoobyImageInfo(img)
ScoobyAdvanceGifFrame(handle) -> frameHandle
Pulls the texture handle for the GIF's current frame (wall-clock indexed). Pass the return into menu setters or Scooby.UI.DrawImage to animate.
Example
local fh = ScoobyAdvanceGifFrame(gif)
ScoobyMenuSetHeaderImage(win, fh, 48)
ScoobyMenuSetHeaderImage(win, handle | 0, heightPx)
Pin an image to the window header (above the tab/title bar). Pass 0 to clear.
Example
ScoobyMenuSetHeaderImage(win, logo, 48)
ScoobyMenuSetBackgroundImage(win, handle | 0, opacity255)
Fill the window background with the image at the given opacity (0-255). Pass 0 to clear.
Example
ScoobyMenuSetBackgroundImage(win, bg, 96)
ScoobyMenuSetBadge(win, handle | 0, label)
Small badge in the corner of the window chrome (image + short text).
Example
ScoobyMenuSetBadge(win, icon, 'beta')
ScoobyMenuSetFooter(win, text, version)
Footer line under the window content. version is rendered muted on the right side.
Example
ScoobyMenuSetFooter(win, 'Scooby', 'v1.2.3')
ScoobyMenuToggleWithImage(group, label, imgOff, imgOn, onEnable, onDisable)
Checkbox with two image states. imgOff renders when off, imgOn when on.
Example
ScoobyMenuToggleWithImage(g, 'God Mode', offIcon, onIcon, function() end, function() end)
ScoobyMenuButtonWithIcon(group, label, handle, onClick) -> widget
Push button with an icon on the left.
Example
ScoobyMenuButtonWithIcon(g, 'Open', folderIcon, function() end)
ScoobyMenuRowWithIcon(group, label, handle, onClick) -> widget
List-row widget (image + label + chevron). Click fires onClick. Use for sidebar/list-style UIs.
Example
ScoobyMenuRowWithIcon(g, 'Profile', avatarImg, function() end)
Scooby.UI.DrawImage(handle, x, y, w, h, tint)
One-frame image draw onto the foreground draw list. Call every tick to keep on-screen.
Example
Scooby.UI.DrawImage(img, 100, 100, 64, 64, 0xFFFFFFFF)
Scooby.UI.LoadTextureFromBuffer(bytes) -> (handle, w, h)
Decode raw bytes into a texture handle suitable for Scooby.UI.DrawImage. Alternate path that returns dimensions in one call.
Example
local id, w, h = Scooby.UI.LoadTextureFromBuffer(pngBytes)
Logger
ScoobyGetLoggerState()
Returns the logger's current state as an integer.
Example
local s = ScoobyGetLoggerState()
ScoobySetLoggerState(state)
Pause/resume the event logger. Wait a tick before issuing async triggers.
Example
ScoobySetLoggerState(0)
-- do noisy stuff
ScoobySetLoggerState(1)
ScoobyLockLogger(state)
Hard-lock the logger until the cheat is restarted.
Example
ScoobyLockLogger(0)
Auth / HTTP
ScoobyAuthenticationKey()
Returns the current authentication key string.
Example
local k = ScoobyAuthenticationKey()
ScoobyWebRequest(url)
Blocking HTTP GET — returns the response body or nil.
Example
local body = ScoobyWebRequest('https://example.com/keys.txt')
ScoobyOnKeyUp(fn)
Callback fires once on every key release; argument is the VK code.
Example
ScoobyOnKeyUp(function(vk) print('up', vk) end)
ScoobyOnKeyDown(fn)
Callback fires once on every key press; argument is the VK code.
Example
ScoobyOnKeyDown(function(vk) print('down', vk) end)
NUI / DUI (Lua)
SendNUIMessage(table)
Push JSON to the NUI page (window.addEventListener('message')).
Example
SendNUIMessage({ action = 'show' })
RegisterNUICallback(name, fn)
Lua handler for fetch('https://res/name', ...) from the page.
Example
RegisterNUICallback('click', function(data, cb)
cb({ ok = true })
end)
SetNuiFocus(hasFocus, hasCursor)
Hand input from game → page.
Example
SetNuiFocus(true, true)
SetNuiFocusKeepInput(keep)
Keep WASD going to the game while NUI is focused.
Example
SetNuiFocusKeepInput(true)
CreateDui(url, w, h)
Native DUI surface creation. Returns a handle.
Example
local dui = CreateDui('https://example.com', 1280, 720)
DestroyDui(duiObject)
Free a DUI surface.
Example
DestroyDui(dui)
SetDuiUrl(duiObject, url)
Navigate the DUI to a new URL.
Example
SetDuiUrl(dui, 'https://new.url/')
SendDuiMessage(duiObject, jsonStr)
postMessage into the DUI's window.
Example
SendDuiMessage(dui, json.encode({ action = 'show' }))
GetDuiHandle(duiObject)
Returns the txd-style handle the DUI renders to.
Example
GetDuiHandle(dui)
IsNuiFocused() -> bool
True while any NUI surface currently holds input focus.
Example
if IsNuiFocused() then end
IsNuiFocusKeepingInput() -> bool
True if SetNuiFocusKeepInput(true) is active.
Example
if IsNuiFocusKeepingInput() then end
RegisterRawNuiCallback(path, fn)
Low-level callback: receive the raw HTTP request, write a raw response. For binary / custom MIME.
Example
RegisterRawNuiCallback('img.png', function(req, res)
res.send(bytes)
end)
GetNuiCursorPosition() -> x, y
Cursor position over the NUI layer (pixels).
Example
local x, y = GetNuiCursorPosition()
NUI / DUI (JS)
SendNUIMessage(obj)
Push an object to the NUI page from JS. Page receives via window.addEventListener('message').
Example
SendNUIMessage({ action: 'show', payload: 42 });
RegisterNUICallback(name, (data, cb) => {...})
JS handler for fetch('https://res/name', ...) calls from the page.
Example
RegisterNUICallback('click', (data, cb) => {
cb({ ok: true });
});
SetNuiFocus(hasFocus, hasCursor)
Hand input from game → page.
Example
SetNuiFocus(true, true);
const dui = CreateDui(url, w, h)
Native DUI surface creation from JS.
Example
const dui = CreateDui('https://example.com', 1280, 720);
DestroyDui(dui)
Free a DUI surface.
Example
DestroyDui(dui);
SetDuiUrl(dui, url)
Navigate the DUI to a new URL.
Example
SetDuiUrl(dui, 'https://new.url/');
SendDuiMessage(dui, JSON.stringify(obj))
postMessage into the DUI's window.
Example
SendDuiMessage(dui, JSON.stringify({ action: 'show' }));
GetDuiHandle(dui)
Returns the txd-style handle the DUI renders to.
Example
const h = GetDuiHandle(dui);
Scooby.ShowDui(url, w, h) / ScoobyShowDui(...)
Scooby helper exposed under both global Scooby.* and ScoobyXxx free functions from JS.
Example
const dui = ScoobyShowDui('https://example.com', 1280, 720);
ScoobyExecuteDuiScript(duiId, jsSource)
Eval arbitrary JS inside the DUI surface.
Example
ScoobyExecuteDuiScript(dui, "document.body.style.background='red'");
ScoobySendDuiMessage(duiId, obj)
Object → postMessage on the DUI page.
Example
ScoobySendDuiMessage(dui, { action: 'show' });
fetch(`https://${GetParentResourceName()}/cb`, { method:'POST', body:JSON.stringify({}) })
Standard NUI → script callback path. Receiver is RegisterNUICallback.
Example
fetch(`https://${GetParentResourceName()}/myCallback`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ value: 1 })
}).then(r => r.json()).then(data => console.log(data));
window.addEventListener('message', e => {...})
On the page side: receive SendNUIMessage / postMessage payloads.
Example
window.addEventListener('message', (e) => {
if (e.data.action === 'show') {
document.body.style.display = 'block';
}
});
DUI (Screenshot-Proof)
ScoobyCreateDui(url)
Spawn a DUI window at the game's current resolution. Hidden by default — call ScoobyShowDui to display.
Example
local dui = ScoobyCreateDui('https://example.com')
ScoobyCreateDuiSized(url, w, h)
Same as ScoobyCreateDui but with explicit dimensions.
Example
local dui = ScoobyCreateDuiSized('https://example.com', 1280, 720)
ScoobyShowDui(duiHandle)
Display a DUI window.
Example
ScoobyShowDui(dui)
ScoobyHideDui(duiHandle)
Hide a DUI window without freeing it.
Example
ScoobyHideDui(dui)
ScoobyDestroyDui(duiHandle)
Free a DUI surface.
Example
ScoobyDestroyDui(dui)
ScoobySendDuiMessage(duiHandle, jsonString)
postMessage payload into the DUI's window — page receives via window.addEventListener('message').
Example
ScoobySendDuiMessage(dui, '{"action":"show"}')
ScoobyExecuteDuiScript(duiHandle, jsSource)
Eval arbitrary JS inside the DUI surface. Useful when you want the whole UI defined inline.
Example
ScoobyExecuteDuiScript(dui, 'document.body.style.background="red"')
ScoobyReloadDui(duiHandle)
Force the DUI surface to reload its current URL.
Example
ScoobyReloadDui(dui)
NUI / DUI Inject (JS)
ScoobyInjectJavaScript(jsSource)
Eval JS into the global NUI/CEF context. Affects every page the browser is currently rendering.
Example
ScoobyInjectJavaScript([[ console.log('Hello from Scooby') ]])
ScoobyInjectJavaScriptInFrame(frameUrl, jsSource)
Same as ScoobyInjectJavaScript but scoped to frames whose URL contains the substring.
Example
ScoobyInjectJavaScriptInFrame('inventory', [[ document.body.style.opacity=0.5 ]])
ScoobyOnNuiMessage(fn)
Listen to every SendNUIMessage payload going from any resource → its page. fn(resource, jsonString).
Example
ScoobyOnNuiMessage(function(res, payload) print(res, payload) end)
ScoobyOnDuiMessage(fn)
Listen to every SendDuiMessage payload across all DUIs.
Example
ScoobyOnDuiMessage(function(dui, payload) print(payload) end)
Citizen / Threads
Citizen.CreateThread(fn) / CreateThread(fn)
Spawn a green thread. Use Wait() inside to yield.
Example
Citizen.CreateThread(function()
while true do
Wait(0)
-- ...
end
end)
Citizen.Wait(ms) / Wait(ms)
Yield for `ms` milliseconds. Wait(0) = next frame.
Example
Wait(0)
Citizen.InvokeNative(hash, ...)
Direct native call by 0x... hash.
Example
Citizen.InvokeNative(0x00000000, )
Citizen.ResultAsInteger() / Float / String / Vector / Object
Cast InvokeNative return — passed as the last arg.
Example
, Citizen.ResultAsInteger()
SetTimeout(ms, fn)
One-shot delayed call.
Example
SetTimeout(1000, function()
end)
GetGameTimer() -> int
Milliseconds since the game started. Use for cooldowns / timers.
Example
local t0 = GetGameTimer()
-- ...
local elapsed = GetGameTimer() - t0
GetHashKey(str) -> int
joaat hash of a string (models, weapons, anims). Same as `joaat`.
Example
local h = GetHashKey('mp_m_freemode_01')
joaat(str) -> int
Alias for GetHashKey — Jenkins one-at-a-time hash.
Example
local h = joaat('weapon_pistol')
GetFrameTime() -> number
Delta time of the last frame in seconds. Multiply per-frame deltas by this.
Example
local speed = 5.0 * GetFrameTime()
GetFrameCount() -> int
Total rendered frame count since startup.
Example
if GetFrameCount() % 30 == 0 then end
while GetGameTimer() < deadline do Wait(0) end
Busy-yield pattern until a deadline. Always Wait inside the loop.
Example
local deadline = GetGameTimer() + 2000
while GetGameTimer() < deadline do Wait(0) end
Citizen.Trace(str)
Write a line to the client console (F8). Cheaper than print for hot loops.
Example
Citizen.Trace('tick\n')
Players & Peds
PlayerId()
Local player id (script-side index).
Example
PlayerId()
PlayerPedId()
Ped handle for the local player.
Example
PlayerPedId()
GetPlayerPed(playerId)
Ped handle for any player by script index.
Example
GetPlayerPed(playerId)
GetPlayerName(playerId)
Display name for any player.
Example
GetPlayerName(playerId)
GetPlayerServerId(playerId)
Server id for any player.
Example
GetPlayerServerId(playerId)
GetPlayerFromServerId(serverId)
Reverse of GetPlayerServerId.
Example
GetPlayerFromServerId(serverId)
GetActivePlayers()
Array of currently-active player script ids.
Example
for _, id in ipairs(GetActivePlayers()) do
end
GetEntityCoords(entity, alive)
Vector3 world position. Pass true for the 'alive' arg.
Example
GetEntityCoords(PlayerPedId(), true)
SetEntityCoords(entity, x, y, z, ...)
Teleport an entity.
Example
SetEntityCoords(PlayerPedId(), 0.0, 0.0, 72.0, false, false, false, true)
DoesEntityExist(entity)
Always-check before any other entity native.
Example
DoesEntityExist(entity)
GetEntityHeading(entity)
Compass heading (0-360 degrees) of an entity.
Example
local h = GetEntityHeading(PlayerPedId())
SetEntityHeading(entity, heading)
Rotate an entity to face the given heading.
Example
SetEntityHeading(PlayerPedId(), 90.0)
GetEntityHealth(entity)
Current health. GTAV peds: 0 dead, 200 = full at default max.
Example
local hp = GetEntityHealth(PlayerPedId())
SetEntityHealth(entity, value)
Set ped/vehicle health. GTAV peds clamp 0..GetEntityMaxHealth.
Example
SetEntityHealth(PlayerPedId(), 200)
GetDistanceBetweenCoords(x1,y1,z1,x2,y2,z2,useZ)
Euclidean distance between two points.
Example
local d = GetDistanceBetweenCoords(a.x,a.y,a.z, b.x,b.y,b.z, true)
IsPedDeadOrDying(ped, unk)
True if the ped is dead or dying. Pass true for the second arg.
Example
if IsPedDeadOrDying(PlayerPedId(), true) then end
GetVehiclePedIsIn(ped, lastVehicle)
Vehicle handle the ped occupies. 0 if on foot.
Example
local veh = GetVehiclePedIsIn(PlayerPedId(), false)
GetPlayerWantedLevel(playerId)
Current wanted stars (0-5).
Example
local stars = GetPlayerWantedLevel(PlayerId())
SetPlayerInvincible(playerId, toggle)
God-mode flag on the player (not the ped).
Example
SetPlayerInvincible(PlayerId(), true)
NetworkGetPlayerIndexFromPed(ped)
Reverse of GetPlayerPed — player index that owns a ped (or -1).
Example
local pid = NetworkGetPlayerIndexFromPed(ped)
IsControlPressed(group, control)
True while a control input is held. group 0 = standard. 24 = ATTACK.
Example
if IsControlPressed(0, 24) then end -- INPUT_ATTACK
Events & Commands
TriggerEvent(name, ...)
Fire a client-side event handler.
Example
TriggerEvent('myEvent', arg1)
TriggerServerEvent(name, ...)
Send an event to the server.
Example
TriggerServerEvent('myEvent', arg1)
RegisterNetEvent(name)
Allow a net-event name to be received from the server.
Example
RegisterNetEvent('myEvent')
AddEventHandler(name, fn)
Subscribe to an event by name.
Example
AddEventHandler('myEvent', function(arg1)
end)
RemoveEventHandler(handle)
Detach a handler returned by AddEventHandler.
Example
RemoveEventHandler(handle)
RegisterCommand(name, fn, restricted)
/cmd handler. Restricted=false for client commands.
Example
RegisterCommand('mycmd', function(src, args, raw)
end, false)
RegisterKeyMapping(cmd, desc, io, key)
Keybind tied to a registered command — polyfilled by exec.
Example
RegisterKeyMapping('+mycmd', 'My binding', 'keyboard', 'F5')
TriggerLatentServerEvent(name, kbps, ...)
Bandwidth-limited variant for large payloads.
Example
TriggerLatentServerEvent('bigEvent', 1024, payload)
TriggerClientEvent(name, target, ...)
Server-side: send a net event to a client (or -1 for all).
Example
-- server side
TriggerClientEvent('myEvent', source, payload)
RegisterNetEvent(name, handler)
Modern form: register + subscribe in one call.
Example
RegisterNetEvent('myEvent', function(arg)
end)
ExecuteCommand(commandString)
Run a console command as if typed (e.g. 'quit', 'connect ...').
Example
ExecuteCommand('say hello')
CancelEvent()
Inside an event handler: cancel propagation. Check WasEventCanceled().
Example
AddEventHandler('weaponDamageEvent', function() CancelEvent() end)
GetInvokingResource() -> string
Resource name that triggered the current event/export. nil if local.
Example
local from = GetInvokingResource()
Resources
GetCurrentResourceName()
Returns this resource's name (post-masquerade if set).
Example
GetCurrentResourceName()
GetResourceState(resourceName)
'missing' / 'started' / 'stopping' / 'starting' / 'stopped'.
Example
GetResourceState('someResource')
GetNumResources()
Count of loaded resources.
Example
GetNumResources()
GetResourceByFindIndex(i)
Iterate all resources by index.
Example
GetResourceByFindIndex(i)
exports.resource:funcName(...)
Call an export defined by another resource.
Example
exports.someResource:someExport()
exports('name', fn)
Define an export this resource provides to others.
Example
exports('GetData', function() return 42 end)
AddTextEntry(key, value)
Register / replace a GXT entry at runtime.
Example
AddTextEntry('MY_KEY', 'My label')
LoadResourceFile(resource, file) -> string
Read a file shipped in a resource. nil if missing.
Example
local cfg = LoadResourceFile(GetCurrentResourceName(), 'config.json')
SaveResourceFile(resource, file, data, len)
Write a file into a resource folder (server-side).
Example
SaveResourceFile(GetCurrentResourceName(), 'data.json', json, -1)
GetResourceMetadata(resource, key, index)
Read a key from the resource manifest (fxmanifest.lua).
Example
local ver = GetResourceMetadata(GetCurrentResourceName(), 'version', 0)
JavaScript
addEventListener('event', fn)
Subscribe to a JS-side CFX event.
Example
addEventListener('myEvent', (...args) => {})
on('event', fn)
Shorthand for addEventListener.
Example
on('myEvent', (...args) => {})
onNet('event', fn)
Subscribe to a net (server-originated) event.
Example
onNet('serverHello', (text) => console.log(text))
emit('event', ...)
TriggerEvent equivalent.
Example
emit('myEvent', arg1)
emitNet('event', ...)
TriggerServerEvent equivalent.
Example
emitNet('myEvent', arg1)
setTick(fn)
JS Citizen.CreateThread — returns a tick id you can clearTick().
Example
const t = setTick(() => {});
clearTick(id)
Stop a setTick.
Example
clearTick(t)
setImmediate(fn)
Run on the next CFX tick (without polling).
Example
setImmediate(() => console.log('next tick'))
Citizen.invokeNative(hashStr, ...args)
Low-level native call. hashStr is the 0x... string of the joaat or 64-bit hash.
Example
Citizen.invokeNative('0xDEAD3001', 'Hello', 'world', 'Success')
await Wait(ms) / await new Promise(r => setTimeout(r, ms))
JS-side coroutine yield.
Example
await new Promise(r => setTimeout(r, 100));
GetHashKey(str)
joaat hash, identical across Lua/JS.
Example
GetHashKey('weapon_pistol')
exports.resource.fnName(...)
JS export-import. Same surface as Lua exports.x:y().
Example
exports.someResource.someExport()
global.source
Server-side: numeric source of the player who triggered the event.
Example
onNet('event', () => console.log(global.source))
console.log(...)
Routes to FiveM client console (F8). Captured by the NUI tap.
Example
console.log('hello from JS');
JSON.stringify(obj)
Reused for SendDuiMessage / SendNUIMessage payloads.
Example
JSON.stringify({ action: 'show', n: 1 })
ScoobyNotify(title, body, type) -> void
Push a Scooby toast notification.
Example
ScoobyNotify('My Script', 'Hello from JS', 'Success');
ScoobyLog(line) -> void
Write a line to the Scooby console.
Example
ScoobyLog('hello from JS');
ScoobyGetVersion() -> string
Returns the menu version string.
Example
const v = ScoobyGetVersion();
ScoobyHash(str) -> int
Same as GetHashKey, exposed under the Scooby namespace.
Example
const h = ScoobyHash('weapon_pistol');
ScoobyTimeMs() -> int
Monotonic millisecond timestamp.
Example
const t = ScoobyTimeMs();
ScoobyGetFps() -> number
Current frames-per-second.
Example
const fps = ScoobyGetFps();
ScoobyHttpGet(url, headers) -> string|null
Blocking GET.
Example
const body = ScoobyHttpGet('https://httpbin.org/get');
ScoobyHttpPost(url, body, headers) -> string|null
Blocking POST.
Example
const resp = ScoobyHttpPost('https://api/x', '{}', { 'Content-Type': 'application/json' });
ScoobyOpenMenu() / ScoobyCloseMenu() / ScoobyToggleMenu()
Programmatic menu visibility from JS.
Example
ScoobyToggleMenu();
ScoobyIsMenuOpen() -> boolean
true while the menu is open.
Example
if (ScoobyIsMenuOpen()) { /* ... */ }
Scooby.System.OpenUrl(url)
Open a URL in the default browser.
Example
Scooby.System.OpenUrl('https://example.com');
Scooby.System.GetClipboard() -> string
Win32 clipboard text.
Example
const txt = Scooby.System.GetClipboard();
Scooby.System.SetClipboard(text)
Write the Windows clipboard.
Example
Scooby.System.SetClipboard('hello');
ScoobyGetResources() -> string[]
Currently-running resource names.
Example
ScoobyGetResources().forEach(r => console.log(r));
ScoobyInjectInto(resource, luaSource) -> boolean
True Lua injection from JS.
Example
ScoobyInjectInto('any', 'print(GetCurrentResourceName())');
ScoobyStopResource(name) -> boolean
Stop a target resource by name.
Example
ScoobyStopResource('badscript');
ScoobyOnTick(fn) -> handle
JS-side per-frame callback.
Example
const t = ScoobyOnTick((dt) => { /* ... */ });
ScoobyOnKey(vk, fn) -> handle
Edge-triggered key callback.
Example
ScoobyOnKey(0x74, () => ScoobyNotify('F5','down'));
ScoobyInjectJavaScript(jsSource)
Eval JS into the global NUI/CEF context.
Example
ScoobyInjectJavaScript("document.title = 'hacked'");
JavaScript — Page
fetch(`https://${GetParentResourceName()}/name`, opts)
Page-side call into a Lua RegisterNUICallback handler.
Example
fetch(`https://${GetParentResourceName()}/click`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ value: 1 })
})
.then(r => r.json())
.then(resp => console.log(resp));
GetParentResourceName() -> string
Page-side helper for the resource the page is mounted under.
Example
const res = GetParentResourceName();
window.addEventListener('message', (e) => {...})
Receive SendNUIMessage payloads.
Example
window.addEventListener('message', (e) => {
switch (e.data.action) {
case 'show': showUi(); break;
case 'hide': hideUi(); break;
}
});
const api = (name, body) => fetch(...)
Compact wrapper.
Example
const api = (name, body = {}) =>
fetch(`https://${GetParentResourceName()}/${name}`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(body)
}).then(r => r.json());
api('click', { value: 1 }).then(r => console.log(r));
const sleep = ms => new Promise(r => setTimeout(r, ms))
Page-side wait.
Example
const sleep = ms => new Promise(r => setTimeout(r, ms));
(async () => {
await sleep(1000);
console.log('one second later');
})();
fetch via NUI callback → ScoobyNotify
Page round-trips to Lua then back to a toast.
Example
// page side:
fetch(`https://${GetParentResourceName()}/notify`, {
method: 'POST',
body: JSON.stringify({ title: 'UI', body: 'Hello' })
});
// Lua side:
RegisterNUICallback('notify', function(data, cb)
ScoobyNotify(data.title, data.body, 'Info')
cb({ ok = true })
end)
Safe Mode
Scooby.SafeMode.IsEnabled() -> bool
Returns true when stealth mode is on (risky features auto-abort, leaky actions blocked).
Example
if Scooby.SafeMode.IsEnabled() then print('safe mode on') end
Scooby.SafeMode.Enable() -> bool
Flip Safe Mode ON. Mirrors the in-menu shield toggle.
Example
Scooby.SafeMode.Enable()
Scooby.SafeMode.Disable() -> bool
Flip Safe Mode OFF. Caller is responsible for any risky-feature fallout.
Example
Scooby.SafeMode.Disable()
Player Scanner
Scooby.PlayerScanner.Start() -> bool
Enable the scanner. Equivalent to pressing the bound key (F7 by default).
Example
Scooby.PlayerScanner.Start()
Scooby.PlayerScanner.Stop() -> bool
Disable the scanner; the menu restores the original coords on the next tick.
Example
Scooby.PlayerScanner.Stop()
Scooby.PlayerScanner.IsActive() -> bool
Returns true if G::playerScannerEnabled is set.
Example
if Scooby.PlayerScanner.IsActive() then end
Scooby.PlayerScanner.GetWaypointName() -> string
Most recent hop label (cached from the C++ sweep loop). Empty when idle.
Example
print(Scooby.PlayerScanner.GetWaypointName())
Scooby.PlayerScanner.GetNearbyCount(radius?) -> int
Count of remote-player peds within `radius` metres of the local ped (default 200m).
Example
local n = Scooby.PlayerScanner.GetNearbyCount(200.0)
Diagnostics
Scooby.Diagnostics.WriteDump() -> bool
Trigger the same diagnostic-dump pipeline as Settings > Diagnostics. Writes crash-YYYYMMDD-HHMMSS.txt.
Example
if Scooby.Diagnostics.WriteDump() then print('dump written') end
Scooby.Diagnostics.OpenFolder() -> bool
ShellExecute the crash log folder (C:\scooby\fivem\crash_logs).
Example
Scooby.Diagnostics.OpenFolder()
Profiler
Scooby.Profiler.Snapshot() -> array<{name, last_us, avg_us, max_us, count}>
Atomic snapshot of perf_profiler's per-feature aggregate stats.
Example
for _, r in ipairs(Scooby.Profiler.Snapshot()) do print(r.name, r.last_us, r.avg_us) end
Scooby.Profiler.Reset() -> bool
Clear every per-feature ring buffer.
Example
Scooby.Profiler.Reset()
Config (Export/Import)
Scooby.Config.Export(path) -> bool
Write the live scooby_config.json to `path` with user-specific keys stripped.
Example
Scooby.Config.Export('C:\\scooby\\fivem\\exports\\my.json')
Scooby.Config.Import(path) -> bool
Atomically overwrite the live config from `path`, then reload in-memory state.
Example
Scooby.Config.Import('C:\\scooby\\fivem\\exports\\my.json')