#Chat-Skript help

1 messages · Page 1 of 1 (latest)

strange gyro
#

Hey, it's my first skript. Can someone tell me why "/chats" isn't working?
I want a list with the count of all players who are in chat 001 and in team chat but listed separately.

#SKRIPT by imagica

options:
p: &8[&2TeamChat&8]

variables:
{teamchat.%player%} = "False"

command /teamchat:
aliases: /tc
permission: rg.ch.team
permission message: &cDu kannst dem Chat nicht beitreten!
trigger:
if {teamchat.%player%} is "False":
set {teamchat.%player%} to "True"
if {teamchat.%player%} is "True":
execute console command "/pex user %{_player}% add rg.ch.team.a"
loop all players:
if loop-player has permission "rg.ch.team.a":
message "&6%player% &7ist dem Chat &abeigetreten&7!" to loop-players
if {teamchat.%player%} is "True":
message "&7Du hast den TeamChat &aaktiviert"

    else:
        if {teamchat.%player%} is "True":
            set {teamchat.%player%} to "False"
            execute console command "/pex user %{_player}% remove rg.ch.team.a"
            message "&7Du hast den TeamChat &cdeaktiviert"
            loop all players:
                if loop-player has permission "rg.ct.team.a":
                    message "&6%player% &7hat den Chat &cverlassen&7!"

on chat:
if {teamchat.%player%} is "True":
cancel event
loop all players:
if loop-player has permission "rg.ch.team.a":
message "{@p} &6%player%&7: &f%message%" to loop-players
else:
message "&cKein Spieler im Chat!" to player
stop

#Chat 001
options:
p: &8[&7Chat &3001&8]

variables:
{chateins.%player%} = "False"

command /chat 1:
trigger:
clear {chat::*}
if {chateins.%player%} is "False":
set {chateins.%player%} to "True"
if {chateins.%player%} is "True":
execute console command "/pex user %{_player}% add rg.ch.ch1.a"
loop all players:
if loop-player has permission "rg.ch.ch1.a":
message "&6%player% &7ist dem Chat &abeigetreten&7!" to loop-players
if {chateins.%player%} is "True":
message "&7Du hast den Chat &3001 &aaktiviert"

    else:
        if {chateins.%player%} is "True":
            set {chateins.%player%} to "False"
            execute console command "/pex user %{_player}% remove rg.ch.ch1.a"
            message "&7Du hast den Chat &3001 &cdeaktiviert"
            loop all players:
                if loop-player has permission "rg.ch.ch1.a":
                    message "&6%player% &7hat den Chat &cverlassen&7!"

on chat:
if {chateins.%player%} is "True":
cancel event
loop all players:
if loop-player has permission "rg.ch.ch1.a":
add loop-player to {chat::001::}
if size of {chat::001::
} is 0:
message "&cKein Spieler im Chat!" to player
else if size of {chat::001::*} is more than 0:
if loop-player has permission "rg.ch.ch1.a":
message "{@p} &6%player%&7: &f%message%" to loop-players
else:
message "&cFehler beim senden der Nachricht!" to player
stop

command /chats:
trigger:
clear {chat::}
if size of {chat::001::
} is 0:
message "&cEs sind keine Spieler in Chats" to the player
else if size of {chat::001::} is more than 0:
loop all players:
if loop-player has permission "rg.ch.ch1.a":
message "&3Chat &6001&7: &f%amount of {chat::001::
}%" to the player
stop

thorn spruce
#

the reason why /chats is not working is because you are clearing the list variable and then checking its size. instead of being a certain size, a list that doesn't exist will be none, so it never will be 0