View Single Post
Scone
Senior Member
Join Date: Apr 2010
Location: England
Old 04-07-2010 , 13:59   Re: Check server address
Reply With Quote #2

As far as I'm aware, both the port and IP address are server CVARs:

PHP Code:
new Handle:port_cvar FindConVar("hostport");
new 
port GetConVarInt(port_cvar);

new 
Handle:ip_cvar FindConVar("hostip");
new 
String:ip[64];
GetConVarString(ip_cvaripsizeof(ip)); 
To get them in the format you want just use the Format() function:

PHP Code:
new String:srv[64];
Format(srvsizeof(srv), "%s:%d"ipport); 
I haven't tested the above, but I hope it helps!
Scone is offline