Silent Join/Leave for Staff Members toggle

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out our Wiki for downloads and any other information about Skript!

Status
Not open for further replies.

ItsMCB

Member
May 20, 2018
46
1
8
23
www.vexel.media
The goal of this script is to let staff members toggle their silent join/leave function. When on, normal players will not be notified when staff members who have this toggled on join or leave. When off, it alerts everyone like every other player. I'm really not sure what's wrong with this. I think the fact that I haven't slept in 24 hours might be messing with my mental functionality. Thanks in advance :emoji_slight_smile:

Code:
on first join:
    execute console command "/mvtp %player% Spawn"
    execute console command "/warp rules %player%"

on join:
    set join message to ""
    wait 1 tick
    send player title "&bVexel Games" with subtitle "Welcome back, %player%"
    make player execute command "/motd"
    set tab header to "{@bar}%nl%&bVexel Games" and footer to "&lVexelGames.mcpro.io%nl%&3» &7Balance &f/bal%nl%{@bar}" for player
    {staffchat.%uuid of player%} is not set
    set {staffchat.%uuid of player%} to false

on join:
    if {_silentjoin::%player%} is false:
        wait 1 tick
        set join message to ""
        broadcast "Hi %player%!!!"
        stop
on quit:
    if {_silentjoin::%player%} is false:
        wait 1 tick
        set quit message to ""
        broadcast "Cya %player%!!!"
        stop

command /silentjoin [<text>]:
    aliases: /sj
    permission: {@silentjoin}
    permission message: "{@prefix} &cNo permission."
    trigger:
        send "Activated." to player #Testing purposes only.
        if arg 1 is "on":
            set {_silentjoin::%player%} to true
            send "True %player%" to player
        if arg 1 is "off":
            set {_silentjoin::%player%} to false
            send "False %player%" to player
        else if arg 1 is not set:
            if {_silentjoin::%player%} is false:
                set {_silentjoin::%player%} to true
                send "True and on" to player               
            else if {_silentjoin::%player%} is true:
                set {_silentjoin::%player%} to false
                send "False and off" to player
        else:
            send "{@prefix} &cUnknown argument"
 
You mustn't use "_" at the start of the variable if you want to use it also somewhere else.
Change variable to:
Code:
{silentjoin::%player%}
Also I think you forgot to set join message to nothing on join and on leave when {silentjoin::%player%} is true or not set.
Code:
on join:
    set join message to ""
    if {_silentjoin::%player%} is false:
        wait 1 tick
        broadcast "Hi %player%!!!"
        stop
Then, I would recommend you not to use booleans true and false but instead use true and deleted or false and deleted.
 
Status
Not open for further replies.