GetGameVersion: Difference between revisions

From Onset Developer Wiki
No edit summary
No edit summary
 
(4 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{Info|Function|Server & Client|1.0}}
{{Info|Function|Server & Client|1.0}}


{{FuncDescription|__EDIT_ME__}}
{{FuncDescription|Returns the server/ client's game version}}


{{FuncSyntax|GetGameVersion()}}
{{FuncSyntax|GetGameVersion()}}
Line 8: Line 8:
{{FuncNoParam}}
{{FuncNoParam}}


{{FuncReturnValue|__EDIT_ME__}}
{{FuncReturnValue|Returns the server/ client's game version as an integer.}}


== Example ==
== Example ==
__EDIT_ME__
'''Client:'''
<syntaxhighlight lang="Lua">
local function OnPackageStart()
    AddPlayerChat("Your game version is: "..GetGameVersion())
end
AddEvent("OnPackageStart", OnPackageStart)
</syntaxhighlight>
 
'''Server:'''
<syntaxhighlight lang="Lua">
local function OnPlayerJoin(player)
AddPlayerChat(player, "This server runs on game version: "..GetGameVersion())
end
AddEvent("OnPlayerJoin", OnPlayerJoin)
</syntaxhighlight>


{{RelatedFunctions}}
{{RelatedFunctions}}
__EDIT_ME__
* [[GetGameVersionString]]

Latest revision as of 20:13, 28 September 2020

GetGameVersion

Type: Function
Context: Server & Client
Introduced: v1.0

Description

Returns the server/ client's game version

Syntax

GetGameVersion()

Parameters

  • This function has no parameters.

Return Value

  • Returns the server/ client's game version as an integer.

Example

Client:

local function OnPackageStart()
    AddPlayerChat("Your game version is: "..GetGameVersion())
end
AddEvent("OnPackageStart", OnPackageStart)

Server:

local function OnPlayerJoin(player)
	AddPlayerChat(player, "This server runs on game version: "..GetGameVersion())
end
AddEvent("OnPlayerJoin", OnPlayerJoin)

See also