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

# Integrations

> Use vrs_permanentid from your own resources: HUDs, scoreboards, admin menus, and reports.

`vrs_permanentid` is designed to be **read-only from the outside**. Any resource can display or log the permanent ID without a hard dependency, by reading the replicated statebag or calling the exports.

## HUDs and scoreboards (recommended)

Statebags replicate automatically. No export call, no server round-trip.

```lua theme={null}
-- client
local pid = Player(GetPlayerServerId(PlayerId())).state.vrs_pid
local name = Player(GetPlayerServerId(PlayerId())).state.vrs_pid_name

if pid then
    print(('My permanent ID is #%d (%s)'):format(pid, name or 'unknown'))
end
```

To render an ID above another player's head, iterate active players and read their statebag:

```lua theme={null}
for _, playerId in ipairs(GetActivePlayers()) do
    local serverId = GetPlayerServerId(playerId)
    local pid = Player(serverId).state.vrs_pid
    -- draw pid above GetPlayerPed(playerId)
end
```

## Admin menus

Use the server exports to resolve IDs both ways, including offline lookups.

```lua theme={null}
-- server
local src = source
local pid = exports.vrs_permanentid:GetPermanentId(src)

-- Reverse: who owns #1042 right now?
local target = exports.vrs_permanentid:GetSourceByPermanentId(1042)
if target then
    TriggerClientEvent('chat:addMessage', target, { args = { 'Admin', 'You are being watched.' } })
end
```

## Offline lookups (reports, bans, ticketing)

Resolve a permanent ID to a stored identifier even if the player is offline:

```lua theme={null}
-- server
local identifier = exports.vrs_permanentid:GetIdentifierByPermanentId(1042)
if identifier then
    -- write a ban / ticket keyed on identifier
end
```

Going the other way:

```lua theme={null}
local pid = exports.vrs_permanentid:GetPermanentIdByIdentifier(citizenid)
```

## Iterating every online player

```lua theme={null}
-- server
for src, pid in pairs(exports.vrs_permanentid:GetAllOnline()) do
    print(('src=%d pid=#%d'):format(src, pid))
end
```

## Depending on the resource

`vrs_permanentid` itself requires [vrs\_bridge](/getting-started/submitting-a-request) v1.2.0+. If your resource wants to hard-require the permanent-id resource, add it to your `fxmanifest.lua`:

```lua theme={null}
dependency 'vrs_permanentid'
```

If you'd rather stay optional, guard your calls:

```lua theme={null}
if GetResourceState('vrs_permanentid') == 'started' then
    local pid = exports.vrs_permanentid:GetPermanentId(src)
    -- ...
end
```
