Problem with List Variable

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

Manered

New Member
Jul 24, 2023
5
0
1
So I've made a clans skript (with the help of a tutorial from yt)
But, I have a problem with the ally system. I want there to be the following args: allychat, allyaccept, ally
However, the ally and allyaccept system args are currently broken. The sending seems to work fine but the accepting doesn't.

code_language.skript:
on portal create:
    cancel event

on load:
    set {possiblecolors::*} to "red", "black", "green", "blue", "orange", "aquamarine", "azure", "white", "grey", "pink", "gold", "lightblue", "lime", "reset" and "purple"

function sendClanHelp(player: player):
    send "" to {_player}
    send "<##0e73cc>Clan Help" to {_player}
    send "" to {_player}
    send "<##93c3ed>/clan create <name> <##708291>- <##c5d9eb>Creates a new clan." to {_player}
    send "<##93c3ed>/clan disband <##708291>- <##c5d9eb>Disbands the clan you own." to {_player}
    send "<##93c3ed>/clan invite <player> <##708291>- <##c5d9eb>Invites a player to your clan." to {_player}
    send "<##93c3ed>/clan join <name> <##708291>- <##c5d9eb>Joins a clan." to {_player}
    send "<##93c3ed>/clan leave <##708291>- <##c5d9eb>Leaves your current clan." to {_player}
    send "<##93c3ed>/clan kick <player> <##708291>- <##c5d9eb>Kicks a player from your clan." to {_player}
    send "<##93c3ed>/clan chat <##708291>- <##c5d9eb>Toggles clan chat." to {_player}
    send "<##93c3ed>/clan ally <name> <##708291>- <##c5d9eb>Sends an ally request to a clan." to {_player}
    send "<##93c3ed>/clan allyaccept <name> <##708291>- <##c5d9eb>Accepts an ally request from a clan." to {_player}
    send "<##93c3ed>/clan friendlyfire <##708291>- <##c5d9eb>Toggles friendly fire." to {_player}
    send "<##93c3ed>/clan info [player | name] <##708291>- <##c5d9eb>Returns information like leader, members about a clan." to {_player}
    send "<##93c3ed>/clan color <color> <##708291>- <##c5d9eb>Updates the color of the clan for cosmetic purposes." to {_player}
    send "" to {_player}

on tab complete of "/clan":
    set tab completions for position 1 to "create", "disband", "allyaccept", "invite", "join", "leave", "kick", "chat", "info" and "friendlyfire" and "color"
    if tab arg-1 is "create":
        add "Clan Name" to tab completions for position 2
    else if tab arg-1 is "invite":
        loop all players:
            add "%loop-value%" to tab completions for position 2
    else if tab arg-1 is "join":
        loop {clans::*}:
            add "%loop-value%" to tab completions for position 2
    else if tab arg-1 is "kick":
        loop {members::%{clans::%{clans::%player%}%::owner}%::*}:
            add "%loop-value%" to tab completions for position 2
    else if tab arg-1 is "ally":
        loop {clans::*}:
            add "%loop-value%" to tab completions for position 2
    else if tab arg-1 is "color":
        loop {possiblecolors::*}:
            add "%loop-value%" to tab completions for position 2
    else if tab arg-1 is "info":
        loop {clans::*}:
            add "%loop-value%" to tab completions for position 2
        loop all players:
            add "%loop-value%" to tab completions for position 2

on placeholderapi placeholder request for the prefix "clans":
    if the identifier is "name":
        if {clans::%player%} is not set:
            set the result to ""
        else:
            set the result to "<##708291>[%{clans::%{clans::%player%}%::color}% %{clans::%player%}%<##708291>] "


