# Exports & integrations

ID cards, custom multicharacter and character deletion.

## Before you start

These exports are optional. Use them to connect Wolfden Remember Me to your other resources. All of them are **server-only**; players cannot call them. Keep the resource folder named `wd_rememberme`, and make sure it is started before resources that call its exports.

## ID cards

Call this from your ID card script once for each player the card is shown to. The viewer then remembers the holder under the name printed on the card:

```lua
exports.wd_rememberme:RememberFromId(viewerSource, holderSource, {
    name = ('%s %s'):format(card.firstname, card.lastname), -- required
    dob = card.birthdate,                                    -- optional
    nationality = card.nationality,                          -- optional
})
```

Pass the details **as printed on the card**, so a fake ID saves the fake name.

| Situation | Result |
| --- | --- |
| The viewer has not remembered the holder | A new memory: the card name as the alias, and `ID: DOB … · nationality` as the note |
| The viewer already remembers the holder | Their own alias is kept. `ID: name · DOB … · nationality` is added to the note once |
| The holder's face is covered or disguised | Nothing is saved |
| The players are further apart than `Config.IdCardDistance`, or in different routing buckets | Nothing is saved |

The viewer sees *You remembered this person from their ID.* or *Their ID details were added to your memory.*

The `ID:` and `DOB` wording comes from `idCard` and `idDob` in your [locale file](#/docs/wd_rememberme/configuration?section=translations). It is written into the note when the card is shown, so changing it later does not rewrite existing notes.

The export returns `false` straight away if the input is invalid, and `true` once the check has started. It never waits for the holder's clothing check, so it is safe to call from any thread. The name follows the same rules as an alias: up to 64 characters, with no control characters or `~`. A date of birth or nationality that breaks those rules is left out. Showing a card repeatedly is rate-limited per holder.

## Character deletion

Memories are not removed when a character is deleted. Call this from your character deletion flow to remove both the deleted character's own memories and everyone else's memories of them:

```lua
exports.wd_rememberme:DeleteCharacterData(citizenid) -- ESX: the charN:identifier value
```

Pass the framework's own character ID, without any prefix. Returns `true` when the memories were deleted, or `false` if the ID is invalid or the resource has not finished starting.

## Custom multicharacter

Wolfden Remember Me follows the standard framework events, and also checks every player's character and routing bucket every half second. Most multicharacter resources need nothing extra.

| Framework | Character loaded | Logout |
| --- | --- | --- |
| Qbox, QBCore | `QBCore:Server:PlayerLoaded` | `QBCore:Server:OnPlayerUnload` |
| ESX | `esx:playerLoaded` | `esx:playerLogout` |

If your multicharacter does not trigger these, call the lifecycle exports instead:

```lua
-- Before unloading a character, while its old identity still exists:
exports.wd_rememberme:SetCharacterUnavailable(source)

-- After the new character has fully loaded:
exports.wd_rememberme:CharacterAvailable(source)

-- After any other custom change to who the player is:
exports.wd_rememberme:InvalidateCharacter(source)
```

`SetCharacterUnavailable` stops the old character being used while it logs out. Loading a different character clears it automatically; if your flow loads the **same** character again without the standard event, call `CharacterAvailable`.

## How characters are identified

| Framework | Character ID |
| --- | --- |
| Qbox, QBCore | `PlayerData.citizenid` |
| ESX | `xPlayer.getIdentifier()` |

IDs are stored with the framework's name in front, such as `qbox:ABC12345`, and are never sent to players. Changing `Config.Framework` later does not move existing memories to the new prefix.

If your ESX multicharacter returns the same identifier for every character, edit `Framework.character` in `bridge/server.lua` to return a character-specific ID. Never fall back to the account license; that would give every character on the account one shared book.
