> For the complete documentation index, see [llms.txt](https://jiffyjrdevelopment.gitbook.io/jiffyjrdevelopmentdocs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://jiffyjrdevelopment.gitbook.io/jiffyjrdevelopmentdocs/jiffy-jr-development-docs/jiffy-minigames/games/safecrack.md).

# Safecrack

<figure><img src="https://1591991476-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPIxZnZDGzl5v0n1I2OKQ%2Fuploads%2F27qEAIKsaYjZi0bLOk86%2Fimage.png?alt=media&amp;token=c5800086-8d47-4bcb-8a04-326a23b9aac0" alt=""><figcaption></figcaption></figure>

A safe dial the player spins with `A`/`D` keys or mouse drag. Each hidden notch has a proximity glow that strengthens as the dial approaches it. Land on a notch to lock it in. Find all notches to open the safe.

## Options

| Option       | Type   | Default    | Description                                                           |
| ------------ | ------ | ---------- | --------------------------------------------------------------------- |
| `difficulty` | string | `'medium'` | Preset. Affects notch tolerance (how precisely the player must stop). |
| `pins`       | number | `4`        | Number of hidden notches to find.                                     |
| `time`       | number | `60`       | Time limit in seconds.                                                |
| `speed`      | number | `1.0`      | Dial rotation speed multiplier for key-driven input.                  |

## Difficulty tolerance

| Difficulty | Notch tolerance (degrees) |
| ---------- | ------------------------- |
| easy       | ±22°                      |
| medium     | ±15°                      |
| hard       | ±10°                      |
| insane     | ±6°                       |

## Example

```lua
-- Bank vault, requires precision:
exports['jiffy-minigames']:Safecrack({
    difficulty = 'hard',
    pins       = 6,
    time       = 90,
}, function(success)
    if success then
        TriggerServerEvent('bank:server:openVault')
    end
end)
```

## Notes

* The glow cue around the notch gets more intense as the dial gets closer. At `insane` difficulty the tolerance is narrow enough that players must use mouse drag for fine control.
* The dial resets direction after each notch is found.
