G.SetGlobalVar

From GMod Wiki

Revision as of 16:57, 7 January 2011 by XThaWolfx (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Function
Syntax SetGlobalVar( Var index, Var value )
Where is this used?
Description:
Similiar to the function Entity:SetNetworkedVar - Sets a networked global var of the types String , Integer , Float , Angle , Boolean , Entity or Vector .
Returns: nil
Part of Library: Global Functions
Realm: NewerShared.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=G.SetGlobalVar]G.SetGlobalVar [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Examples

DescriptionSet a global variable which can be accessed both clientside as serverside
Used onNewerServer.png
Code
SetGlobalVar("Timeleft",10)
OutputNone


DescriptionGet that global variable which we've just set
Used onNewerClient.png
Code
print("Time left: "..GetGlobalVar("Timeleft"))
OutputTime left: 10


Additional Notes

See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox