Error with {whitelist.list::*}

  • 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 community!

    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.

KroterPvP

Active Member
Apr 10, 2017
178
7
18
I don't know why it's not running. I want to create a whitelist, and this part of code must add players to it. If the player is already added, it mustn't add it, but if it's not added, it must add it.
It doesn't run.
Any ideas?
code_language.skript:
                if arg 1 is "add":
                    if arg 2 is set:
                        if {whitelist.list::*} contains arg 2:
                            send "&8[&f&lWhiteList&8] &a%arg 2% &7is already added to the whitelist."
                        else if {whitelist.list::*} doesn't contain arg 2:
                            add arg 2 to {whitelist.list::*}
                            send "&8[&f&lWhiteList&8] &7You have added &a%arg 2% &7to the whitelist."
                    else if arg 2 is not set:
                        send "&8[&f&lWhiteList&8] &7You must use &a/wl &aadd <player>&7."
 
I don't know why it's not running. I want to create a whitelist, and this part of code must add players to it. If the player is already added, it mustn't add it, but if it's not added, it must add it.
It doesn't run.
Any ideas?
code_language.skript:
                if arg 1 is "add":
                    if arg 2 is set:
                        if {whitelist.list::*} contains arg 2:
                            send "&8[&f&lWhiteList&8] &a%arg 2% &7is already added to the whitelist."
                        else if {whitelist.list::*} doesn't contain arg 2:
                            add arg 2 to {whitelist.list::*}
                            send "&8[&f&lWhiteList&8] &7You have added &a%arg 2% &7to the whitelist."
                    else if arg 2 is not set:
                        send "&8[&f&lWhiteList&8] &7You must use &a/wl &aadd <player>&7."

I am personaly no a fan of the contain part.

this should work:

code_language.skript:
if arg 1 is "add":
    if arg 2 is set:
        loop {whitelist.list::*}:
            if "%loop-value%" = "%arg 2%":
                send "&8[&f&lWhiteList&8] &a%arg 2% &7is already added to the whitelist."
                stop
        add arg 2 to {whitelist.list::*}
        send "&8[&f&lWhiteList&8] &7You have added &a%arg 2% &7to the whitelist."
    else:
        send "&8[&f&lWhiteList&8] &7You must use &a/wl &aadd <player>&7."
 
Status
Not open for further replies.