getServerIpFromMasterServer | Multi Theft Auto: Wiki Skip to content

getServerIpFromMasterServer

Client-side
Server-side
Shared

This page is incomplete! Help wanted!

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


This function returns the remote address as reported by the first master server that provides this value.

Note

It might take a while until the master server responds to the query sent out by the server, which in turn means that this function will not return any IP until the information has been received.

Note

On client-side there is the getServerIp function, in case you need the remote address of the currently connected server.

Note

If you want to retrieve the server IP address from the server configuration, then you should use getServerConfigSetting("serverip") , but this might yield only "auto" if the default value was used.

Syntax

getServerIpFromMasterServer ( )

Code Examples

server

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

function outputServerIp()
outputChatBox(getServerIpFromMasterServer())
end
addCommandHandler("serverIp", outputServerIp)