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

# Client-Side Adapter

## What the Client Adapter Does (V2)

The client-side adapter is responsible for:

* Notifying Doctorjob when a character has loaded (so the script can load diseases/patient state)
* Clearing diseases on revive/respawn (framework-dependent)
* Exposing a **bandana state function** used by transmission/protection logic

### Required behavior

#### 1) Trigger player load

On your framework's "player loaded" / "character selected" event, call:

```lua theme={null}
TriggerServerEvent('mega_doctorjob:loadPlayer')
```

#### 2) Heal all on revive / respawn

On your framework revive/respawn events, call:

```lua theme={null}
TriggerEvent('mega_doctorjob:healAll', true)
```

Some built-in adapters also clear bone damage local caches on revive/respawn (if available in your build).

#### 3) Implement `IsBandanaOn()`

You must provide a global function named `IsBandanaOn()` that returns a boolean.

* Frameworks that expose a synced state can read it directly.
* Otherwise, listen for `Config.bandanaEvent` and store the last known state.

Example pattern:

```lua theme={null}
local bandanaOn = false

RegisterNetEvent(Config.bandanaEvent)
AddEventHandler(Config.bandanaEvent, function(isUp)
    bandanaOn = isUp
end)

function IsBandanaOn()
    return bandanaOn
end
```

You can use any event name you prefer, as long as `IsBandanaOn()` returns the correct current state.
