DarkRP.Player.SetDarkRPVar

From Official DarkRP Wiki
Jump to: navigation, search
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: NewerServer.png
BBCode Link: [b][url=http://wiki.darkrp.com/index.php?title=DarkRP.Player.SetDarkRPVar]Player:SetDarkRPVar[/url][/b]

Examples

DescriptionSet's a Variable called Wallet on the player.
Used onNewerServer.png
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

  • 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.