Get IP of the Server - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Get IP of the Server (
/showthread.php?tid=173698)
Get IP of the Server -
DeathOnaStick - 03.09.2010
Hey!
One (easy) question: How can I get the IP of the Server, where the Sa-mp Server is running on? (So 'my' Ip, when i run the server)
Thank you.
Re: Get IP of the Server -
<Weponz> - 03.09.2010
Well..
If your server/any server is online,when you click to press connect look closer you will see a IP looks something like this " 111.11.111.11:7777 " thats the IP
Or if you are home hosting goto
www.whatismyip.com/ and it will show your your PC IP..
If that fails ****** it..
Re: Get IP of the Server -
DeathOnaStick - 03.09.2010
I know... =P. I wanted to know how i can get this in a script, thats why i put it into scripting discussion. I need to put the IP's that run my script into a Database, thats why i need to get them.
Re: Get IP of the Server -
<Weponz> - 03.09.2010
Quote:
Originally Posted by DeathOnaStick
I know... =P. I wanted to know how i can get this in a script, thats why i put it into scripting discussion. I need to put the IP's that run my script into a Database, thats why i need to get them.
|
Well if your with ServerFFS the logs have the IP's..
Re: Get IP of the Server -
Calgon - 03.09.2010
You can use the cfg bind feature.
https://sampwiki.blast.hk/wiki/Server.cfg
Re: Get IP of the Server -
DeathOnaStick - 03.09.2010
Quote:
Originally Posted by Calgon
|
Hmm... Isn't there an other way? I need to have every IP, not just the one's that use the bind-feature in server.cfg. Is there no other way?
Re: Get IP of the Server -
Vince - 03.09.2010
I don't think so. To my knowledge, the only option to get the ip the server is running on, is by using GetServerVarAsString, but this requires the bind identifier to be set, like Calgon said.
Re: Get IP of the Server -
DeathOnaStick - 03.09.2010
I could access over HTTP() to a php-site, that uses
PHP код:
$ip=@$REMOTE_ADDR;
to get the IP, that connects, so if i would connect over the script, it would return the Server-IP, wouldn't it? Do you think this would work? I don't see any point why it shouldn't, but i have no more time today to test it.
Btw: 600th post
Re: Get IP of the Server -
Gamer_Z - 04.09.2010
Yes you can. I actually did it and it works, just print out tje ip with print(""); (not ' ' !) and then 'download' the printed text with pawn, ex mysite.com/ip.php
Код:
//ip.php
<?php
print("$_SERVER[REMOTE_ADDR]");
?>