# nova\_deathscreen

NOVA Framework death and respawn system. Handles player death, bleedout, and hospital respawn with configurable timers and costs.

## Features

* **Death Screen** — Custom NUI overlay when player dies
* **Bleedout Timer** — Configurable time before forced respawn (default 5 min)
* **Respawn Timer** — Minimum wait before player can respawn (default 10s)
* **Hospital Respawn** — Respawn at nearest hospital with cost
* **Weapon Display** — Shows the weapon that killed the player (Portuguese names)
* **Death Animation** — Configurable death and last-stand animations

## Configuration

Edit `config.lua`:

```lua
DeathConfig = {
    RespawnTime = 10,              -- Seconds before respawn button appears
    BleedoutTime = 300,            -- Seconds before forced respawn (5 min)
    RespawnCost = 500,             -- Cost to respawn at hospital
    RespawnHealth = 100,           -- Health on respawn
    RespawnKey = 38,               -- Key to respawn (38 = E)

    Hospitals = {
        { coords = vector3(340.0, -1396.0, 32.5), label = 'Pillbox Hospital' },
        { coords = vector3(-449.0, -340.0, 34.5), label = 'Mount Zonah' },
        -- More hospitals...
    },

    DeathAnim = {
        dict = 'dead',
        clip = 'dead_a',
    },

    LastStandAnim = {
        dict = 'missfinale_c1',
        clip = 'yourbetrayal_plyr_writhe',
    },

    -- Weapon display names: configure mapping in config (weapon hash → display name)
    DefaultWeaponName = 'Desconhecida',
}
```

### Configuration Options

| Option          | Type   | Default | Description                            |
| --------------- | ------ | ------- | -------------------------------------- |
| `RespawnTime`   | number | `10`    | Seconds before respawn is available    |
| `BleedoutTime`  | number | `300`   | Seconds until forced respawn           |
| `RespawnCost`   | number | `500`   | Cash cost to respawn at hospital       |
| `RespawnHealth` | number | `100`   | Health after respawn                   |
| `RespawnKey`    | number | `38`    | Control ID for respawn key (E)         |
| `Hospitals`     | table  | —       | Hospital locations for respawn         |
| `WeaponNames`   | table  | —       | Weapon hash to Portuguese name mapping |

## How It Works

1. Player health reaches 0 → death state is triggered
2. Last-stand animation plays, then death animation
3. NUI death screen appears showing weapon that killed the player
4. Timer counts down from `BleedoutTime`
5. After `RespawnTime` seconds, respawn button becomes available
6. Player respawns at nearest hospital and is charged `RespawnCost`
7. If bleedout timer expires, automatic respawn occurs

## Dependencies

* **nova\_core** — Player data, money system
* **nova\_notify** — Notifications
* **oxmysql** — Database operations

## Notes

* Players in death state cannot move, use inventory, or interact
* EMS/ambulance players can revive before the timer expires (via `nova_ambulancejob`)
* Respawn cost is deducted from cash; if insufficient, the cost is waived
* The death screen NUI uses a dark theme with red accents
