G.SetGlobalVar

From GMod Wiki

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