getServerIp | Multi Theft Auto: Wiki Skip to content

getServerIp

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 IP of the server the client is currently connected to.

Note

On server-side there is the getServerIpFromMasterServer function, which might return the server IP under certain conditions. You should consider using a third-party service via fetchServerIp (not an MTA function) if the previous function is unreliable for you.

Syntax

getServerIp ( )

Code Examples

client

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

function outputServerIp()
outputChatBox("You are currently connected to ".. getServerIp(true))
end
addCommandHandler("serverIp", outputServerIp)