Jump to content
  • 0

Is it possible to append "Player Online Count" back of the Server Name?


Alexandrite

Question


  • Group:  Members
  • Topic Count:  21
  • Topics Per Day:  0.01
  • Content Count:  54
  • Reputation:   0
  • Joined:  02/19/14
  • Last Seen:  

due to Ragexe Client now no longer show Player Online Count, and I don't know which server or client that i should fix

If anyone know how to mod the client to show the Player Online Count after server name, I'm appreciate it.

 

But if it have to do with the source, right now i'm at here

src/char/char_logif.cpp

around the line 777

I change from

    //memcpy(WFIFOP(login_fd,60), charserv_config.server_name, 20);

    Sql_Query(sql_handle, "SELECT count(`char_id`) FROM `char` WHERE `online`>0");

    char result[50];
    sprintf(result, "%s(%d)", charserv_config.server_name, sql_handle);
    memcpy(WFIFOP(login_fd,60), result, 20);

But it won't work and I don't know how to make it happend , can anyone help me please?

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  22
  • Reputation:   5
  • Joined:  02/22/22
  • Last Seen:  

On 10/23/2023 at 2:14 PM, Alexandrite said:

due to Ragexe Client now no longer show Player Online Count, and I don't know which server or client that i should fix

If anyone know how to mod the client to show the Player Online Count after server name, I'm appreciate it.

 

But if it have to do with the source, right now i'm at here

src/char/char_logif.cpp

around the line 777

I change from

    //memcpy(WFIFOP(login_fd,60), charserv_config.server_name, 20);

    Sql_Query(sql_handle, "SELECT count(`char_id`) FROM `char` WHERE `online`>0");

    char result[50];
    sprintf(result, "%s(%d)", charserv_config.server_name, sql_handle);
    memcpy(WFIFOP(login_fd,60), result, 20);

But it won't work and I don't know how to make it happend , can anyone help me please?

I understand that displaying the current online status can be extremely helpful. However, it’s possible that you might be looking in the wrong place. Perhaps you could try the following suggestion:

/src/login/loginclif.cpp
method logclif_auth_ok

find this :
 

		WFIFOW(fd,header+n*size+4) = ntows(htons(ch_server[i].port)); // [!] LE byte order here [!]
		memcpy(WFIFOP(fd,header+n*size+6), ch_server[i].name, 20);
		WFIFOW(fd,header+n*size+26) = login_get_usercount( ch_server[i].users );

 



replace for:

		WFIFOW(fd,header+n*size+4) = ntows(htons(ch_server[i].port)); // [!] LE byte order here [!]
		
		// Concatenate the server name with the online user count [Hergel]
		char buffer[20];
		int users = ch_server[i].users;
		snprintf(buffer, 20, "%s (%d)", ch_server[i].name, users);
		memcpy(WFIFOP(fd, header+n*size+6), buffer, 20);

		WFIFOW(fd,header+n*size+26) = login_get_usercount( ch_server[i].users );

 

Edited by Hergel
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  21
  • Topics Per Day:  0.01
  • Content Count:  54
  • Reputation:   0
  • Joined:  02/19/14
  • Last Seen:  

2 hours ago, Hergel said:

I understand that displaying the current online status can be extremely helpful. However, it’s possible that you might be looking in the wrong place. Perhaps you could try the following suggestion:

/src/login/loginclif.cpp
method logclif_auth_ok

find this :
 

		WFIFOW(fd,header+n*size+4) = ntows(htons(ch_server[i].port)); // [!] LE byte order here [!]
		memcpy(WFIFOP(fd,header+n*size+6), ch_server[i].name, 20);
		WFIFOW(fd,header+n*size+26) = login_get_usercount( ch_server[i].users );

 



replace for:

		WFIFOW(fd,header+n*size+4) = ntows(htons(ch_server[i].port)); // [!] LE byte order here [!]
		
		// Concatenate the server name with the online user count [Hergel]
		char buffer[20];
		int users = ch_server[i].users;
		snprintf(buffer, 20, "%s (%d)", ch_server[i].name, users);
		memcpy(WFIFOP(fd, header+n*size+6), buffer, 20);

		WFIFOW(fd,header+n*size+26) = login_get_usercount( ch_server[i].users );

 

OMG! and I thought I already lost hope, Thank you so much for finding it and clarify to me, it help me so much ^ ^

It worked now, like a Magic! I'm so appreciated your support!!!

Edited by Alexandrite
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...