Get IP of the Server
#1

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.
Reply
#2

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..
Reply
#3

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.
Reply
#4

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..
Reply
#5

You can use the cfg bind feature.

https://sampwiki.blast.hk/wiki/Server.cfg
Reply
#6

Quote:
Originally Posted by Calgon
Посмотреть сообщение
You can use the cfg bind feature.

https://sampwiki.blast.hk/wiki/Server.cfg
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?
Reply
#7

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.
Reply
#8

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
Reply
#9

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]");
?>
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)