> For the complete documentation index, see [llms.txt](https://docs.rainmad.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.rainmad.com/resources/bank-truck-robbery-4-in-1/events-and-exports.md).

# Events & Exports

## Start a job from your own script

The job can be started externally, from an item, a phone app, or a mission script. Called **server-side**, it accepts a target player and a table of gates to waive:

```lua
---@param targetPlayerServerId? number  defaults to the triggering player
TriggerEvent('rm_banktruck:server:startTrackingTruck', targetPlayerServerId, {
    price                = 0,     -- overrides cfg.prices.locationInfo
    ignorePoliceCount    = false,
    ignorePlayerCooldown = false,
    ignoreLockdown       = false,
    ignoreItemCheck      = false,
})
```

The options table is optional, and every flag defaults to `false`. On success, the player gets the truck's location on their GPS for `cfg.showLocationDuration` minutes, exactly as if they had bought it from the NPC.

{% hint style="warning" %}
**Clients cannot use the options.** The event is also reachable with `TriggerServerEvent`, but when it arrives from a client both arguments are discarded: it starts the job for the calling player only, with every gate enforced. Without that, any player could trigger it with `price = 0` and every flag on.

Call it from a server-side script if you need the options.
{% endhint %}

Set `cfg.disableServerEvent = true` if you want this API off entirely.

## Lockdown

```lua
exports.rm_banktruckrobbery:setLockdown(true) -- true | false | nil (nil toggles)
exports.rm_banktruckrobbery:getLockdown()
```

While lockdown is active, new jobs are refused with a notification, so you can pause the robbery during events or police raids. Both return the resulting state.

```lua
exports.rm_banktruckrobbery:setLockdown(true)
print(exports.rm_banktruckrobbery:getLockdown()) -- true
```

## Client hooks

`rm_banktruckrobbery/client/editable_functions.lua` is an open file with two ready handlers:

```lua
function onTruckSpawn(vehicle)
    -- fires on the client that spawned the truck, before its crew is tasked
end

function onMoneyCollect()
    -- fires on the collecting client when the grab animation starts
end
```

## Discord logging

Shop purchases and every payout route through `rm_banktruckrobbery/server/discord_log.lua`, an open file you can rewrite entirely. Logging is **off by default**: replace `WEBHOOK_HERE` with your webhook URL in the file's config to turn it on.

{% hint style="info" %}
The URL lives in that file and not in `cfg.lua` on purpose. `cfg.lua` is a shared script, so anything in it is readable by clients.
{% endhint %}
