> ## Documentation Index
> Fetch the complete documentation index at: https://docs.projectx.gg/llms.txt
> Use this file to discover all available pages before exploring further.

# Open Source

> Open source files available for customization in the K4MB1 Cash Exchange Robbery resource

Most of the core logic in this resource is handled by the bridge. The open source files are provided so you can customize minigames, add hooks for custom systems, and extend the script without touching escrow.

## opensource/client/client.lua

Each robbery step triggers the `projectx-cashexchangerobbery-k4mb1:client:Minigames` callback with the step name.

```lua theme={null}
lib.callback.register('projectx-cashexchangerobbery-k4mb1:client:Minigames', function(Step)
    local p = promise.new()
    if Step == "Ventilation" then
        if not exports['projectx-bridge']:MinigameCheck("lightsout") then p:resolve(false) return Citizen.Await(p) end
        local success = exports["bl_ui"]:WaveMatch(1, {duration = 30000})
        p:resolve(success)
    elseif Step == "Computer" then
        if not exports['projectx-bridge']:MinigameCheck("boii_minigames") then p:resolve(false) return Citizen.Await(p) end
        exports['boii_minigames']:chip_hack({style = 'default', loading_time = 8000, chips = 2, timer = 20000}, function(success)
            p:resolve(success)
        end)
    elseif Step == "Keypad" then
        if not exports['projectx-bridge']:MinigameCheck("bl_ui") then p:resolve(false) return Citizen.Await(p) end
        local success = exports["bl_ui"]:PrintLock(1, {grid = 5, duration = 15000, target = 5})
        p:resolve(success)
    end
    return Citizen.Await(p)
end)
```

<Info>
  You can return `true` unconditionally inside any step block to skip that minigame entirely.
</Info>

The default minigames per step are:

| Step          | Minigame Resource | Function         |
| ------------- | ----------------- | ---------------- |
| `Ventilation` | `bl_ui`           | `WaveMatch`      |
| `Prop`        | `bl_ui`           | `Progress`       |
| `Search`      | `bl_ui`           | `CircleProgress` |
| `Computer`    | `boii_minigames`  | `chip_hack`      |
| `Safe`        | `boii_minigames`  | `safe_crack`     |
| `Keypad`      | `bl_ui`           | `PrintLock`      |

***

## opensource/server/server.lua

### Hooks

<AccordionGroup>
  <Accordion title="SuccessfulStep(source, step)" icon="circle-check">
    Called whenever a player successfully completes a robbery step. Step names are listed in `Config.CashExchangeSteps` inside `config/config.lua`.
  </Accordion>

  <Accordion title="FailedStep(source, step)" icon="circle-xmark">
    Called whenever a player fails a robbery step.
  </Accordion>

  <Accordion title="InitialCheck(Interaction)" icon="shield-check">
    Called before a player can start the robbery. Return `false` to block them.
  </Accordion>

  <Accordion title="RobberyResetHook()" icon="rotate">
    Called whenever the heist resets.
  </Accordion>
</AccordionGroup>
