Raised This Month: $ Target: $400
 0% 

Get Server Ip


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
K.K.Lv
Veteran Member
Join Date: Aug 2008
Location: GameFolder
Old 08-18-2012 , 11:28   Get Server Ip
Reply With Quote #1

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)); }
__________________
QQ:116268742
K.K.Lv is offline
Send a message via MSN to K.K.Lv
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 18:34.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode