ShadowIdUnique
Permanent, never-changing numeric IDs for every player on your server.
- Version
- 3.0.1
- Resource
- SF-UID
Overview#
FiveM server IDs are recycled on every restart, which makes them useless for logs, sanctions or player records. SF-UID assigns each player a permanent numeric ID tied to their licence and kept in the database. That ID never changes, whatever happens to the server. Eighteen exports let you use it anywhere in your own resources.
Permanent IDs
A player keeps the same number across restarts, reconnections and character changes.
Framework detection
Works with ESX, QBCore, QBX and QS, and falls back to standalone mode.
Automatic table creation
The shadow_idunique table is created on first start; there is no SQL file to import.
Five languages
Translation files in English, French, Spanish, German and Italian.
Discord logs
Customisable embeds for connections and disconnections.
Rate limiting
Configurable request throttling to protect the database.
Eighteen exports
Read, assign, search and audit permanent IDs from your own scripts.
SF-Admin bridge
The admin menu displays the permanent ID next to each connected player.
Dependencies#
| Resource | Required | Why |
|---|---|---|
oxmysql | Yes | Stores the permanent IDs. |
OneSync | Yes | Declared as a hard dependency in the manifest. |
Lua 5.4 | Yes | Enabled through lua54 in the manifest. |
Installation#
- Drop the SF-UID folder into your server resources directory.
- Add the ensure lines below to your server.cfg, keeping oxmysql first.
- Adjust config.lua if you want a different default language or rate limit.
- Restart the server. The table is created automatically on the first start.
ensure oxmysql ensure SF-UID
Configuration#
| Key | Default | What it does |
|---|---|---|
Config.DefaultLanguage | 'en' | Language used when a player has no preference. |
Config.AvailableLanguages | {'en','fr','es','de','it'} | The languages the resource is allowed to load. |
Config.RateLimit | โ | Maximum number of ID requests accepted per player and per interval. |
Config.Webhooks | โ | Discord webhooks for connections and disconnections. |
Commands#
| Command | Permission | What it does |
|---|---|---|
/setplayerid [serverId] [permanentId] | Admin | Manually force the permanent ID of a player. |
/removeplayerid [serverId] | Admin | Remove the permanent ID of a player. |
/locale_set [code] | Admin | Change the active language at runtime. |
/locale_test | Admin | Print every translation key to check a language file. |
/locale_debug | Admin | Show which language file is loaded and any missing keys. |
Exports#
| Signature | Side | Returns |
|---|---|---|
exports['SF-UID']:GetMyPlayerId() | client | Returns the permanent ID of the local player. |
exports['SF-UID']:GetPlayerPermanentId(source) | server | Returns the permanent ID of a player, from cache. |
exports['SF-UID']:GetPlayerPermanentIdAsync(source) | server | Reads the permanent ID straight from the database. |
exports['SF-UID']:SetPlayerPermanentId(source, id) | server | Assigns a specific permanent ID to a player. |
exports['SF-UID']:RemovePlayerPermanentId(source) | server | Removes the permanent ID of a player. |
exports['SF-UID']:ForceAssignPlayerId(source) | server | Forces the assignment of a new ID immediately. |
exports['SF-UID']:HasPermanentId(source) | server | Returns whether a player already has an ID. |
exports['SF-UID']:GetAllPlayerIds() | server | Returns every permanent ID recorded in the database. |
exports['SF-UID']:GetAllConnectedPlayersInfo() | server | Returns the information of every connected player, IDs included. |
exports['SF-UID']:GetPlayerInfo(source) | server | Returns the full record of a player. |
exports['SF-UID']:GetPlayerIdByFiveMId(fivemId) | server | Finds the permanent ID matching a FiveM identifier. |
exports['SF-UID']:GetFiveMIdByPermanentId(id) | server | Finds the FiveM identifier matching a permanent ID. |
exports['SF-UID']:FindPlayerByName(name) | server | Searches a player by name. |
exports['SF-UID']:GetPlayerHistoryAsync(id) | server | Returns the connection history of a player. |
exports['SF-UID']:GetIdStats() | server | Returns statistics: total IDs, last assigned, and more. |
exports['SF-UID']:GetCurrentLanguage() | shared | Returns the active language code. |
exports['SF-UID']:SetLanguage(code) | shared | Changes the active language. |
exports['SF-UID']:GetTranslation(key) | shared | Returns a translated string by key. |
Database#
| Table | Contents |
|---|---|
shadow_idunique | Mapping between FiveM identifiers and permanent IDs, with the assignment date. |