Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

Players Online Channel

Experienced Elementalist
Joined
Oct 14, 2015
Messages
293
Reaction score
86
Hello area, today I will leave a simple code for you, and a public code but not much explored.
This code will show the total number of players online on the channel.
Remembering I won't give support, because it's something simple.
Let's start.

Open: MMatchChannel.h

Search: struct MCHANNELLISTNODE

Added:
Code:
int nOnlinePlayers;

Open: MMatchServer_Channel.cpp

Search: MMatchServer::ChannelList

Added:
Code:
pNode->nOnlinePlayers = (int)m_Objects.size();

Open: ZGameClient.cpp

Search: ZGameClient::OnChannelList

Added:
Code:
MLabel* pLabel = (MLabel*)pResource->FindWidget("OnlinePlayersLabel");
char szText[128];
sprintf(szText, "Players Online : %d", pNode->nOnlinePlayers);
pLabel->SetText(szText);

From within the game interface you add this:
PHP:
    <LABEL item="OnlinePlayersLabel" parent="ChannelListFrame">
        <FONT>FONTa10_O2Wht</FONT>
        <TEXTCOLOR>
            <R>255</R>
            <G>255</G>
            <B>255</B>
        </TEXTCOLOR>
        <BOUNDS>
            <X>10</X>
            <Y>395</Y>
            <W>300</W>
            <H>24</H>
        </BOUNDS>
        <TEXT></TEXT>
    </LABEL>

Screenshot:

2FB20r - Players Online Channel - RaGEZONE Forums


Credits to: @
jetman82
 

Attachments

You must be registered for see attachments list
Last edited:
Newbie Spellweaver
Joined
May 3, 2014
Messages
47
Reaction score
30
Thanks,
This will include hidden staff members, you got to filter them out
 
I'm retired, I'm already
Banned
Joined
Oct 3, 2011
Messages
832
Reaction score
155
For those who want to use it as a staff tool, vip or other degrees, just add an 'if'.
Code:
		if (ZGetMyInfo()->IsAdminGrade())
		{
                   MLabel* pLabel = (MLabel*)pResource->FindWidget("OnlinePlayersLabel");
                   char szText[128];
                   sprintf(szText, "Players Online : %d", pNode->nOnlinePlayers);
                   pLabel->SetText(szText);
		}

I had raised this idea a long time ago in a project which never came to light, I only did it so that it would be displayed in the lobby because the designer thought of putting it there.

Gn9f99 - Players Online Channel - RaGEZONE Forums
 

Attachments

You must be registered for see attachments list
Last edited:
Experienced Elementalist
Joined
Oct 14, 2015
Messages
293
Reaction score
86
Thanks,
This will include hidden staff members, you got to filter them out

The code is free to edit as you see fit.
I just posted the way it was done without any modification.
:dancemental:



For those who want to use it as a staff tool, vip or other degrees, just add an 'if'.
Code:
        if (ZGetMyInfo()->IsAdminGrade())
        {
                   MLabel* pLabel = (MLabel*)pResource->FindWidget("OnlinePlayersLabel");
                   char szText[128];
                   sprintf(szText, "Players Online : %d", pNode->nOnlinePlayers);
                   pLabel->SetText(szText);
        }

I had raised this idea a long time ago in a project which never came to light, I only did it so that it would be displayed in the lobby because the designer thought of putting it there.

Gn9f99 - Players Online Channel - RaGEZONE Forums

It is not recommended to use ZGetMyInfo in this type of function.
There are correct ways to do it, just think.
 

Attachments

You must be registered for see attachments list
I'm retired, I'm already
Banned
Joined
Oct 3, 2011
Messages
832
Reaction score
155
The code is free to edit as you see fit.
I just posted the way it was done without any modification.
:dancemental:





It is not recommended to use ZGetMyInfo in this type of function.
There are correct ways to do it, just think.

That's just an example... I wouldn't use it because I've already tried it, this is just to give you an idea.
 
Back
Top