RealDocs

APlayerState::ShouldBroadCastWelcomeMessage

function Engine Since 4.0
#include "GameFramework/PlayerState.h"
Access: public Specifiers: virtualENGINE_API

Description

Returns true if the engine should broadcast a welcome or farewell message for this player. The base implementation returns false for bots and in standalone (non-network) games.

Caveats & Gotchas

  • Override this in your game if you want to suppress messages for specific player types (e.g. hide spectator join messages from all other players).
  • The bExiting parameter allows you to differentiate the logic — for example, you might always broadcast leave messages but only broadcast join messages under certain conditions.

Signature

ENGINE_API virtual bool ShouldBroadCastWelcomeMessage(bool bExiting = false);

Parameters

Name Type Description Default
bExiting bool True when checking for a player-left message; false for a player-entered message. false

Return Type

bool

Example

Suppress welcome messages for spectators C++
bool AMyPlayerState::ShouldBroadCastWelcomeMessage(bool bExiting)
{
    if (IsOnlyASpectator())
    {
        return false;
    }
    return Super::ShouldBroadCastWelcomeMessage(bExiting);
}

Version History

Introduced in: 4.0

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.