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?
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!
You can always check out skUnity Downloads for downloads and any other information about Skript!
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."
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. :cooops 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."
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!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."