GetServerName: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
 
m (Reverted edits by Diki (talk) to last revision by AlexTMjugador)
 
(7 intermediate revisions by 5 users not shown)
Line 1: Line 1:
__NOTOC__  
__NOTOC__  
This function returns a string containing the server's name.
{{Server function}}
This function retrieves the server's name.


==Syntax==  
==Syntax==  
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
returnType getServerName ( )
string getServerName ( )
</syntaxhighlight>  
</syntaxhighlight>
 
===Required Arguments===
*'''None'''


===Returns===
===Returns===
Line 15: Line 12:


==Example==  
==Example==  
This example creates a console command that outputs the server's name the the chatbox.
This example creates a console command that outputs the server's name to the chatbox.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
function outputServerName ( )
function outputServerName ( )
outputChatBox ( getServerName() )
outputChatBox ( getServerName( ) )
end
end



Latest revision as of 21:23, 21 December 2016

This function retrieves the server's name.

Syntax

string getServerName ( )

Returns

A string containing the server's name.

Example

This example creates a console command that outputs the server's name to the chatbox.

function outputServerName ( )
	outputChatBox ( getServerName( ) )
end

-- Add console command 'getServerName'
addCommandHandler ( "getServerName", outputServerName )

See Also