getServerPort | Multi Theft Auto: Wiki Skip to content

getServerPort

Client-side
Server-side
Shared

Manual Review Required

Please finish this page using the corresponding Old Wiki article. Go to Contribution guidelines for more information.


This function retrieves the server's port.

Syntax

int getServerPort ( )

Returns

  • int: value

An integer corresponding to the server's port.

Code Examples

shared

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