Skip to main content

setForwardMessages

Enables or disables message forwarding to scripts.

It allows you to control the messages that Verza sends to players in the chat. By default, Verza will send all messages to the chat, but if you want to implement custom logic for the messages, you can set the status parameter to true. This will prevent Verza from forwarding the messages to the chat, so that you can handle them using your own custom logic.

This method can be useful in a variety of situations, such as when you want to filter out certain types of messages or create your own chat moderation system.

note

When enabled, the onChat event will still be triggered, but the message will not be forwarded to the chat.

Syntax

engine.setForwardMessages(status);

Parameters

NameTypeDescription
statusbooleanA boolean value that controls message forwarding to scripts. Default is false.

Example

engine.setForwardMessages(true);

engine.events.on('onChat', (message, playerId) => {
console.log('Chat message received from player ' + playerId + ': ' + message);
});

Available on: Websocket Server