Garry's Mod Wiki

Player:SetPData

boolean Player:SetPData( string key, any value )

Description

Writes a Player Data key-value pair to the SQL database. (sv.db when called on server, cl.db when called on client)

Internally uses the sql.

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!

Arguments

1 string key
Name of the PData key
2 any value
Value to write to the key (must be an SQL valid data type, such as a string or integer)

Returns

1 boolean
Whether the operation was successful or not

Example

Sets the key "money" from player 1's PData to 100

Entity( 1 ):SetPData( "money", 100 )

Page Links


Special Pages


Wikis

?

Render Time: 26ms

DB GetPage 4
Generate Html 6
SaveChanges (1) 8
Render Body 0
Render Sidebar 6