GetServerPort: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
Line 5: Line 5:
==Syntax==  
==Syntax==  
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
int getServerPort ( )
int getServerPort (22003 )
</syntaxhighlight>
</syntaxhighlight>



Revision as of 11:27, 16 December 2014

This function retrieves the server's port.

Syntax

int getServerPort (22003 )

Returns

An integer corresponding to the server's port.

Example

This example Sends out the serverPort when you type: /serverport

function outputServerPort ( )
        local serverPort = getServerPort() 
	outputChatBox (" Server Port: "..serverPort.." ") --Output Serverport in Chatbox
end
addCommandHandler ( "serverport", outputServerPort )  --add the command Handler

See Also