Server port
#1

Hi , i want to make a system to check if the ports is 7777 for example or not , if not the gamemode will close connection, is that possible ?
Reply
#2

You cant get the actual port, but you can do something close too what you want with ip:

1] edit your server.cfg, add this line:
Код:
bind <yourserverip>
2] Add this code, run the function to retrieve the ip from server.cfg
Код:
stock GetServerIP()
{
	static
		sIp[16]
	;
	GetServerVarAsString("bind", sIp, sizeof(sIp));
	return sIp;
}
So then you can just do something like
Код:
if( !strcmp(GetServerIP( ), "***.***.***.***" )) { print( "Your IP isn't correct !" ); }
(where ***.***.***.*** would be the ip you expect to find in the server.cfg)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)