Hello, I want to create a clearchat skript, but it should only clear the chat for players who haven't the permission "clearchat.prevent". The chat won't be cleared for the players with this permission.
I don't know what I'm doing wrong, but it clears the chat to all players. Also, I don't know why, but players with permission recive the clearchat message twice.
Code:
I don't know what I'm doing wrong, but it clears the chat to all players. Also, I don't know why, but players with permission recive the clearchat message twice.
Code:
code_language.skript:
command /clearchat:
aliases: /cc, clearc, /cchat
trigger:
player has permission "clearchat.use":
loop all players:
if loop-player has permission "clearchat.prevent":
add loop-player to {looped-players-with-permission}
set {looped-players} to loop-player
remove {looped-players-with-permission} from {looped-players}
loop 200 times:
send "" to {looped-players}
send " &7The chat was cleared by &a%player%&7." to all players
else if player doesn't have permission "clearchat.prevent":
send "&cYou don't have permission to do this!"