Hi all, I'm a new on SourceMod.
and this is a simple snippet to get server ip.
I have been try to type "ip" in server console
and the result is
Code:
"ip" = "localhost"
- Overrides IP for multihomed hosts
so I try to type "hostip"
result:
Code:
"hostip" = "989727350" ( def. "" )
- Host game server ip
so I make this code convert into a ip type
Code:
stock GetServerIp(String:ip[], maxlen)
{
new Handle:hHostIp = FindConVar("hostip");
new iHostIp = GetConVarInt(hHostIp);
return Format(ip, maxlen, "%d.%d.%d.%d", ((iHostIp & 0xFF000000) >>0x18), ((iHostIp & 0x00FF0000)>>0x10), ((iHostIp & 0x0000FF00)>>0x8), (iHostIp & 0x000000FF));
}
__________________