Player.SetPData
From GMod Wiki
Function | |
Syntax | player:SetPData( String PData, Var Value ) |
Description: | |
Sets a player's persistent data value. | |
Returns: | nil |
In Object: | Player |
Realm: | |
BBCode Link: | [b][url=http://wiki.garrysmod.com/?title=Player.SetPData]Player.SetPData [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] |
Examples
Description | Gives a player 10 dollars. |
---|---|
Used on | |
Code | function GiveMoney(ply) ply:SetPData("money", ply:GetPData("money") + 10 ) end |
Output | N/A |
Additional Notes
- This is saved to the server SQLite database (sv.db or cl.db in the garrysmod base folder, depending on the environment used), so if you need to permanently store something for a player (e.g. play time on the server), use this function.
- If used serverside, data will be saved in the server's sv.db
- If used clientside, it will be saved in the player's cl.db
- You cannot access Persistent Data saved clientside from the sever. The same is true vice versa.