Solved Toggleable 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!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

SaltyPotata

Member
May 26, 2020
17
0
0
25
Hello. I want players to toggle their chat (no messages from players) so they can't see the chat. If they untoggle they can see the chat again. Any ideas how to do this?
 
try this
Code:
on chat:
    cancel event
    set {_name} to ""
    if coloured prefix of player is set:
        set {_name} to "%coloured prefix of player%"
    set {_name} to "%name%%player%"
    if coloured suffix of player is set:
        set {_name} to "%name%%coloured suffix of player%"
    loop all players:
        if {chat.disable::%uuid of loop-player%} is not set:
            send "{_name}&8: &7%message%" to loop-player

command /togglechat:
    permission: chat.toggle
    permission message: You are not allowed to do this.
    trigger:
        if {chat.disable::%uuid of player%} is set:
            delete {chat.disable::%uuid of player%}
            send "&aYour chat is now enabled."
        else:
            set {chat.disable::%uuid of player%} to true
            send "&cYour chat is now disabled."
 
try this
Code:
on chat:
    cancel event
    set {_name} to ""
    if coloured prefix of player is set:
        set {_name} to "%coloured prefix of player%"
    set {_name} to "%name%%player%"
    if coloured suffix of player is set:
        set {_name} to "%name%%coloured suffix of player%"
    loop all players:
        if {chat.disable::%uuid of loop-player%} is not set:
            send "{_name}&8: &7%message%" to loop-player

command /togglechat:
    permission: chat.toggle
    permission message: You are not allowed to do this.
    trigger:
        if {chat.disable::%uuid of player%} is set:
            delete {chat.disable::%uuid of player%}
            send "&aYour chat is now enabled."
        else:
            set {chat.disable::%uuid of player%} to true
            send "&cYour chat is now disabled."

upload_2020-5-26_16-52-3.png
 
ooops my bad

Code:
on chat:
    cancel event
    set {_name} to ""
    if coloured prefix of player is set:
        set {_name} to coloured prefix of player
    set {_name} to "%{_name}%%player%"
    if coloured suffix of player is set:
        set {_name} to "%{_name}%%coloured suffix of player%"
    loop all players:
        if {chat.disable::%uuid of loop-player%} is not set:
            send "%{_name}%&8: &7%message%" to loop-player

command /togglechat:
    permission: chat.toggle
    permission message: You are not allowed to do this.
    trigger:
        if {chat.disable::%uuid of player%} is set:
            delete {chat.disable::%uuid of player%}
            send "&aYour chat is now enabled."
        else:
            set {chat.disable::%uuid of player%} to true
            send "&cYour chat is now disabled."
 
ooops my bad

Code:
on chat:
    cancel event
    set {_name} to ""
    if coloured prefix of player is set:
        set {_name} to coloured prefix of player
    set {_name} to "%{_name}%%player%"
    if coloured suffix of player is set:
        set {_name} to "%{_name}%%coloured suffix of player%"
    loop all players:
        if {chat.disable::%uuid of loop-player%} is not set:
            send "%{_name}%&8: &7%message%" to loop-player

command /togglechat:
    permission: chat.toggle
    permission message: You are not allowed to do this.
    trigger:
        if {chat.disable::%uuid of player%} is set:
            delete {chat.disable::%uuid of player%}
            send "&aYour chat is now enabled."
        else:
            set {chat.disable::%uuid of player%} to true
            send "&cYour chat is now disabled."
It's working, but when I disable the chat and I write something other players can still see my messages. :c
 
oh, didn't think you wanted it like that.

Code:
on chat:
    cancel event
    if {chat.disable::%uuid of player%} is not set:
        set {_name} to ""
        if coloured prefix of player is set:
            set {_name} to "%coloured prefix of player%"
        set {_name} to "%{_name}%%player%"
        if coloured suffix of player is set:
            set {_name} to "%{_name}%%coloured suffix of player%"
        loop all players:
            if {chat.disable::%uuid of loop-player%} is not set:
                send "%{_name}%&8: &7%message%" to loop-player

command /togglechat:
    permission: chat.toggle
    permission message: You are not allowed to do this.
    trigger:
        if {chat.disable::%uuid of player%} is set:
            delete {chat.disable::%uuid of player%}
            send "&aYour chat is now enabled."
        else:
            set {chat.disable::%uuid of player%} to true
            send "&cYour chat is now disabled."
 
oh, didn't think you wanted it like that.

Code:
on chat:
    cancel event
    if {chat.disable::%uuid of player%} is not set:
        set {_name} to ""
        if coloured prefix of player is set:
            set {_name} to "%coloured prefix of player%"
        set {_name} to "%{_name}%%player%"
        if coloured suffix of player is set:
            set {_name} to "%{_name}%%coloured suffix of player%"
        loop all players:
            if {chat.disable::%uuid of loop-player%} is not set:
                send "%{_name}%&8: &7%message%" to loop-player

command /togglechat:
    permission: chat.toggle
    permission message: You are not allowed to do this.
    trigger:
        if {chat.disable::%uuid of player%} is set:
            delete {chat.disable::%uuid of player%}
            send "&aYour chat is now enabled."
        else:
            set {chat.disable::%uuid of player%} to true
            send "&cYour chat is now disabled."
tysm!
 
Remember to mark my answer as the solution, then the thread will be automatically marked as solved.
 
Status
Not open for further replies.