So, I was looking for a way to stop a user from seeing other user's chat messages using a command to toggle it. I managed to find a skript posted by another user and applied my own changes on it. I was wondering how I'd be able to do this for everything in chat, including announcements
(Like this:
). Here is my current code:
(Like this:
code_language.skript:
on chat:
cancel event
loop all players:
if {Chat.%loop-player%} is not set:
send "%colored player's prefix%%player%&7: &f%message%" to loop-player
command /toggleglobalchat [<text>]:
aliases: /tgc
trigger:
if arg-1 is set:
send "&cUsage: /tgc"
else:
if {Chat.%player%} is set:
delete {Chat.%player%}
send "&aYou have enabled global chat"
else:
send "&cYou have disabled global chat"
set {Chat.%player%} to true