DarkRP.Player.SetDarkRPVar

From DarkRP
This page refers to DarkRP 2.4.3. This information may be incorrect as of later versions.
Check here for a up-to-date list of functions.
Function
Function name Player:SetDarkRPVar(string Variable, any Value, Entity Target)
Description:
Sets a variable on the player, both clientside and serverside can access this. But only serverside may change it.
Returns: nil
Part of Library: Player
Realm:
BBCode Link: [b][url=http://wiki.darkrp.com/index.php?title=DarkRP.Player.SetDarkRPVar]Player:SetDarkRPVar[/url][/b]

Examples[edit]

DescriptionSet's a Variable called Wallet on the player.
Used on
Code
function SendWallet( ply, Wallet )
	ply:SetDarkRPVar( "money", Wallet )
end
OutputYou can now access the Variable using
ply.DarkRPVars["money"]
or
ply.DarkRPVars.money
on both server and client.


Additional Notes[edit]

  • DarkRPVars can hold Vectors, integers, strings, booleans, Entities, Players and nil
  • This is the ALMOST the same as global variables, however, they are much more efficent, and they can hold unlimited bytes.