HyperScript
Docs

← All scripts

JoinMessages.hs

Instead of "Steve joined the game" everybody sees one of a handful of lines, picked at random each time. Leaving has its own. Whoever joins is welcomed, with a title if you like, and told how long they were away; somebody new to the server is announced to all, with which player of the server they are.

by HyperScript TeamHyperScript 1.7.3+2 event handlers137 linesjoinleavequitmessageswelcomeserver template
In the script list

Put the file in plugins/HyperScript/scripts and it is live. Or type /hyperscript install joinmessages on your server.

# ==============================================================
#  JoinMessages.hs - join and leave messages with some wit
# ==============================================================
#
# Requires: 1.7.3
# Author: HyperScript Team
# Tags: join, leave, quit, messages, welcome, server template
#
# Instead of "Steve joined the game" everybody sees one of a
# handful of lines, picked at random each time. Leaving has its
# own. Whoever joins is welcomed, with a title if you like, and
# told how long they were away; somebody new to the server is
# announced to all, with which player of the server they are.
#
# Notes
#  - The lines are in joins() and leaves() below. Add your own,
#    take some out, or leave one: with one line it is always
#    that line. %player.name% is the player.
#  - The welcome is "welcome" in the options, shown only to the
#    player who joined. In it and in "first_join", %{_server}% is
#    your server's name and %{_address}% its address, as "name"
#    and "address" say them.
#  - "first_join" is what everybody sees when somebody joins
#    for the very first time, in place of a line from joins().
#    %{_number}% in it is which player of the server they are,
#    counted from when this script was installed. "first_tip"
#    is said to the new player alone.
#  - "welcome_back" is said to somebody who has been here
#    before; %{_away}% is how long they were gone.
#  - With "show_title" the player who joined gets "title" and
#    "subtitle" in the middle of the screen.
#  - With "play_sound" everybody hears "sound" when somebody
#    joins. It is the game's name for a sound.
#  - Put false after "show_joins" or "show_leaves" to say
#    nothing at all when somebody comes or goes.

options:
    name: "MY SERVER"
    address: "play.example.com"
    # What stands in front of the lines for joining and leaving.
    join_sign: "&8[&a+&8] "
    leave_sign: "&8[&c-&8] "
    # Shown to the player who joined, and only to them.
    welcome: "&7Welcome to &6&l%{_server}%&7! &8(%{_address}%)"
    # Shown after it to somebody who has been here before.
    welcome_back: "&7Good to see you again. You were away for &f%{_away}%&7."
    # Shown to everybody when somebody joins for the first time.
    first_join: "&d&lNEW! &f%player.name% &7just joined &6%{_server}% &7for the first time, as player &f#%{_number}%&7. Say hi!"
    # Shown after the welcome to somebody who is new, and only to them.
    first_tip: "&7New here? Have a look around, and ask in chat if you are stuck."
    # In the middle of the screen of the player who joined.
    title: "&6&l%{_server}%"
    subtitle: "&7Welcome, &f%player.name%&7!"
    # What everybody hears when somebody joins.
    sound: "block.note_block.pling"
    show_joins: true
    show_leaves: true
    show_welcome: true
    show_title: true
    play_sound: false

# The lines for somebody joining. One is picked at random.
local function joins():
    return ["&f%player.name% &7hopped in!", \
            "&f%player.name% &7has entered the chat.", \
            "&7A wild &f%player.name% &7appeared!", \
            "&f%player.name% &7just slid into the server.", \
            "&7Look who it is: &f%player.name%&7!", \
            "&f%player.name% &7joined. Hide your diamonds.", \
            "&7Everybody act normal, &f%player.name% &7is here.", \
            "&f%player.name% &7spawned in with questionable intentions.", \
            "&f%player.name% &7is here. The party can start.", \
            "&7Roll out the red carpet for &f%player.name%&7.", \
            "&f%player.name% &7logged in. Productivity is over.", \
            "&7Quick, look busy: &f%player.name% &7just joined.", \
            "&f%player.name% &7fell out of the sky and landed here.", \
            "&7It is a bird, it is a plane, it is &f%player.name%&7!", \
            "&f%player.name% &7has come to mine and chew bubblegum.", \
            "&7Somebody left the door open and &f%player.name% &7walked in."]

# The lines for somebody leaving.
local function leaves():
    return ["&f%player.name% &7dipped!", \
            "&f%player.name% &7has left the building.", \
            "&f%player.name% &7rage quit. Probably.", \
            "&7Poof! &f%player.name% &7is gone.", \
            "&f%player.name% &7went to touch grass.", \
            "&f%player.name% &7vanished into thin air.", \
            "&7And just like that, &f%player.name% &7was gone.", \
            "&f%player.name% &7logged off to get snacks.", \
            "&f%player.name% &7has gone to bed. Maybe.", \
            "&7Bye, &f%player.name%&7. The chests are safe again.", \
            "&f%player.name% &7pulled the plug.", \
            "&f%player.name% &7heard their mum calling.", \
            "&7One fewer: &f%player.name% &7is off.", \
            "&f%player.name% &7left to do their homework. Sure.", \
            "&f%player.name% &7walked off into the sunset.", \
            "&7See you next time, &f%player.name%&7."]

on player join:
    set {_server} to "{@name}"
    set {_address} to "{@address}"
    # Somebody this script has not seen before is new to the server.
    set {_new} to false
    if {%player%.seen_before} is not set:
        set {_new} to true
        add 1 to {joinmessages.players}
    set {_number} to {joinmessages.players}
    if {@show_joins} is true:
        if {_new} is true:
            set join message to "{@first_join}"
        else:
            set {_line} to random item of joins()
            set join message to "{@join_sign}%{_line}%"
    else:
        hide join message
    set {%player%.seen_before} to true
    if {@show_welcome} is true:
        send "{@welcome}"
        if {_new} is true:
            send "{@first_tip}"
        else if {%player%.last_left} is set:
            set {_away} to time since {%player%.last_left}
            send "{@welcome_back}"
    if {@show_title} is true:
        send title "{@title}" with subtitle "{@subtitle}" to player
    if {@play_sound} is true:
        play sound "{@sound}" for all players

on player quit:
    set {%player%.last_left} to now
    if {@show_leaves} is true:
        set {_line} to random item of leaves()
        set quit message to "{@leave_sign}%{_line}%"
    else:
        hide quit message