command /clan [<text>] [<text>]:
    trigger:
        if arg-1 is not set:
            sendClanHelp(player)
        else:
            if arg-1 is "create" or "disband" or "join" or "leave" or "invite" or "info" or "kick" or "chat" or "friendlyfire" or "color" or "ally" or "allyaccept":
                if arg-1 is "create":
                    if arg-2 is not set:
                        sendClanHelp(player)
                    else:
                        if length of arg-2 is greater than 20:
                            send "<##ff0000>The name of your new clan exceeded the limit of 20 characters. Please pick a shorter name."
                            stop
                        if arg-2 matches "[a-zA-Z]+":
                            if {clans::%player%} is not set:
                                loop {clans::*}:
                                    if loop-value is arg-2:
                                        set {_n} to true
                                if {_n} is not set:
                                    set {clans::%player%} to arg-2
                                    set {clans::%{clans::%player%}%::owner} to player
                                    add player to {members::%player%::*}
                                    set {clans::%{clans::%player%}%::color} to "<##FFFFFF>"
                                    send "<##00ff00>Clan &f'%arg-2%' <##00ff00>successfully created!"
                                else:
                                    send "<##ff0000>That clan already exists!"
                            else:
                                send "<##ff0000>You're already in a clan!"
                        else:
                            send "<##ff0000>Name can not contain anything except letters!"
                            stop
                if arg-1 is "disband":
                    if {clans::%player%} is not set:
                        send "<##ff0000>You're not in a clan!"
                    else:
                        if {clans::%{clans::%player%}%::owner} is not the player:
                            send "<##ff0000>Only the leader of the clan can disband it!"
                        else:
                            send "<##ff0000>You have disbanded the clan! This action is irreversible."
                            loop {members::%player%::*}:
                                send "<##ff0000>This clan has been disbanded by &f%player%" to player
                            loop {invited::%{clans::%player%}%::*}:
                                remove {clans::%player%} from {clansinvites::%loop-value%::*}
                            loop {members::%{clans::%{clans::%player%}%::owner}%::*}:
                                delete {clans::%loop-value%}
                                remove loop-value from {clanchat::*}
                                remove loop-value from {members::%player%::*}
                            delete {clans::%{clans::%player%}%::owner}
                            remove player from {members::%player%::*}
                if arg-1 is "leave":
                    if {clans::%player%} is not set:
                        send "<##ff0000>You're not in a clan!"
                    else:
                        if {clans::%{clans::%player%}%::owner} is player:
                            send "<##ff0000>You can't leave your own clan! Use /clan disband to disband it instead."
                        else:
                            send "<##ff0000>You have left the clan."
                            loop {members::%{clans::%{clans::%player%}%::owner}%::*}:
                                set {_b} to loop-value parsed as an offline player
                                send "<##bd1a35>- <##c5d9eb>%player% <##708291>left the clan." to {_b}
                                remove the player from {members::%{clans::%{clans::%player%}%::owner}%::*}
                                delete {clans::%player%}
                                remove player from {clanchat::*}
                if arg-1 is "invite":
                    if {clans::%player%} is not set:
                        send "<##ff0000>You're not in a clan."
                    else:
                        if {clans::%{clans::%player%}%::owner} is not the player:
                            send "<##ff0000>Only the leader of the clan can invite people!"
                        else:
                            if arg-2 is set:
                                set {_b} to arg-2 parsed as an offline player
                                if {invited::%{clans::%player%}%::%arg-2%} is not set:
                                    send "&f%player% <##00ff00>invited you to join &f%{clans::%player%}%. <##708291>Use <##c5d9eb>/clan join %{clans::%player%}% <##708291>to join the clan." to {_b}
                                    set {invited::%{clans::%player%}%::%arg-2%} to true
                                    loop {members::%player%::*}:
                                        set {_b2} to "%loop-value%" parsed as an offline player
                                        send "&f%player% <##00ff00>invited &f%arg-2% <##00ff00>to the clan." to {_b2}
                                else:
                                    set {_b} to arg-2 parsed as an offline player
                                    send "&f%player% <##ff0000>cancelled your clan invite!" to {_b}
                                    delete {invited::%{clans::%player%}%::%arg-2%}
                                    loop {members::%player%::*}:
                                        set {_b2} to "%loop-value%" parsed as an offline player
                                        send "&f%player% <##ff0000>cancelled the invitation of &f%arg-2% <##ff0000>to the clan." to {_b2}
                            else:
                                sendClanHelp(player)
                if arg-1 is "ally":
                    if {clans::%player%} is not set:
                        send "<##ff0000>You're not in a clan."
                    else:
                        if arg-2 is not set:
                            sendClanHelp(player)
                        else:
                            if {clans::%{clans::%player%}%::owner} is not the player:
                                send "<##ff0000>Only the leader of the clan can ally people!"
                            else:
                                if arg-2 is {clans::%player%}:
                                    send "<##ff0000>You can't ally with your own clan!"
                                    stop
                                loop {clans::*}:
                                    if {clans::*} contains arg-2:
                                        send "<##00ff00>You have sent a ally request to clan &f%arg-2%."

                                        set {_requester} to {clans::%player%}
                                        set {_to} to {clans::%arg-2%}

                                        set {allyinvited::%{_requester}%::%{_to}%::*} to true

                                        send formatted "&f%{clans::%player%}% <##00ff00>has requested a allyship with your clan.%nl%<##708291>To accept this, use <cmd:/clan allyaccept %{clans::%player%}%><##c5d9eb>/clan allyaccept %{clans::%player%}%<reset>" to {clans::%arg-2%::owner}



                                        stop loop
                                    else:
                                        send "<##ff0000>Clan not found."
                                        stop loop
                                    
                if arg-1 is "allyaccept":
                    if {clans::%player%} is not set:
                        send "<##ff0000>You're not in a clan."
                    else:
                        if arg-2 is {clans::%player%}:
                            send "<##ff0000>You can't ally with your own clan!"
                            stop
                        loop {clans::*}:
                            if {clans::*} contains arg-2:
                                stop loop
                                if {allyinvited::%{clans::%arg-2%::owner}%::%player%::*} is true:
                                    delete {allyinvited::%{clans::%arg-2%::owner}%::%player%::*}
                                    send "<##00ff00>You have accepted &f%{clans::%arg-2%::owner}%'s <##00ff00>allyship request!" to player
                                    send "&f%{clans::%player%}% (led by %player%) <##00ff00>accepted your allyship request!" to {clans::%arg-2%::owner}

                                    add player to {allies::%{clans::%arg-2%}%::*}
                                    add arg-2 to {allies::%{clans::%player%}%::*}
                                
                                else:
                                    send "<##ff0000>No ally request found from that clan."
                            else:
                                send "<##ff0000>Clan not found."
                                stop loop

                if arg-1 is "join":
                    if arg-2 is not set:
                        sendClanHelp(player)
                    else:
                        loop {clans::*}:
                            if loop-value is arg-2:
                                set {_n} to true
                                stop loop
                            else:
                                set {_n} to false
                        if {_n} is false:
                            send "<##ff0000>Clan not found."
                        else:
                            if {invited::%arg-2%::%player%} is set:
                                set {clans::%player%} to arg-2
                                set {_player} to {clans::%{clans::%player%}%::owner}
                                set {clans::%player%} to {clans::%{_player}%}
                                loop {members::%{clans::%{clans::%player%}%::owner}%::*}:
                                    set {_b} to "%loop-value%" parsed as an offline player
                                    send "<##00ff00>+ <##c5d9eb>%player% <##708291>joined the clan!" to {_b}
                                send "<##00ff00>You have joined the clan!"
                                add the player to {members::%{clans::%{clans::%player%}%::owner}%::*}
                                delete {invited::%arg-2%::%player%}
                            else:
                                send "<##ff0000>You weren't invited to this clan!"
                if arg-1 is "info":
                    if arg-2 is not set:
                        if {clans::%player%} is not set:
                            send "<##ff0000>You're not in a clan."
                        else:
                            send ""
                            send "<##0e73cc>Clan Information &f(%{clans::%player%}%)"
                            send ""
                            send "<##708291>- <##93c3ed>Leader: <##c5d9eb>%{clans::%{clans::%player%}%::owner}%"
                            set {_m::*} to {members::%{clans::%{clans::%player%}%::owner}%::*}
                            send "<##708291>- <##93c3ed>Members: <##c5d9eb>%{_m::*}%"
                            set {_a::*} to {allies::%{clans::%player%}%::*}
                            if {a_::*}'s size is bigger than 0:
                                send "<##708291>- <##93c3ed>Allies: <##c5d9eb>%{_a::*}%"
                            send ""
                    else:
                        loop {clans::*}:
                            if {clans::*} contains arg-2:
                                send ""
                                send "<##0e73cc>Clan Information &f(%arg-2%)"
                                send ""
                                send "<##708291>- <##93c3ed>Leader: <##c5d9eb>%{clans::%arg-2%::owner}%"
                                set {_m::*} to {members::%{clans::%arg-2%::owner}%::*}
                                send "<##708291>- <##93c3ed>Members: <##c5d9eb>%{_m::*}%"
                                send ""
                                stop loop
                            else:
                                set {_f} to arg-2 parsed as an offline player
                                if {_f} has not played before:
                                    send "<##ff0000>There is no clan or player that exists by that name."
                                    stop loop
                                else:
                                    if {clans::%{_f}%} is not set:
                                        send "<##ff0000>That player isn't in a clan."
                                        stop loop
                                    else:
                                        send ""
                                        send "<##0e73cc>Clan Information &f(%{clans::%arg-2%}%)"
                                        send ""
                                        send "<##708291>- <##93c3ed>Leader: <##c5d9eb>%{clans::%{clans::%arg-2%}%::owner}%"
                                        set {_m::*} to {members::%{clans::%{clans::%arg-2%}%::owner}%::*}
                                        send "<##708291>- <##93c3ed>Members: <##c5d9eb>%{_m::*}%"
                                        send ""
                                        stop loop
                                
                if arg-1 is "kick":
                    if {clans::%player%} is not set:
                        send "<##ff0000>You're not in a clan."
                    else:
                        if {clans::%{clans::%player%}%::owner} is not the player:
                            send "<##ff0000>Only the leader of the clan can kick people!"
                        else:
                            set {_n} to arg-2 parsed as offline player
                            if {members::%player%::*} does not contain {_n}:
                                send "&f%arg-2% <##ff0000>is not in your clan!"
                            else:
                                if arg-2 is not the player:
                                    remove {_n} from {members::%player%::*}
                                    delete {clans::%arg-2%}
                                    send "&f%player% <##ff0000>kicked you from the clan!" to {_n}
                                    loop {members::%player%::*}:
                                        set {_n2} to "%loop-value%" parsed as offline player
                                        send "&f%player% <##ff0000>kicked &f%arg-2% <##ff0000>from the clan" to {_n2}
                                else:
                                    send "<##ff0000>You can't kick yourself."
                if arg-1 is "chat":
                    if arg-2 is set:
                        sendClanHelp(player)
                    else:
                        if {clans::%player%} is not set:
                            send "<##ff0000>You're not in a clan."
                        else:
                            if {clanchat::*} contains player:
                                remove player from {clanchat::*}
                                send "<##ff0000>You are no longer speaking in clan chat."
                                stop
                            else:
                                add player to {clanchat::*}
                                send "<##ff0000>You are now speaking in clan chat"
                                stop

                if arg-1 is "friendlyfire":
                    if arg-2 is set:
                        sendClanHelp(player)
                    else:
                        if {clans::%player%} is not set:
                            send "<##ff0000>You're not in a clan."
                        else:
                            if {clans::%{clans::%player%}%::owner} is not the player:
                                send "<##ff0000>Only the leader of the clan can update the friendly fire status!"
                            else:
                                if {clans::%{clans::%player%}%::friendlyfire} is true:
                                    set {clans::%{clans::%player%}%::friendlyfire} to false
                                    send "<##00ff00>You can now damage other players in your clan."
                                    stop
                                else:
                                    set {clans::%{clans::%player%}%::friendlyfire} to true
                                    send "<##ff0000>You can no longer damage other players in your clan."
                                    stop

                if arg-1 is "color":
                    if arg-2 is not set:
                        sendClanHelp(player)
                    else:
                        if {clans::%player%} is not set:
                            send "<##ff0000>You're not in a clan."
                        else:
                            if {clans::%{clans::%player%}%::owner} is not the player:
                                send "<##ff0000>Only the leader of the clan can update the color!"
                            else:
                                if arg-2 is not "red" or "black" or "green" or "blue" or "orange" or "aquamarine" or "azure" or "white" or "grey" or "pink" or "gold" or "lightblue" or "lime" or "purple" or "reset":
                                    send "<##ff0000>No color by that name found. <##708291>Valid names: <##c5d9eb>%{possiblecolors::*}%"
                                else:
                                    # "red", "black", "green", "blue", "orange", "aquamarine", "azure", "white", "grey", "pink", "gold", "lightblue", "lime", "purple" and "reset"
                                    if arg-2 is "red":
                                        set {clans::%{clans::%player%}%::color} to "<##FF0000>"
                                        send formatted "<##c5d9eb>Your clan now displays as: %{clans::%{clans::%player%}%::color}%%{clans::%player%}%"
                                    if arg-2 is "green":
                                        set {clans::%{clans::%player%}%::color} to "<##38A120>"
                                        send formatted "<##c5d9eb>Your clan now displays as: %{clans::%{clans::%player%}%::color}%%{clans::%player%}%"
                                    if arg-2 is "blue":
                                        set {clans::%{clans::%player%}%::color} to "<##0000FF>"
                                        send formatted "<##c5d9eb>Your clan now displays as: %{clans::%{clans::%player%}%::color}%%{clans::%player%}%"
                                    if arg-2 is "orange":
                                        set {clans::%{clans::%player%}%::color} to "<##FF7F24>"
                                        send formatted "<##c5d9eb>Your clan now displays as: %{clans::%{clans::%player%}%::color}%%{clans::%player%}%"
                                    if arg-2 is "aquamarine":
                                        set {clans::%{clans::%player%}%::color} to "<##91FFDA>"
                                        send formatted "<##c5d9eb>Your clan now displays as: %{clans::%{clans::%player%}%::color}%%{clans::%player%}%"
                                    if arg-2 is "azure":
                                        set {clans::%{clans::%player%}%::color} to "<##0E73CC>"
                                        send formatted "<##c5d9eb>Your clan now displays as: %{clans::%{clans::%player%}%::color}%%{clans::%player%}%"
                                    if arg-2 is "white":
                                        set {clans::%{clans::%player%}%::color} to "<##FFFFFF>"
                                        send formatted "<##c5d9eb>Your clan now displays as: %{clans::%{clans::%player%}%::color}%%{clans::%player%}%"
                                    if arg-2 is "grey":
                                        set {clans::%{clans::%player%}%::color} to "<##A3A3A3>"
                                        send formatted "<##c5d9eb>Your clan now displays as: %{clans::%{clans::%player%}%::color}%%{clans::%player%}%"
                                    if arg-2 is "pink":
                                        set {clans::%{clans::%player%}%::color} to "<##E31E97>"
                                        send formatted "<##c5d9eb>Your clan now displays as: %{clans::%{clans::%player%}%::color}%%{clans::%player%}%"
                                    if arg-2 is "gold":
                                        set {clans::%{clans::%player%}%::color} to "<##FFCC00>"
                                        send formatted "<##c5d9eb>Your clan now displays as: %{clans::%{clans::%player%}%::color}%%{clans::%player%}%"
                                    if arg-2 is "lightblue":
                                        set {clans::%{clans::%player%}%::color} to "<##93C3ED>"
                                        send formatted "<##c5d9eb>Your clan now displays as: %{clans::%{clans::%player%}%::color}%%{clans::%player%}%"
                                    if arg-2 is "lime":
                                        set {clans::%{clans::%player%}%::color} to "<##19FC19>"
                                        send formatted "<##c5d9eb>Your clan now displays as: %{clans::%{clans::%player%}%::color}%%{clans::%player%}%"
                                    if arg-2 is "purple":
                                        set {clans::%{clans::%player%}%::color} to "<##9A19FC>"
                                        send formatted "<##c5d9eb>Your clan now displays as: %{clans::%{clans::%player%}%::color}%%{clans::%player%}%"
                                    if arg-2 is "reset":
                                        set {clans::%{clans::%player%}%::color} to "<##FFFFFF>"
                                        send formatted "<##c5d9eb>Your clan now displays as: %{clans::%{clans::%player%}%::color}%%{clans::%player%}%"
                                    if arg-2 is "black":
                                        set {clans::%{clans::%player%}%::color} to "<##192136>"
                                        send formatted "<##c5d9eb>Your clan now displays as: %{clans::%{clans::%player%}%::color}%%{clans::%player%}%"
            else:
                sendClanHelp(player)

