Skip to content

Welcome messages

Person8880 edited this page Sep 2, 2023 · 12 revisions

Overview

The welcome messages plugin displays custom messages when certain players join the server. It can also display custom messages when certain players leave the server.

Welcome messages will look something like this:

Advert Message

Config

The default config should look something like this:

{
    "Users": {
        "90000001": {
            "Leave": "Bob is off to fight more important battles.",
            "Welcome": {
                "Prefix": "[Oh noes!]",
                "PrefixColour": [ 255, 0, 0 ],
                "Message": "Bob has joined the party!",
                "Colour": [ 255, 255, 255 ]
            }
        },
        "123456": {
            "Leave": "Joe says goodbye!",
            "Welcome": "Have no fear, Joe is here!"
        }
    },
    "MessageDelay": 5,
    "ShowGeneric": false,
    "ShowForBots": false,
    "__Version": "1.4"
}

The file should be called "WelcomeMessages.json" and should be placed in the directory defined as your plugin config directory (default is config://shine/plugins).

Option Description
MessageDelay Sets how many seconds to wait after a client connects before displaying their welcome message.
Users A table that should be indexed by the NS2IDs of the players you want to add messages for. "Welcome" is displayed when they connect, "Leave" is displayed when they disconnect.
ShowGeneric Determines whether to show "Name has joined the game." and "Name has left the game." messages for players with no set join/leave message.
ShowForBots Determines whether to show messages for bots.

Message Format

Messages in the Users table can have one or both of Welcome and Leave messages. These messages may either be strings, which will be displayed in white, or otherwise a table with the following fields:

Option Description
Prefix The prefix text to display (ignored if the message is rich text).
PrefixColour The colour to give the prefix text (ignored if the message is rich text).
Message The main message to display. This can either be a string, or a list of colour/string pairs to define a rich text message.
Colour The colour to give the main message text (ignored if the message is rich text).
ParseEmoji Whether to parse emoji in the message (only applicable if the message is rich text).

Rich Text Messages

When the improved chat plugin is enabled, messages can be defined as a list with more than 2 colours.

For example, the following would show the player's name in yellow with the rest of the text in white:

"Welcome": {
    "Message": [
        [ 255, 255, 255 ],
        "Oh noes! ",
        [ 255, 255, 0 ],
        "PlayerName",
        [ 255, 255, 255 ],
        " has joined."
    ]
}

To add emoji in messages, specify the ParseEmoji flag:

"Welcome": {
    "Message": [
        [ 255, 255, 255 ],
        "Oh noes! ",
        [ 255, 255, 0 ],
        "PlayerName",
        [ 255, 255, 255 ],
        " has joined. :anguished_face:"
    ],
    "ParseEmoji": true
}

This does not require ParseEmojiInChat to be enabled on the improved chat plugin.

Clone this wiki locally