Garry's Mod Wiki


  string Player:GetPData( string key, any default = nil )


Returns a Persistent Data key-value pair from the SQL database. (sv.db when called on server, cl.db when called on client)

Internally uses the sql library. See util.GetPData for cases when the player is not currently on the server.

This function internally uses Player:UniqueID, which can cause collisions (two or more players sharing the same PData entry). It's recommended that you don't use it. See the related wiki page for more information.
PData is not networked from servers to clients!


1 string key
Name of the PData key
2 any default = nil
Default value if PData key doesn't exist.


1 string
The data in the SQL database or the default value given.


Reads the key "money" from player 1's PData

Entity( 1 ):GetPData( "money", 0 )