This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

How to get server ip now


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
- Billy The Kid -
Member
Join Date: Oct 2006
Old 01-21-2010 , 17:03   How to get server ip now
Reply With Quote #1

Ok, I am a little late, but something was changed with one of last CS updates... Anyway, when get_user_ip(0, ... is used resulting string is "loopback" instead of server IP:port. Is there a work-around to get server IP or AMXX coders have made some changes in getting server IP I'm not aware of?
__________________
- Billy The Kid - is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 01-21-2010 , 17:33   Re: How to get server ip now
Reply With Quote #2

You can try doing this:
Code:
new szIP[ 64 ]; get_cvar_string( "ip", szIP, 63 ); // with port: new szPort[ 16 ]; szPort[ 0 ] = ":"; get_cvar_string( "port", szPort[ 1 ], 14 ); add( szIP, 63, szPort );
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 01-21-2010 , 17:34   Re: How to get server ip now
Reply With Quote #3

You can still retrieve 'ip' and 'port" server cvar.
__________________
Arkshine is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 01-21-2010 , 17:43   Re: How to get server ip now
Reply With Quote #4

PHP Code:
new szIP64 ];
new 
iPos get_cvar_string"ip"szIP63 );
szIPiPos++ ] = ':';
get_cvar_string"port"szIPiPos ], 14 ); 
__________________
Bugsy is offline
- Billy The Kid -
Member
Join Date: Oct 2006
Old 01-21-2010 , 19:44   Re: How to get server ip now
Reply With Quote #5

Thx for the idea, but it doesn't work the job... Getting localhost instead of IP... Any other suggestion?

@Exolent
Playing on RAWR? See you there... Ichy Show! aka. Whatever
__________________

Last edited by - Billy The Kid -; 01-21-2010 at 19:48.
- Billy The Kid - is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 01-21-2010 , 19:46   Re: How to get server ip now
Reply With Quote #6

You can try this:
Code:
new szIP[ 64 ]; get_user_ip( !is_dedicated_server( ), szIP, 63 );
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
- Billy The Kid -
Member
Join Date: Oct 2006
Old 01-21-2010 , 21:00   Re: How to get server ip now
Reply With Quote #7

That's the same thing...
__________________
- Billy The Kid - is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 01-21-2010 , 21:59   Re: How to get server ip now
Reply With Quote #8

sv_lan 0 ?
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
- Billy The Kid -
Member
Join Date: Oct 2006
Old 01-22-2010 , 08:19   Re: How to get server ip now
Reply With Quote #9

Yeah, of course... Why? Do you get an IP with all of the suggested ideas?
__________________
- Billy The Kid - is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 01-22-2010 , 08:42   Re: How to get server ip now
Reply With Quote #10

You can always use sockets module w\ ipchicken.com or one of those other whatsmyip sites to determine ip. Not as easy as get_user_ip() but it'll work.
__________________
Bugsy is offline
Reply



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 05:06.


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