player.SetPData

From GMod Wiki

Jump to: navigation, search
Function
Syntax player.SetPData( String PData, VarValue )
Description:
Sets the player's data.
Returns: nil
In Object: Player
Available On:
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=Player.SetPData]Player.SetPData [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Examples

DescriptionSets the player's data Name to Minge Baggerson.
Used on
Code
function setdata(ply)
ply:SetPData("Name", "Minge Baggerson")
//Use:
//ply:GetPData("Name")
//to get the player's data
end
OutputSets the player's data Name to Minge Baggerson.


DescriptionGives the player 10 dollars.
Used on
Code
function GiveMoney(ply)
ply:SetPData("money", ply:GetPData("money") + 10 )
end
OutputNone.


Additional Notes

  • If it is used on the client, it will always error.
  • This is saved to the server SQLite database (sv.db in garrysmod folder), so if you need to permanently store something for a player (e.g. play time on the server), use this function.

See Also

Personal tools