Get Servers IP
#1

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

why would you want it?
Reply
#3

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

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

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

pawn Код:
#define SERVER_IP "ip"

format(string,sizeof(string),"%s",SERVER_IP);
Reply
#7

Quote:
Originally Posted by Shadow™
Посмотреть сообщение
pawn Код:
#define SERVER_IP "ip"

format(string,sizeof(string),"%s",SERVER_IP);
GG it actualy works :O
Reply
#8

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

Then you will have to add 'bind xxx.xxx.xxx.xxx' in your server.cfg.
Then use GetServerVarAsString to retrieve it.
Reply
#10

Oh, well that wasn't easy to remove was it?... Please spank me in the forhead..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)