TPG.Util.GetPData(ply, key, default)📋 Has LDoc👁️ 0 viewsUpdated 1 month ago
Description
Read a persistent per-player value. This is GMod's PData, so it lives in the server's sv.db keyed by SteamID and survives map changes and restarts. It is where a player's own choices go -- their loadout, their armor -- as opposed to their lifetime record, which is a file so that a leaderboard can see players who aren't connected (see tpg.stats). Every key is prefixed with TPG_ so the gamemode can never collide with another addon's PData on the same server. PData stores strings. The value comes back as a number if it looks like one, which is what lets the callers store an armor id and get an armor id back rather than "3". else default.
Parameters
| Name | Type | Description |
|---|---|---|
ply | Player | |
key | string | Key, without the TPG_ prefix. |
default? | any | Returned when nothing is stored. |
Returns
| Type | Description |
|---|---|
any | The stored value as a number where possible, else a string, |
Examples
No examples available.
Used In
No usages found in the codebase.