SetServerName: Difference between revisions

From Onset Developer Wiki
Created page with "{{Info|Function|Server|1.0}} {{FuncDescription|__EDIT_ME__}} {{FuncSyntax|SetServerName(ServerName)}} {{FuncParameters}} {{FuncParam|ServerName|__EDIT_ME__}} {{FuncReturnV..."
 
No edit summary
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Info|Function|Server|1.0}}
{{Info|Function|Server|1.0}}


{{FuncDescription|__EDIT_ME__}}
{{FuncDescription|Sets the display name of the server.}}


{{FuncSyntax|SetServerName(ServerName)}}
{{FuncSyntax|SetServerName(ServerName)}}


{{FuncParameters}}
{{FuncParameters}}
{{FuncParam|ServerName|__EDIT_ME__}}
{{FuncParam|ServerName|The name of the server.}}


{{FuncReturnValue|__EDIT_ME__}}
{{FuncReturnValue|This function doesn't return a value.}}


== Example ==
== Example ==
__EDIT_ME__
<syntaxhighlight lang="Lua>
local servername = "Onset Server"
local max = GetMaxPlayers()
AddEvent("OnPlayerJoin", function()
SetServerName("[" .. GetPlayerCount() .. "/" .. max .. "] " .. servername)
end)
</syntaxhighlight>


{{RelatedFunctions}}
{{RelatedFunctions}}
__EDIT_ME__
* [[GetServerName]]

Latest revision as of 14:21, 26 June 2021

SetServerName

Type: Function
Context: Server
Introduced: v1.0

Description

Sets the display name of the server.

Syntax

SetServerName(ServerName)

Parameters

  • ServerName
    The name of the server.

Return Value

  • This function doesn't return a value.

Example

local servername = "Onset Server"
local max = GetMaxPlayers()
AddEvent("OnPlayerJoin", function()
	SetServerName("[" .. GetPlayerCount() .. "/" .. max .. "] " .. servername)
end)

See also