Garry's Mod Wiki

game.GetIPAddress

string 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.

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

Issue Tracker: 3001

Returns

1 string
The IP address and port in the format "x.x.x.x:x"

Page Links


Special Pages


Wikis

?

Render Time: 37ms

DB GetPage 4
Generate Html 3
SaveChanges (1) 14
Render Body 0
Render Sidebar 13