Player.SetPData

From GMod Wiki

Jump to: navigation, search
Function
Syntax player:SetPData( String PData, Var Value )
Description:
Sets a player's persistent data value.
Returns: nil
In Object: Player
Realm: NewerShared.png
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 a player's persistent data value Name to Minge Baggerson.
Used onNewerServer.png
Code
function setdata(ply)
   ply:SetPData("Name", "Minge Baggerson")
 
   /* Use:
 
   ply:GetPData("Name")
 
   to retrieve the persistent data. */
end
OutputThe player's persistent data value Name will be "Minge Baggerson".


DescriptionGives a player 10 dollars.
Used onNewerServer.png
Code
function GiveMoney(ply)
   ply:SetPData("money", ply:GetPData("money") + 10 )
end
OutputN/A


Additional Notes

See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox