Raised This Month: $ Target: $400
 0% 

Getting server IP..


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
pdoubleopdawg
Senior Member
Join Date: Aug 2005
Old 09-11-2005 , 07:25   Getting server IP..
Reply With Quote #1

I was trying
get_cvar_string("ip",output,len)
That just returns localhost..

So, how to get the servers ip?
pdoubleopdawg is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 09-11-2005 , 14:43  
Reply With Quote #2

Were you testing it on a LAN by chance?
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
Xanimos
Veteran Member
Join Date: Apr 2005
Location: Florida
Old 09-11-2005 , 14:45  
Reply With Quote #3

try
Code:
get_localinfo("net_address",Ip,20);
Xanimos is offline
Send a message via AIM to Xanimos Send a message via MSN to Xanimos
pdoubleopdawg
Senior Member
Join Date: Aug 2005
Old 09-11-2005 , 17:19  
Reply With Quote #4

No, it's not on LAN.
suicid3. Here is my code.
Code:
public server_info() {     get_players(players,num)     for(i = 0; i <= num; i++)         {         new player = players[i]         if(is_user_connected(player)) {             new hudmessage[256],hostname[101],port[10],serverip[21]             get_localinfo("serverip",serverip,20)             get_cvar_string("hostname",hostname,100)             get_cvar_string("port",port,9)             set_hudmessage (50,50,200,0.50, 0.01,2,6.0,12.0,0.1,0.2,5)             format(hudmessage,255,"%s ^nIP: %s:%s",hostname,serverip,port)             show_hudmessage(player,hudmessage)         }     } }
it shows up as
IP: :1337
pdoubleopdawg is offline
Xanimos
Veteran Member
Join Date: Apr 2005
Location: Florida
Old 09-12-2005 , 00:03  
Reply With Quote #5

Use get_localinfo("net_address",.....)
Xanimos is offline
Send a message via AIM to Xanimos Send a message via MSN to Xanimos
pdoubleopdawg
Senior Member
Join Date: Aug 2005
Old 09-12-2005 , 00:27  
Reply With Quote #6

I solved this problem by removing the port.

get_cvar_string("net_address",serverip,20)
and using strings to input that into the HUD message.

Thanks suicid3.
pdoubleopdawg is offline
Mr. Pink
Junior Member
Join Date: Sep 2005
Location: Cali
Old 09-14-2005 , 18:46   confused
Reply With Quote #7

wait im not as smart as u guys.
how do i get.
my server ip.
and how do i keep.
the ip from not.
changing??..
__________________
Peace <3 Alex.!
Mr. Pink is offline
Send a message via AIM to Mr. Pink Send a message via MSN to Mr. Pink
Xanimos
Veteran Member
Join Date: Apr 2005
Location: Florida
Old 09-14-2005 , 19:47  
Reply With Quote #8

Umm if your talking about a dedicated server on your comp this isnt what you need. But there is no way to keep a static IP when you have a dynamic IP.
One exception: Sometimes with a router your IP wont change because there is a constant connection. However if you turn your router off or it gets unplugged your IP should change.
Xanimos is offline
Send a message via AIM to Xanimos Send a message via MSN to Xanimos
Mr. Pink
Junior Member
Join Date: Sep 2005
Location: Cali
Old 09-14-2005 , 21:27  
Reply With Quote #9

haha well.
with me.
my server changes ip.
i got a router.
the beg of the ip dosent change.
but the ending does
like after the :
sometimes it dont matter.
but sometimes ppl cant.
get on it
__________________
Peace <3 Alex.!
Mr. Pink is offline
Send a message via AIM to Mr. Pink Send a message via MSN to Mr. Pink
{NM}Jason
AMX Mod X Beta Tester
Join Date: Mar 2004
Location: Texas
Old 09-14-2005 , 22:11  
Reply With Quote #10

i've been looking for a script to check the internal and external Ip of my hosted game server any one have a script made that can do this made yet ?
__________________
http://forums.alliedmods.net/showthr...396#post451396
Quote:
Originally Posted by BAILOPAN View Post
Shortly after posting that image, Jason crushed the truck into a ball with his hands, and tossed it over his shoulder.
{NM}Jason is offline
Send a message via ICQ to {NM}Jason Send a message via AIM to {NM}Jason Send a message via MSN to {NM}Jason Send a message via Yahoo to {NM}Jason
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 14:22.


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