Get Servers IP - 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 Servers IP (
/showthread.php?tid=163756)
Get Servers IP -
Mike Garber - 28.07.2010
Is there a function, or a plugin, include that adds a function to get the servers ip?
could be used like this;
new serverip = GetServerIP;
or something?
Re: Get Servers IP -
selten98 - 28.07.2010
why would you want it?
Re: Get Servers IP -
Mike Garber - 28.07.2010
Does It matter?
I could protect my gamemode a little more, im thinking of scripting one from scratch.
I could make the server shutdown, or lock itself if it doesn't have the correct ip :P
Re: Get Servers IP -
mihaitza55 - 28.07.2010
Dude, how about
/serverip -> SendClientMessage(playerid, COLOR_GREEN, "This server`s IP address is .......");
and look at the server ip and type it instead of .........
Re: Get Servers IP -
Mike Garber - 28.07.2010
Quote:
Originally Posted by mihaitza55
Dude, how about
/serverip -> SendClientMessage(playerid, COLOR_GREEN, "This server`s IP address is .......");
and look at the server ip and type it instead of .........
|
Sorry, that was not what I was going to use it for.. I'm not a n00b on this, you know.
Re: Get Servers IP -
Shadow™ - 28.07.2010
pawn Код:
#define SERVER_IP "ip"
format(string,sizeof(string),"%s",SERVER_IP);
Re: Get Servers IP -
mihaitza55 - 28.07.2010
Quote:
Originally Posted by Shadow™
pawn Код:
#define SERVER_IP "ip"
format(string,sizeof(string),"%s",SERVER_IP);
|
GG it actualy works :O
Re: Get Servers IP -
Mike Garber - 28.07.2010
Quote:
Originally Posted by Shadow™
pawn Код:
#define SERVER_IP "ip"
format(string,sizeof(string),"%s",SERVER_IP);
|
Now that is not what I asked for... I'm still not a n00b.
I asked if there was an include or something that added a function to get
the servers IP adress, so I can use It to check If It matches with my define, if not the server will lock down.
A protection, kind of.
like;
pawn Код:
#define SERVER_IP "xxx.xxx.xxx.xxx"
public OnGameModeInit()
{
new serverip = GetServerIP;
if(serverip==SERVER_IP){
// proceed
}else{
// lockdown
}
}
I just made this code on the forums here as an example, so it doesn't look very beautiful xD
Re: Get Servers IP -
Vince - 28.07.2010
Then you will have to add 'bind xxx.xxx.xxx.xxx' in your server.cfg.
Then use GetServerVarAsString to retrieve it.
Re: Get Servers IP -
Mike Garber - 28.07.2010
Oh, well that wasn't easy to remove was it?... Please spank me in the forhead..