> For the complete documentation index, see [llms.txt](https://trident-cas.sabn.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://trident-cas.sabn.xyz/games/crash.md).

# Crash

All events are prefixed with `crash:` unless they are global game events.

### Game States

The game cycles through three states:

1. `waiting`: The betting period (6 seconds). Users can place or update bets.
2. `in-game`: The multiplier starts at 1.00x and increases until it crashes.
3. `after`: The period immediately after a crash (3 seconds) before the next round.

***

#### Client → Server

#### `crash:bet`

Places a bet for the upcoming round.

* **Payload**:

  ```json
  {
    "betAmount": 100.50,
    "autoCashout": 2.50
  }
  ```
* **Notes**: `autoCashout` is optional (0 or undefined for manual cashout).

#### `crash:cashout`

Triggers a manual cashout during the `in-game` state.

* **Payload**: None

#### `crash:status`

Requests the current game state.

* **Payload**: None

#### `crash:history`

Requests the last 20 crash multipliers.

* **Payload**: None

#### `crash:bet-count`

Requests the number of players in the current round.

* **Payload**: None

***

#### Server → Client

#### `crash:loop`

Continuous updates for the game timer or multiplier.

* **Payload (Waiting/After)**:

  ```json
  {
    "status": "waiting",
    "timer": 4500
  }
  ```
* **Payload (In-Game)**:

  ```json
  {
    "multiplier": 1.45,
    "counter": 2500
  }
  ```
* **Payload (Crash)**:

  ```json
  {
    "multiplier": 5.67,
    "counter": 8500,
    "gameOver": true
  }
  ```

#### `crash:bet`

Response to a bet attempt.

* **Payload**:

  ```json
  {
    "status": true
  }
  ```

  *OR*

  ```json
  {
    "status": false,
    "message": "Insufficient balance"
  }
  ```

#### `crash:cashout`

Response to a manual cashout attempt.

* **Payload**:

  ```json
  {
    "status": true
  }
  ```

#### `crash:cashouts`

Broadcasted when any user cashes out.

* **Payload**:

  ```json
  {
    "cashout": {
      "1715632000000": {
        "avatar": "https://...",
        "username": "Player1",
        "multiplier": 2.45
      }
    }
  }
  ```

#### `crash:status`

Current game status.

* **Payload**:

  ```json
  {
    "status": "in-game"
  }
  ```

#### `crash:history`

Last 20 multipliers.

* **Payload**:

  ```json
  {
    "history": [1.5, 4.2, 1.05, 12.5, ...]
  }
  ```

#### `crash:bet-count`

Total players in the round.

* **Payload**:

  ```json
  {
    "count": 15
  }
  ```

#### `crash:bet-amount` (User specific)

Sent to the betting user to confirm their total wager.

* **Payload**:

  ```json
  {
    "amount": 100.50
  }
  ```

#### `balance-change` (User specific)

Sent when a user's balance changes due to a bet or win.

* **Payload**:

  ```json
  {
    "change": -100.50
  }
  ```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://trident-cas.sabn.xyz/games/crash.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
