AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Getting server IP.. (https://forums.alliedmods.net/showthread.php?t=17892)

pdoubleopdawg 09-11-2005 07:25

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

So, how to get the servers ip?

XxAvalanchexX 09-11-2005 14:43

Were you testing it on a LAN by chance?

Xanimos 09-11-2005 14:45

try
Code:
get_localinfo("net_address",Ip,20);

pdoubleopdawg 09-11-2005 17:19

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

Xanimos 09-12-2005 00:03

Use get_localinfo("net_address",.....)

pdoubleopdawg 09-12-2005 00:27

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.

Mr. Pink 09-14-2005 18:46

confused
 
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??..

Xanimos 09-14-2005 19:47

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.

Mr. Pink 09-14-2005 21:27

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

{NM}Jason 09-14-2005 22:11

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 ?


All times are GMT -4. The time now is 14:22.

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