Varible displaying as <none> when there are mulitple names

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

    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!

phillysports2

Member
Dec 14, 2023
2
0
1
23
Code:
command /wl [<text>] [<offlineplayer>]:

    trigger:

        set {_player} to arg-2

        set {_wl} to uuid of {_player}

        if {rank::%sender%} is "normal":

            NoPerms(sender, "SPECTATOR+")

        else:

            if arg-1 is "on":

                if {whitelist} is false:

                    set {whitelist} to true

                    loop all players:

                        set {whitelisted::%loop-player's uuid%} to true

                    send "{@S} {@A} You were whitelisted by &5%sender% {@AA}" to all players

                    broadcast "{@S} {@A} Whitelist has been &aenabled. {@AA}"

                    execute console command "whitelist off"

                else if {whitelist} is true:

                    message "{@S} {@A} Whitelist is already &aenabled. {@AA}" to command sender

                    execute console command "whitelist off"

            else if arg-1 is "off":

                if {whitelist} is true:

                    set {whitelist} to false

                    broadcast "{@S} {@A} Whitelist has been &cdisabled. {@AA}"

                    delete {whitelisted::*}

                    execute console command "whitelist off"

                else if {whitelist} is false:

                    message "{@S} {@A} Whitelist has been &cdisabled. {@AA}" to command sender

                    delete {whitelisted::*}

                    execute console command "whitelist off"

            else if arg-1 is "add":

                if arg-2 is not set:

                    message "{@S} {@A} &7Please Choose A Player To Add To The Whitelist. {@AA}" to command sender

                else:

                    set {whitelisted::%{_wl}%} to true

                    send "%{_wl}%" to player

                    send "{whitelisted::%{_wl}%}" to player

                    send "%{whitelisted::%{_wl}%}%" to player

                    broadcast "{@S} {@A} &5%arg-2% &7has been added to the whitelist by &5%sender%. {@AA}"

            else if arg-1 is "remove":

                if arg-2 is not set:

                    message "{@S} {@A} &7Please Choose A Player To Remove From The Whitelist. {@AA}" to command sender

                else:

                    delete {whitelisted::%{_wl}%}

                    broadcast "&5{@S} {@A} &5%arg-2% &7has been removed from the whitelist by &5%sender%. {@AA}"

            else if arg-1 is "list":

                if {whitelisted::*} is not set:

                    send "{@Line2}%nl%&5Arcanum {@A} &bWhitelist is Empty%nl%{@Line2}" to player

                else:

                    set {_w} to join all indexes of {whitelisted::*} with "&f,&7"

                    send "{@Line2}%nl%&5&lWhitelisted: &7%{_w} parsed as offlineplayers%%nl%{@Line2}" to player

            else:

                message "{@S} {@A} &cHelp §7(&5/wl§7) {@AA}" to command sender

                message "{@S} {@A} &5/wl on §8- §fTurns Whitelist On and Whitelists Everyone {@AA}" to command sender

                message "{@S} {@A} &5/wl off §8- §fTurns Whitelist Off and Clears Whitelist {@AA}" to command sender

                message "{@S} {@A} &5/wl add <player> §8- §fAdd A Player To The Whitelist {@AA}" to command sender

                message "{@S} {@A} &5/wl remove <player> §8- §fRemove A Player From The Whitelist {@AA}" to command sender

                message "{@S} {@A} &5/wl list §8- §fShows Everyone On The Whitelist {@AA}" to command sender


why does/wl list give back <none> and not player names? if i remove the parsed as offline player part it gives back the uuids like it should but wont convert them to playernames.
if only one name is whitelisted it displays the name but if there are more than one theres an issue
 
Your issue is that you are parsing multiple players, in a text, as offline players.

What it is doing is attempting to parse something like "user1,user2" as offline players, which is not possible. That's why only one user would work fine.

To fix, you could replace it with this:

code_language.skript:
set {_w::*} to indexes of {whitelisted::*}
set {_table} to ""

loop {_w::*}:
    if (loop-index parsed as an integer) is size of {_w::*}:
        set {_table} to "%{_table}%&7%loop-value parsed as an offline player%"
    else:
        set {_table} to "%{_table}%&7%loop-value parsed as an offline player%&f, "

send "{@Line2}%nl%&5&lWhitelisted: &7%{_table}%%nl%{@Line2}" to player
 
Your issue is that you are parsing multiple players, in a text, as offline players.

What it is doing is attempting to parse something like "user1,user2" as offline players, which is not possible. That's why only one user would work fine.

To fix, you could replace it with this:

code_language.skript:
set {_w::*} to indexes of {whitelisted::*}
set {_table} to ""

loop {_w::*}:
    if (loop-index parsed as an integer) is size of {_w::*}:
        set {_table} to "%{_table}%&7%loop-value parsed as an offline player%"
    else:
        set {_table} to "%{_table}%&7%loop-value parsed as an offline player%&f, "

send "{@Line2}%nl%&5&lWhitelisted: &7%{_table}%%nl%{@Line2}" to player
Code:
command /wl [<text>] [<offlineplayer>]:
    trigger:
        set {_player} to arg-2
        set {_wl} to uuid of {_player}
        if {rank::%sender%} is "normal":
            NoPerms(sender, "SPECTATOR+")
        else:
            if arg-1 is "on":
                if {whitelist} is false:
                    set {whitelist} to true
                    loop all players:
                        set {whitelisted::%loop-player's uuid%} to true
                    send "{@S} {@A} You were whitelisted by &5%sender% {@AA}" to all players
                    broadcast "{@S} {@A} Whitelist has been &aenabled. {@AA}"
                    execute console command "whitelist off"
                else if {whitelist} is true:
                    message "{@S} {@A} Whitelist is already &aenabled. {@AA}" to command sender
                    execute console command "whitelist off"
            else if arg-1 is "off":
                if {whitelist} is true:
                    set {whitelist} to false
                    broadcast "{@S} {@A} Whitelist has been &cdisabled. {@AA}"
                    delete {whitelisted::*}
                    execute console command "whitelist off"
                else if {whitelist} is false:
                    message "{@S} {@A} Whitelist has been &cdisabled. {@AA}" to command sender
                    delete {whitelisted::*}
                    execute console command "whitelist off"
            else if arg-1 is "add":
                if arg-2 is not set:
                    message "{@S} {@A} &7Please Choose A Player To Add To The Whitelist. {@AA}" to command sender
                else:
                    set {whitelisted::%{_wl}%} to true
                    broadcast "{@S} {@A} &5%arg-2% &7has been added to the whitelist by &5%sender%. {@AA}"
            else if arg-1 is "remove":
                if arg-2 is not set:
                    message "{@S} {@A} &7Please Choose A Player To Remove From The Whitelist. {@AA}" to command sender
                else:
                    delete {whitelisted::%{_wl}%}
                    broadcast "&5{@S} {@A} &5%arg-2% &7has been removed from the whitelist by &5%sender%. {@AA}"
            else if arg-1 is "list":
                if {whitelisted::*} is not set:
                    send "{@Line2}%nl%&5Arcanum {@A} &bWhitelist is Empty%nl%{@Line2}" to player
                else:
                    set {_w::*} to indexes of {whitelisted::*}
                    set {_table} to ""
                loop {_w::*}:
                    if (loop-index parsed as an integer) is size of {_w::*}:
                        set {_table} to "%{_table}%&7%loop-value parsed as an offline player%"
                    else:
                        set {_table} to "%{_table}%&7%loop-value parsed as an offline player%&f,"
                    send "{@Line2}%nl%&5&lWhitelisted: &7%{_table}%%nl%{@Line2}" to player
                    #set {_w} to join all indexes of {whitelisted::*} with "&f,&7"
                    #send "{@Line2}%nl%&5&lWhitelisted: &7%{_w} parsed as offlineplayer%%nl%{@Line2}" to player

so its now fixed to show multiple names but i get the number of messages for each person whitelisted?
1708041980932.png

I just want to to be one message of everyone on he list?
SOLVED I BELIEVE had the send message tabbed one too far
 
Last edited: