Garry's Mod Wiki

Player:UniqueID

number Player:UniqueID()

Description

This function has collisions, where more than one player has the same UniqueID. It is highly recommended to use Player:AccountID, Player:SteamID or Player:SteamID64 instead, which are guaranteed to be unique to each player.

Returns a 32 bit integer that remains constant for a player across joins/leaves and across different servers. This can be used when a string is inappropriate - e.g. in a database primary key.

In Singleplayer, this function will always return 1.

Returns

1 number
The player's Unique ID

Example

Gets the Unique ID of a player.

Entity( 1 ):UniqueID()
Output: Something like 1592073762

Example

Functional equivalent of this function.

local ply = Entity( 1 ) local uniqueid = util.CRC( "gm_" .. ply:SteamID() .. "_gm" ) print( uniqueid )
Output: Something like 1592073762

Page Links


Special Pages


Wikis

?

Render Time: 34ms

DB GetPage 3
Generate Html 5
SaveChanges (1) 10
Render Body 0
Render Sidebar 12