> For the complete documentation index, see [llms.txt](https://project-07.gitbook.io/project_07-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://project-07.gitbook.io/project_07-docs/scripts/project07-namechecker-v3/exports.md).

# Exports

## Project07 NameChecker v3 — Exports & Events Reference

This resource exposes one server export and a few server/client events used to trigger and enforce the in-game character name lock.

***

### `ValidateCharacterName` (server export)

The main entry point. Call this from **any other server-side resource** right after a character has been selected/loaded, to check the loaded character's name against the player's FiveM display name.

```lua
exports['Project_07_NameChecker']:ValidateCharacterName(source, firstname, lastname)
```

| Param       | Type     | Description                                                                                 |
| ----------- | -------- | ------------------------------------------------------------------------------------------- |
| `source`    | `number` | The player's server ID. Always resolve this server-side — never trust a client-supplied ID. |
| `firstname` | `string` | The loaded character's first name.                                                          |
| `lastname`  | `string` | The loaded character's last name.                                                           |

**Behavior:**

* If `Project07.EnableCharacterLock` is `false`, does nothing.
* If the player is on the static bypass list or in the DB whitelist, clears any lock and returns.
* If `firstname + lastname` matches the player's current FiveM name, clears any lock and returns.
* Otherwise, freezes the player, shows the NUI lock screen, logs to Discord (if enabled), and starts a server-side kick timer (`Project07.CharacterLockKickAfter` seconds).

***

### `project07:validateCharacter` (server event)

Client-triggerable alternative to the export, for multicharacter systems that only run character selection on the client.

```lua
-- from client-side Lua, after the character has spawned in
TriggerServerEvent('project07:validateCharacter', firstname, lastname)
```

The server always resolves `source` from the network event itself — it is never taken from the event arguments, so a player cannot trigger a check on behalf of anyone else.

***

### Automatic framework hooks

When `Project07.AutoDetectFramework = true` (default), the resource listens for these events directly — no export/event call needed:

| Framework | Event                          | Notes                                                                                                         |
| --------- | ------------------------------ | ------------------------------------------------------------------------------------------------------------- |
| QBCore    | `QBCore:Server:PlayerLoaded`   | Reads `Player.PlayerData.source` and `Player.PlayerData.charinfo`.                                            |
| Qbox      | `QBCore:Server:OnPlayerLoaded` | Fallback for builds that only pass `source`; pulls charinfo via `exports.qbx_core:GetPlayer(src)`.            |
| ESX       | `esx:playerLoaded`             | Tries `xPlayer.get('firstName'/'lastName')`, then `xPlayer.variables`, then `xPlayer.getName()` as fallbacks. |

All three are registered with `RegisterNetEvent` before `AddEventHandler`. This is required because these events can arrive over the network — a bare `AddEventHandler` with no matching `RegisterNetEvent` is rejected by FiveM with a `"was not safe for net"` warning/block. If you see that warning for a custom event you add yourself, the fix is the same: call `RegisterNetEvent('your:event')` once before adding the handler.

If your framework/multichar setup doesn't match any of the three above, set `Project07.AutoDetectFramework = false` and call the export or event manually from your own character-load code.

***
