# Events

Use public events when another resource prefers `TriggerEvent` / `TriggerServerEvent` instead of exports.

These event names are stable strings and are not built with `_e()`. This means they do not change if the resource folder name changes.

## Server Events

### `0r_ambulancejob:server:revivePlayer`

Revives the target player through the normal medical flow.

Recommended from another server resource:

```lua
TriggerEvent("0r_ambulancejob:server:revivePlayer", targetId, {
    source = source,
    reason = "my_resource",
    context = {
        from = "my_resource:server:revive",
    },
    silentGetUp = true,
})
```

If called from a client resource:

```lua
TriggerServerEvent("0r_ambulancejob:server:revivePlayer", targetId, {
    reason = "my_resource",
    context = {
        from = "my_resource:client:revive",
    }
})
```

Supported options: (optional)

* `source` - the player ID or identifier of the action initiator, used for permission checks and logging
* `reason` - a string describing the reason for the revive, used for logging
* `context` - a table with additional context about the revive action, used for logging
* `silentGetUp` - if `true`, the revived player will not play the get-up animation and will be immediately controllable

Notes:

* Client-triggered revive still follows ambulance permission checks.
* The normal medical lifecycle and `MedicalListeners` callbacks still run.

### `0r_ambulancejob:server:setMedicalState`

Forces the target player into a supported medical state.

Accepted states:

* `alive`
* `laststand`
* `dead`

Recommended from another server resource:

```lua
TriggerEvent("0r_ambulancejob:server:setMedicalState", targetId, "dead", {
    source = source,
    reason = "my_resource",
    context = {
        from = "my_resource:server:setDead",
    }
})
```

If called from a client resource:

```lua
TriggerServerEvent("0r_ambulancejob:server:setMedicalState", targetId, "dead", {
    reason = "my_resource",
    context = {
        from = "my_resource:client:setDead",
    }
})
```

Supported options: (optional)

* `source` - the player ID or identifier of the action initiator, used for permission checks and logging
* `reason` - a string describing the reason for the state change, used for logging
* `context` - a table with additional context about the state change, used for logging
* `silentGetUp` - only used when `state = "alive"`, if `true`, the player will not play the get-up animation and will be immediately controllable

Notes:

* Client-triggered state changes require the same facility panel group permission used by the panel admin flow.
* The normal medical lifecycle and `MedicalListeners` callbacks still run.

### `0r_ambulancejob:server:billingPaid`

Marks a facility invoice as paid after a custom billing resource confirms payment.

```lua
TriggerEvent("0r_ambulancejob:server:billingPaid", {
    invoice_id = 12,
    -- or external_invoice_id = "custom-bridge-id"
})
```

Notes:

* This event is intended for server-side billing integrations.
* Client-triggered calls are ignored.
* Paid invoices are deposited into the facility account when `depositPaidInvoicesToFacilityAccount = true`.

## When To Use What

* Use `MedicalListeners` for direct in-resource customization in `modules/medical_listeners/*.lua`.
* Use exports when another resource wants a clean query or function-style action API.
* Use public events when another resource already integrates around `TriggerEvent` / `TriggerServerEvent`.


---

# Agent Instructions: 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://docs.0resmon.org/0resmon/0r-resources/0r-ambulancejob/events.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.
