Administration

ShadowIdUnique

Permanent, never-changing numeric IDs for every player on your server.

Version
3.0.1
Resource
SF-UID
Version 3.0.1 Resource SF-UID Frameworks ESX ยท QBCore ยท QBX ยท QS ยท Standalone Bundled languages 5 Store page View

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#

ResourceRequiredWhy
oxmysqlYesStores the permanent IDs.
OneSyncYesDeclared as a hard dependency in the manifest.
Lua 5.4YesEnabled through lua54 in the manifest.

Installation#

  1. Drop the SF-UID folder into your server resources directory.
  2. Add the ensure lines below to your server.cfg, keeping oxmysql first.
  3. Adjust config.lua if you want a different default language or rate limit.
  4. Restart the server. The table is created automatically on the first start.
server.cfg
ensure oxmysql
ensure SF-UID

Configuration#

KeyDefaultWhat 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#

CommandPermissionWhat it does
/setplayerid [serverId] [permanentId]AdminManually force the permanent ID of a player.
/removeplayerid [serverId]AdminRemove the permanent ID of a player.
/locale_set [code]AdminChange the active language at runtime.
/locale_testAdminPrint every translation key to check a language file.
/locale_debugAdminShow which language file is loaded and any missing keys.

Exports#

SignatureSideReturns
exports['SF-UID']:GetMyPlayerId()clientReturns the permanent ID of the local player.
exports['SF-UID']:GetPlayerPermanentId(source)serverReturns the permanent ID of a player, from cache.
exports['SF-UID']:GetPlayerPermanentIdAsync(source)serverReads the permanent ID straight from the database.
exports['SF-UID']:SetPlayerPermanentId(source, id)serverAssigns a specific permanent ID to a player.
exports['SF-UID']:RemovePlayerPermanentId(source)serverRemoves the permanent ID of a player.
exports['SF-UID']:ForceAssignPlayerId(source)serverForces the assignment of a new ID immediately.
exports['SF-UID']:HasPermanentId(source)serverReturns whether a player already has an ID.
exports['SF-UID']:GetAllPlayerIds()serverReturns every permanent ID recorded in the database.
exports['SF-UID']:GetAllConnectedPlayersInfo()serverReturns the information of every connected player, IDs included.
exports['SF-UID']:GetPlayerInfo(source)serverReturns the full record of a player.
exports['SF-UID']:GetPlayerIdByFiveMId(fivemId)serverFinds the permanent ID matching a FiveM identifier.
exports['SF-UID']:GetFiveMIdByPermanentId(id)serverFinds the FiveM identifier matching a permanent ID.
exports['SF-UID']:FindPlayerByName(name)serverSearches a player by name.
exports['SF-UID']:GetPlayerHistoryAsync(id)serverReturns the connection history of a player.
exports['SF-UID']:GetIdStats()serverReturns statistics: total IDs, last assigned, and more.
exports['SF-UID']:GetCurrentLanguage()sharedReturns the active language code.
exports['SF-UID']:SetLanguage(code)sharedChanges the active language.
exports['SF-UID']:GetTranslation(key)sharedReturns a translated string by key.

Database#

TableContents
shadow_iduniqueMapping between FiveM identifiers and permanent IDs, with the assignment date.

Good to know#

Prefer GetPlayerPermanentId in hot paths: it reads the cache, whereas the Async variant queries the database each time.
IDs are assigned in order of first connection, so the lowest numbers belong to your oldest players.