game.GetIPAddress

From Garry's Mod
Jump to: navigation, search
 game.GetIPAddress( )

Description

Returns the public IP address and port of the current server. This will return the IP/port that you are connecting through when ran clientside.

NOTE Returns "0.0.0.0:0" in singleplayer.
NOTE SERVER: Returns "0.0.0.0:port" when called too early, including in GM:InitPostEntity and GM:Initialize. This bug seems to only happen the first time a server is launched, and will return the correct value after switching maps. Workaround pending.

Returns

string

The IP address and port in the format "x.x.x.x:x"
Personal tools
Navigation