Jump to content
DcrClub

How to get hostname in serverDZ.cfg

Recommended Posts

Posted (edited)
13 hours ago, DcrClub said:

On server side... not on client

I guess you shall dig in config.

So head up to the: %DZ_SRV%\dta\scrips\3_Game\Client\OnlineServices.c

And explore the file. Nevermind that path contains "Client", server anyway will see that class.

So when mission is online/alive, you shall:

GetServersResultRow serversInfo = OnlineServices.GetCurrentServerInfo();
if (serversInfo) {
	/*
		serversInfo.m_HostPort.ToString()	<- Get Server's Game Port as Integer, converted to String
		serversInfo.m_HostIp();				<- Get Server's Game IPv4 as String
		serversInfo.m_Name					<- Get Server's Name
	*/
}

P.S. To find and write the code I had wasted 10 minutes, why you can't? I don't know, but you will not ever get my help. Have fun.

Edited by Sid Debian
Added code for exmple

Share this post


Link to post
Share on other sites
On 6/18/2024 at 2:42 AM, Sid Debian said:

I guess you shall dig in config.

So head up to the: %DZ_SRV%\dta\scrips\3_Game\Client\OnlineServices.c

And explore the file. Nevermind that path contains "Client", server anyway will see that class.

So when mission is online/alive, you shall:


GetServersResultRow serversInfo = OnlineServices.GetCurrentServerInfo();
if (serversInfo) {
	/*
		serversInfo.m_HostPort.ToString()	<- Get Server's Game Port as Integer, converted to String
		serversInfo.m_HostIp();				<- Get Server's Game IPv4 as String
		serversInfo.m_Name					<- Get Server's Name
	*/
}

P.S. To find and write the code I had wasted 10 minutes, why you can't? I don't know, but you will not ever get my help. Have fun.

The method you mentioned can only be obtained by running it on the client side, if it is on the server side. Return empty

 

  \brief Gets the server address. (from client)
	*/
	proto bool				GetHostAddress( out string address, out int port );
	
	/**
  \brief Gets the server name. (from client)
	*/
	proto owned string		GetHostName();
	
	/**
  \brief Gets the server data. (from client)
	*/
	proto GetServersResultRow GetHostData();

 

Share this post


Link to post
Share on other sites
On 6/19/2024 at 6:53 AM, DcrClub said:

The method you mentioned can only be obtained by running it on the client side, if it is on the server side. Return empty

 


  \brief Gets the server address. (from client)
	*/
	proto bool				GetHostAddress( out string address, out int port );
	
	/**
  \brief Gets the server name. (from client)
	*/
	proto owned string		GetHostName();
	
	/**
  \brief Gets the server data. (from client)
	*/
	proto GetServersResultRow GetHostData();

 

Well I'd searched the dta\scripts.pbo for any clues for parsing the Server.cfg file and didn't found any method for parsing it. The best what do admins can do is only get Integer paramters.

It used to be the method for getting string (and you cold to get even hostname parameter), but it was removed for security reasons in 1.04 - 1.08...

Yet there's no way to grab any kind of server info from server side from server's configs.

That's quite odd and I suggest you to create at the bug tracker the ticket for allowing share that information for the server-side or even client-server sides.

So yes yet there's only one way it through the client side, but maybe you shall try to get all servers and try to filter the server info but I guess that might be useless...

Share this post


Link to post
Share on other sites
On 6/21/2024 at 11:00 PM, Sid Debian said:

Well I'd searched the dta\scripts.pbo for any clues for parsing the Server.cfg file and didn't found any method for parsing it. The best what do admins can do is only get Integer paramters.

It used to be the method for getting string (and you cold to get even hostname parameter), but it was removed for security reasons in 1.04 - 1.08...

Yet there's no way to grab any kind of server info from server side from server's configs.

That's quite odd and I suggest you to create at the bug tracker the ticket for allowing share that information for the server-side or even client-server sides.

So yes yet there's only one way it through the client side, but maybe you shall try to get all servers and try to filter the server info but I guess that might be useless...

Perhaps it is to prevent module developers from stealing rcon's password

Share this post


Link to post
Share on other sites
9 minutes ago, DcrClub said:

Perhaps it is to prevent module developers from stealing rcon's password

Not really. rCon stored inside battleye folder, but admin password that's another story, nevertheless why close all information such as Name and IP address I still have no idea? 

Share this post


Link to post
Share on other sites
37 minutes ago, Sid Debian said:

Not really. rCon stored inside battleye folder, but admin password that's another story, nevertheless why close all information such as Name and IP address I still have no idea? 

I was wrong. It is the management password, which is equivalent to rcon

Share this post


Link to post
Share on other sites
1 hour ago, DcrClub said:

I was wrong. It is the management password, which is equivalent to rcon

It's alright sometimes i seft messed with that ))

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×