Studios
Heist Editorhouse-3.jpg

Examples

SoonHeist EditorQbox
PAGE 04 OF 06  ·  CONFIGURATION → EXAMPLES → TROUBLESHOOTINGdocs.glitchstudios.dev
Browse docs

Register a heist from your own resource#

-- fxmanifest.lua of your heist resource
dependency 'glitch-heistEditor'
server_scripts {
    'definitions.lua',
    '@glitch-heistEditor/lib/register.lua',
}
-- definitions.lua
HeistDefinitions = {
    {
        id = 'corner_store',
        label = 'Corner store',
        icon = 'building-store',
        job = { id = 'corner_store' },
        run = { duration = 900, escape = 120.0, light = true },
        cooldowns = { site = 3600 },
        sites = {
            { id = 'main', label = 'Main Street',
              points = { till = { x = 25.7, y = -1347.3, z = 29.5, w = 0.0 } } },
        },
        steps = {
            { id = 'till', label = 'Empty the till', points = { 'till' }, starts = true,
              phases = { { type = 'progress', ms = 6000, label = 'Emptying the till' } },
              onSuccess = {
                  { type = 'reward', kind = 'money', account = 'cash', min = 400, max = 900, to = 'self' },
                  { type = 'take' },
                  { type = 'endRun', result = 'escaped' },
              } },
        },
    },
}

Definitions are plain tables that survive JSON, so a vector is { x, y, z, w }. DESIGN.md in the package lists every field, phase and action. The register helper registers again whenever the engine restarts.

Register by hand#

local ok, err = exports['glitch-heistEditor']:RegisterHeist(def)
if not ok then print('not registered: ' .. tostring(err)) end

If another resource already registered the same heist id, the console logs that it was replaced.

Allow your own events#

Config.AllowedEvents = { prefixes = { 'glitch-', 'glitch_', 'ghe:', 'myheist:' }, names = {} }

Hold a reward and pay it later#

Set run.hold to a server event name. When a player escapes, the event gets a ticket and the heist, and nothing is paid yet. Your resource pays or fails it later:

exports['glitch-heistEditor']:PayHeld(ticket, false)
exports['glitch-heistEditor']:FailHeld(ticket, {})

Listen to run events#

AddEventHandler('glitch-heistEditor:runEnded', function(data)
    print(data.heist, data.site, data.result)
end)

Read a point and run state from a client script#

local p = exports['glitch-heistEditor']:GetPoint('corner_store', 'main', 'till')
local state = exports['glitch-heistEditor']:RunState('corner_store', 'main')