Skip to content

[CUSTOM] How to announce to server when a player logs in #665

Answered by zach2good
Freetate asked this question in Q&A
Discussion options

You must be logged in to vote

If you want to announce to the whole server whenever someone logs in for the first time (excluding regular zoning):

Somewhere around here:
https://github.com/LandSandBoat/server/blob/base/src/map/utils/charutils.cpp#L826

        if (zoning == 2)
        {
            // Send message to all logged in players
            zoneutils::ForEachZone([&](CZone* PZone) {
                PZone->ForEachChar([&](CCharEntity* PLoggedInChar) {
                    PLoggedInChar->pushPacket(new CChatMessagePacket(PLoggedInChar, CHAT_MESSAGE_TYPE::MESSAGE_SYSTEM_1,
                        fmt::format("{} has logged into the server.", PChar->GetName())));
                });
            });
        }

EDIT:…

Replies: 4 comments 9 replies

Comment options

You must be logged in to vote
1 reply
@Freetate
Comment options

Comment options

You must be logged in to vote
4 replies
@helixhamin
Comment options

@Freetate
Comment options

@Freetate
Comment options

@Freetate
Comment options

Comment options

You must be logged in to vote
2 replies
@Freetate
Comment options

@helixhamin
Comment options

Answer selected by zach2good
Comment options

You must be logged in to vote
2 replies
@cocosolos
Comment options

@justinray1982
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
6 participants