on damage:
    if damage cause was attack:
        if {clans::%victim%} is set:
            if {clans::%victim%} is {clans::%attacker%}:
                if {clans::%{clans::%attacker%}%::friendlyfire} is true:
                    cancel event
                    send formatted "<##ff0000>You can't damage players in your clan! <##708291>Toggle this with <cmd:/clan friendlyfire><##c5d9eb>/clan friendlyfire<reset>" to attacker

on chat:
    if {clanchat::*} contains player:
        cancel event
        loop {members::%{clans::%{clans::%player%}%::owner}%::*}:
            set {_z} to "%loop-value%" parsed as offline player
            send "<##0e73cc>%{clans::%player%}% <##708291>- &f%player% <##708291>-> <##c5d9eb>%message%" to {_z}
 
Could you maybe send where exactly the code is making problems, so i don't have to dig through the entire code. plz ok thx
 
Pretty sure it's not that hard to look at the first and second sentence of the post. arg-1's: ally, allyaccept.
No errors

@Pierrelasse
 
Last edited:
??? I never said I don't respect him and never said anything about him. I don't even know him. Never heard of him.
I'm here for someone to help me. Still, nobody has replied with the fix to my issues.
 
You have given no context to errors or exact issues of where the problem is occurring. Although you told us Where the code isn't working, We have no idea why. Have you even debugged? Also, since you are the one asking for help. you should be thankful that anyone is replying to your thread with your manner of speak. It is highly entitled and arrogant.