Solved Staff Chat.

  • 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!

Category: Skript Command.

Suggested name: Staff Chat.

Spigot/Skript Version: 1.14

What I want:

Hey :emoji_slight_smile:

Today I am wondering how to make a staff chat so when you do /staffchat toggle it will turn it on the first time and off the second. This would have all the chat messages you do while it's on go to ONLY the online staff!

Permission: admin.chat

Permission Message: Sorry, you do not have enough permissions!

Thanks,

- TheCringleYT


Ideas for commands: /staffchat toggle

Ideas for permissions: admin.chat

When I'd like it by:
Less than 3 days!
 
Untested.
Code:
function contains(list: objects, check: object) :: boolean:
    loop {_list::*}:
        if loop-value is {_check}:
            return true
    return false
    
    
on join:
    if player has permission "admin.chat":
        if contains({server:staff::*}, player) = false:
            add player to {server:staff::*}
            
on quit:
    if player has permission "admin.chat":
        if contains({server:staff::*}, player) = true:
            remove player from {server::staff::*}
    
command /sc [<text>]:
    permission: admin.chat
    permission message:&cYou are not authorized to execute this command.
    trigger:
        if arg-1 is set:
            send (uncolored arg-1) to {server:staff::*}
        else:
            send "&e/sc message" to player
 
This is what I came up with.
code_language.skript:
on join:
    {staffchat.%uuid of player%} is not set
    set {staffchat.%uuid of player%} to false

command /staffchat:
    permission: admin.chat
    permission message: &cSorry, you do not have enough permissions!
    trigger:
        if {staffchat.%uuid of player%} is true:
            set {staffchat.%uuid of player%} to false
            message "&cStaff chat has been toggled off."
        else if {staffchat.%uuid of player%} is false:
            set {staffchat.%uuid of player%} to true
            message "&aStaff chat has been toggled on."
        else:
            set {staffchat.%uuid of player%} to true
            message "&aStaff chat has been toggled on."

on chat:
    {staffchat.%uuid of player%} is true
    loop chat recipients:
        loop-value does not have permission "admin.chat"
        remove loop-value from chat recipients
    set chat format to "&a(Staff)&r %chat format%"
 
  • Like
Reactions: Zabrid
It says:
(image attached will show you)

how do i resolve this. I am using a custom version of skript because i am testing on minehut so ya
 

Attachments

  • Help.PNG
    Help.PNG
    44.7 KB · Views: 227
Sorta necro but here is a modified version of AsuDev's skript for you:
Code:
on join:
    {staffchat.%uuid of player%} is not set
    set {staffchat.%uuid of player%} to false
 
command /staffchat:
    permission: admin.chat
    permission message: &cSorry, you do not have enough permissions!
    trigger:
        if {staffchat.%uuid of player%} is true:
            set {staffchat.%uuid of player%} to false
            message "&cStaff chat has been toggled off."
        else if {staffchat.%uuid of player%} is false:
            set {staffchat.%uuid of player%} to true
            message "&aStaff chat has been toggled on."
        if else:
            set {staffchat.%uuid of player%} to true
            message "&aStaff chat has been toggled on."
 
on chat:
    {staffchat.%uuid of player%} is true
    loop chat recipients:
        loop-value does not have permission "admin.chat"
        remove loop-value from chat recipients
    set chat format to "&a(Staff)&r %chat format%"

also untested (also why tf is your skript plugin complaining about line 21 there is no else in line 21 lmao)
 
Sorta necro but here is a modified version of AsuDev's skript for you:
Code:
on join:
    {staffchat.%uuid of player%} is not set
    set {staffchat.%uuid of player%} to false
 
command /staffchat:
    permission: admin.chat
    permission message: &cSorry, you do not have enough permissions!
    trigger:
        if {staffchat.%uuid of player%} is true:
            set {staffchat.%uuid of player%} to false
            message "&cStaff chat has been toggled off."
        else if {staffchat.%uuid of player%} is false:
            set {staffchat.%uuid of player%} to true
            message "&aStaff chat has been toggled on."
        if else:
            set {staffchat.%uuid of player%} to true
            message "&aStaff chat has been toggled on."
 
on chat:
    {staffchat.%uuid of player%} is true
    loop chat recipients:
        loop-value does not have permission "admin.chat"
        remove loop-value from chat recipients
    set chat format to "&a(Staff)&r %chat format%"

also untested (also why tf is your skript plugin complaining about line 21 there is no else in line 21 lmao)
You may be on a different version of skript and/or minecraft.