1. 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!

  2. LOOKING FOR A VERSION OF SKRIPT?

    You can always check out our Wiki for downloads and any other information about Skript!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

list variables

Discussion in 'Skript' started by mrclipse, Sep 19, 2021.

Thread Status:
Not open for further replies.
  1. mrclipse

    mrclipse Member

    Joined:
    Sep 18, 2021
    Messages:
    11
    Likes Received:
    0
    I'm making a faction plugin for my anarchy server that doesn't have land claims, you can do /fcreate [<text>] to make a faction, but I want to check if that faction name has been taken already so there aren't 2 identical factions.
    I tried using a list variable to store all of the faction names, but it didn't work
    can someone please help?
    Also when someone deletes a faction(/fdelete) and someone is offline and in that faction I would like to have it remove all the faction variables of the players by storing them in a list like {factions::%uuid of player(owner)%::layers::*}


    Code (Text):
    1. command /fcreate [<text>]:
    2.     description: Creates a faction
    3.     executable by: players
    4.     trigger:
    5.         if {factions::factionlist::*} does not contain arg-1:
    6.             add arg-1 to {factions::factionlist::*}
    7.             if {factions::%uuid of player%::hasfaction} is not 1:
    8.                 if arg-1 is not "<none>":
    9.                     if arg-1 does not contain " ":
    10.                         set {factions::%uuid of player%::factionlocation} to location of player
    11.                         set {factions::%uuid of player%::factionname} to arg-1
    12.                         set {factions::%uuid of player%::isowner} to 1
    13.                         set {factions::%uuid of player%::hasfaction} to 1
    14.                         message "Created the faction <green>%arg-1%<reset> and set its home to your location"
    15.                     else:
    16.                         message "For technical reasons you can't use spaces in your faction, sorry!"
    17.                 else:
    18.                     message "For technical reasons you can't name your faction <none>, sorry!"
    19.             else:
    20.             message "You are already in a faction"
    21.         else:
    22.             message "That faction name is taken, sorry!"
    23.  
    24. command /invite [<player>]:
    25.     trigger:
    26.         if {factions::%uuid of player%::hasfaction} is 1:
    27.             if {factions::%uuid of player%::isowner} is 1:
    28.                 message "you invited %arg-1% to join %{factions::%uuid of player%::factionname}%"
    29.                 message "%player% invites you to join their faction, %{factions::%uuid of player%::factionname}%","to join type /join %{factions::%uuid of player%::factionname}%" to arg-1
    30.                 set {factions::%uuid of arg-1%::currentinvite} to {factions::%uuid of player%::factionname}
    31.                 set {factions::%uuid of arg-1%::invitelocation} to {factions::%uuid of player%::factionlocation}
    32.  
    33. command /join [<text>]:
    34.     trigger:
    35.         if {factions::%uuid of player%::currentinvite} is not "<none>":
    36.             if {factions::%uuid of player%::hasfaction} is not 1:
    37.                 if arg-1 is {factions::%uuid of player%::currentinvite}:
    38.                     set {factions::%uuid of player%::factionname} to {factions::%uuid of player%::currentinvite}
    39.                     set {factions::%uuid of player%::factionlocation} to {factions::%uuid of player%::invitelocation}
    40.                     set {factions::%uuid of player%::hasfaction} to 1
    41.                     set {factions::%uuid of player%::isowner} to 0
    42.                     set {factions::%uuid of player%::currentinvite} to "<none>"
    43.                     message "succsefully joined %{factions::%uuid of player%::factionname}%"
    44.             else:
    45.                 message "you are already in a faction"
    46.         else:
    47.             message "you are not currently invited to any factions"
    48. command /test:
    49.     trigger:
    50.         message "%{factions::%uuid of player%::currentinvite}%"
    51.  
    52. command /fdelete:
    53.     description: Deletes your faction
    54.     executable by: players
    55.     trigger:
    56.         if {factions::%uuid of player%::hasfaction} is 1:
    57.             if {factions::%uuid of player%::isowner} is 1:
    58.                 message "are you sure you want to <red><bold>delete<reset> %{factions::%uuid of player%::factionname}%?"
    59.                 message "this action <red><bold>cannot be undone<reset>"
    60.                 message "type /fconfirm delete <faction name> if you are sure"
    61.             else:
    62.                 message "you aren't the owner of this faction!"
    63.         else:
    64.             message "you don't have a faction"
    65.  
    66. command /fconfirm [<text>] [<text>]:
    67.     description: Confirms the deletion of your faction
    68.     executable by: players
    69.     trigger:
    70.         if "%arg-1%" is "delete":
    71.             if {factions::%uuid of player%::hasfaction} is 1:
    72.                 if {factions::%uuid of player%::isowner} is 1:
    73.                     if "%arg-2%" is {factions::%uuid of player%::factionname}:
    74.                         set {factions::%uuid of player%::hasfaction} to 0
    75.                         set {factions::%uuid of player%::factionname} to "<none>"
    76.                         set {factions::%uuid of player%::isowner} to 0
    77.                         set {factions::%uuid of player%::factionlocation} to "<none>"
    78.                     else:
    79.                         message "thats not your faction name try %{factions::%uuid of player%::factionname}%"
    80.                 else:
    81.                     message "you don't own %{factions::%uuid of player%::factionname}%"
    82.             else:
    83.                 message "you aren't in a faction"
    84. command /fleave:
    85.     trigger:
    86.         if {factions::%uuid of player%::hasfaction} is 1:
    87.             if {factions::%uuid of player%::isowner} is not 1:
    88.                 message "succsefully left %{factions::%uuid of player%::factionname}%"
    89.                 set {factions::%uuid of player%::isowner} to 0
    90.                 set {factions::%uuid of player%::factionname} to "<none>"
    91.                 set {factions::%uuid of player%::factionlocation} to "<none>"
    92.                 set {factions::%uuid of player%::hasfaction} to 0
    93.                
    94.             else:
    95.                 message "you are the owner of %{factions::%uuid of player%::factionname}% not a member, do /fdelete instead"
    96.         else:
    97.             message "you aren't in a faction"
    98.  
    99. command /fsethome:
    100.     description: Sets your faction home
    101.     executable by: players
    102.     trigger:
    103.         if {factions::%uuid of player%::hasfaction} is 1:
    104.             if {factions::%uuid of player%::isowner} is 1:
    105.                 if "%block below player%" is not "air" or "lava":
    106.                     set {factions::%uuid of player%::faction location} to location of player
    107.                     message "set <lime>%{factions::%uuid of player%::factionname}%'s<reset> home to <grey>%location of player%<reset>"
    108.                 else:
    109.                     message "you arent standing in a safe location"
    110.  
    111. command /fhome:
    112.     description: Teleports you to your faction home
    113.     executable by: players
    114.     trigger:
    115.         if {factions::%uuid of player%::hasfaction} is 1:
    116.             message "Teleporting you to %{factions::%uuid of player%::factionname}%'s home"
    117.             teleport player to {factions::%uuid of player%::factionlocation}
    118.  
    119. command /finfo:
    120.     description: Prevides you with information about your current faction
    121.     executable by: players
    122.     trigger:
    123.         if {factions::%uuid of player%::hasfaction} is 1:
    124.             message "name: %{factions::%uuid of player%::factionname}%"
    125.             message "location: %{factions::%uuid of player%::factionlocation}%"
    126.             if {factions::%uuid of player%::isowner} is 1:
    127.                 message "You are the owner of %{factions::%uuid of player%::factionname}%"
    128.             else:
    129.                 message "you are a member of %{factions::%uuid of player%::factionname}%"
    130.         else:
    131.             message "you aren't in a faction"
    132.         message "this skript was written by mrclipse"
    133.  
    134. on chat:
    135.     if {factions::%uuid of player%::hasfaction} is 1:
    136.         cancel event
    137.         send "[%{factions::%uuid of player%::factionname}%] <%player%> %message%" to all players
    138.  
    139. on join:
    140.     set {factions::%uuid of player%::currentinvite} to "<none>"
    141.  
    142. command /fhelp:
    143.     trigger:
    144.         message "<green>/fcreate <faction name><reset> >> <green>creates a faction with the name specified and sets the home to your location<reset>"
    145.         message "<green>/fdelete<reset> >> <green>prompts you with confirmation to delete your faction<reset>"
    146.         message "<green>/fsethome<reset> >> <green>sets your faction home to your current location<reset>"
    147.         message "<green>/fhome<reset> >> <green>teleports you to your factions home<reset>"
    148.         message "<green>/finfo<reset> >> <green>shows info on the faction you are in<reset>"
    149.         message "<green>/fhelp<reset> >> <green>shows you the commands of mrclipse's faction plugin, you're looking at it right now!<reset>"
    150.  
    151. command /fdebug:
    152.     trigger:
    153.         message "%{factions::%uuid of player%::factionname}% %{factions::%uuid of player%::hasfaction}% %{factions::%uuid of player%::isowner}% %{factions::%uuid of player%::currentinvite}% %{factions::%uuid of player%::factionlocation}%"
     
    #1 mrclipse, Sep 19, 2021
    Last edited: Sep 19, 2021
  2. Minecoll_YT

    Supporter Forums Helper

    Joined:
    Dec 2, 2018
    Messages:
    650
    Likes Received:
    39
    Multiple questions first:
    1. Why are you using <green> instead of &2/§2 (and for other color codes)
    2. You know boolean exist... you do not have to use 0/1 for true or false

    Issues:
    1. You are missing a ":" on line 5
    2. There is a whitespace issue on line 6
    3. You didn't add the faction to the {factions::factionlist::*} variable
     
    mrclipse likes this.
  3. mrclipse

    mrclipse Member

    Joined:
    Sep 18, 2021
    Messages:
    11
    Likes Received:
    0
    Tysm!
    Is this better?

    Code (Text):
    1. command /fcreate [<text>]:
    2.     description: Creates a faction
    3.     executable by: players
    4.     trigger:
    5.         if {factions::factionlist::*} does not contain arg-1:
    6.             add arg-1 to {factions::factionlist::*}
    7.             if {factions::%uuid of player%::hasfaction} is not 1:
    8.                 if arg-1 is not "<none>":
    9.                     if arg-1 does not contain " ":
    10.                         set {factions::%uuid of player%::factionlocation} to location of player
    11.                         set {factions::%uuid of player%::factionname} to arg-1
    12.                         set {factions::%uuid of player%::isowner} to 1
    13.                         set {factions::%uuid of player%::hasfaction} to 1
    14.                         message "Created the faction <green>%arg-1%<reset> and set its home to your location"
    15.                     else:
    16.                         message "For technical reasons you can't use spaces in your faction, sorry!"
    17.                 else:
    18.                     message "For technical reasons you can't name your faction <none>, sorry!"
    19.             else:
    20.             message "You are already in a faction"
    21.         else:
    22.             message "That faction name is taken, sorry!"
    23.  
    24. command /invite [<player>]:
    25.     trigger:
    26.         if {factions::%uuid of player%::hasfaction} is 1:
    27.             if {factions::%uuid of player%::isowner} is 1:
    28.                 message "you invited %arg-1% to join %{factions::%uuid of player%::factionname}%"
    29.                 message "%player% invites you to join their faction, %{factions::%uuid of player%::factionname}%","to join type /join %{factions::%uuid of player%::factionname}%" to arg-1
    30.                 set {factions::%uuid of arg-1%::currentinvite} to {factions::%uuid of player%::factionname}
    31.                 set {factions::%uuid of arg-1%::invitelocation} to {factions::%uuid of player%::factionlocation}
    32.  
    33. command /join [<text>]:
    34.     trigger:
    35.         if {factions::%uuid of player%::currentinvite} is not "<none>":
    36.             if {factions::%uuid of player%::hasfaction} is not 1:
    37.                 if arg-1 is {factions::%uuid of player%::currentinvite}:
    38.                     set {factions::%uuid of player%::factionname} to {factions::%uuid of player%::currentinvite}
    39.                     set {factions::%uuid of player%::factionlocation} to {factions::%uuid of player%::invitelocation}
    40.                     set {factions::%uuid of player%::hasfaction} to 1
    41.                     set {factions::%uuid of player%::isowner} to 0
    42.                     set {factions::%uuid of player%::currentinvite} to "<none>"
    43.                     message "succsefully joined %{factions::%uuid of player%::factionname}%"
    44.             else:
    45.                 message "you are already in a faction"
    46.         else:
    47.             message "you are not currently invited to any factions"
    48. command /test:
    49.     trigger:
    50.         message "%{factions::%uuid of player%::currentinvite}%"
    51.  
    52. command /fdelete:
    53.     description: Deletes your faction
    54.     executable by: players
    55.     trigger:
    56.         if {factions::%uuid of player%::hasfaction} is 1:
    57.             if {factions::%uuid of player%::isowner} is 1:
    58.                 message "are you sure you want to <red><bold>delete<reset> %{factions::%uuid of player%::factionname}%?"
    59.                 message "this action <red><bold>cannot be undone<reset>"
    60.                 message "type /fconfirm delete <faction name> if you are sure"
    61.             else:
    62.                 message "you aren't the owner of this faction!"
    63.         else:
    64.             message "you don't have a faction"
    65.  
    66. command /fconfirm [<text>] [<text>]:
    67.     description: Confirms the deletion of your faction
    68.     executable by: players
    69.     trigger:
    70.         if "%arg-1%" is "delete":
    71.             if {factions::%uuid of player%::hasfaction} is 1:
    72.                 if {factions::%uuid of player%::isowner} is 1:
    73.                     if "%arg-2%" is {factions::%uuid of player%::factionname}:
    74.                         set {factions::%uuid of player%::hasfaction} to 0
    75.                         set {factions::%uuid of player%::factionname} to "<none>"
    76.                         set {factions::%uuid of player%::isowner} to 0
    77.                         set {factions::%uuid of player%::factionlocation} to "<none>"
    78.                     else:
    79.                         message "thats not your faction name try %{factions::%uuid of player%::factionname}%"
    80.                 else:
    81.                     message "you don't own %{factions::%uuid of player%::factionname}%"
    82.             else:
    83.                 message "you aren't in a faction"
    84. command /fleave:
    85.     trigger:
    86.         if {factions::%uuid of player%::hasfaction} is 1:
    87.             if {factions::%uuid of player%::isowner} is not 1:
    88.                 message "succsefully left %{factions::%uuid of player%::factionname}%"
    89.                 set {factions::%uuid of player%::isowner} to 0
    90.                 set {factions::%uuid of player%::factionname} to "<none>"
    91.                 set {factions::%uuid of player%::factionlocation} to "<none>"
    92.                 set {factions::%uuid of player%::hasfaction} to 0
    93.              
    94.             else:
    95.                 message "you are the owner of %{factions::%uuid of player%::factionname}% not a member, do /fdelete instead"
    96.         else:
    97.             message "you aren't in a faction"
    98.  
    99. command /fsethome:
    100.     description: Sets your faction home
    101.     executable by: players
    102.     trigger:
    103.         if {factions::%uuid of player%::hasfaction} is 1:
    104.             if {factions::%uuid of player%::isowner} is 1:
    105.                 if "%block below player%" is not "air" or "lava":
    106.                     set {factions::%uuid of player%::faction location} to location of player
    107.                     message "set <lime>%{factions::%uuid of player%::factionname}%'s<reset> home to <grey>%location of player%<reset>"
    108.                 else:
    109.                     message "you arent standing in a safe location"
    110.  
    111. command /fhome:
    112.     description: Teleports you to your faction home
    113.     executable by: players
    114.     trigger:
    115.         if {factions::%uuid of player%::hasfaction} is 1:
    116.             message "Teleporting you to %{factions::%uuid of player%::factionname}%'s home"
    117.             teleport player to {factions::%uuid of player%::factionlocation}
    118.  
    119. command /finfo:
    120.     description: Prevides you with information about your current faction
    121.     executable by: players
    122.     trigger:
    123.         if {factions::%uuid of player%::hasfaction} is 1:
    124.             message "name: %{factions::%uuid of player%::factionname}%"
    125.             message "location: %{factions::%uuid of player%::factionlocation}%"
    126.             if {factions::%uuid of player%::isowner} is 1:
    127.                 message "You are the owner of %{factions::%uuid of player%::factionname}%"
    128.             else:
    129.                 message "you are a member of %{factions::%uuid of player%::factionname}%"
    130.         else:
    131.             message "you aren't in a faction"
    132.         message "this skript was written by mrclipse"
    133.  
    134. on chat:
    135.     if {factions::%uuid of player%::hasfaction} is 1:
    136.         cancel event
    137.         send "[%{factions::%uuid of player%::factionname}%] <%player%> %message%" to all players
    138.  
    139. on join:
    140.     set {factions::%uuid of player%::currentinvite} to "<none>"
    141.  
    142. command /fhelp:
    143.     trigger:
    144.         message "<green>/fcreate <faction name><reset> >> <green>creates a faction with the name specified and sets the home to your location<reset>"
    145.         message "<green>/fdelete<reset> >> <green>prompts you with confirmation to delete your faction<reset>"
    146.         message "<green>/fsethome<reset> >> <green>sets your faction home to your current location<reset>"
    147.         message "<green>/fhome<reset> >> <green>teleports you to your factions home<reset>"
    148.         message "<green>/finfo<reset> >> <green>shows info on the faction you are in<reset>"
    149.         message "<green>/fhelp<reset> >> <green>shows you the commands of mrclipse's faction plugin, you're looking at it right now!<reset>"
    150.  
    151. command /fdebug:
    152.     trigger:
    153.         message "%{factions::%uuid of player%::factionname}% %{factions::%uuid of player%::hasfaction}% %{factions::%uuid of player%::isowner}% %{factions::%uuid of player%::currentinvite}% %{factions::%uuid of player%::factionlocation}%"
    --- Double Post Merged, Sep 19, 2021, Original Post Date: Sep 19, 2021 ---
    I had two tabs of this thread one from before your reply and one from after, I changed something in my skript and went to change it in the reply to your comment, but clicked on the old one, and accidentally edited the original post ):
    --- Double Post Merged, Sep 19, 2021 ---
    im stuck again ):
    --- Double Post Merged, Sep 19, 2021 ---
    Code (Text):
    1. command /fcreate [<text>]:
    2.     description: Creates a faction
    3.     executable by: players
    4.     trigger:
    5.         if {factions::factionlist::*} does not contain arg-1:
    6.             add arg-1 to {factions::factionlist::*}
    7.             if {factions::%uuid of player%::hasfaction} is not 1:
    8.                 if arg-1 is not "<none>":
    9.                     if arg-1 does not contain " ":
    10.                         set {factions::%uuid of player%::factionlocation} to location of player
    11.                         set {factions::%uuid of player%::factionname} to arg-1
    12.                         set {factions::%uuid of player%::isowner} to 1
    13.                         set {factions::%uuid of player%::hasfaction} to 1
    14.                         message "Created the faction <green>%arg-1%<reset> and set its home to your location"
    15.                     else:
    16.                         message "For technical reasons you can't use spaces in your faction, sorry!"
    17.                 else:
    18.                     message "For technical reasons you can't name your faction <none>, sorry!"
    19.             else:
    20.             message "You are already in a faction"
    21.         else:
    22.             message "That faction name is taken, sorry!"
    23.  
    24. command /invite [<player>]:
    25.     trigger:
    26.         if {factions::%uuid of player%::hasfaction} is 1:
    27.             if {factions::%uuid of player%::isowner} is 1:
    28.                 message "you invited %arg-1% to join %{factions::%uuid of player%::factionname}%"
    29.                 message "%player% invites you to join their faction, %{factions::%uuid of player%::factionname}%","to join type /join %{factions::%uuid of player%::factionname}%" to arg-1
    30.                 set {factions::%uuid of arg-1%::currentinvite} to {factions::%uuid of player%::factionname}
    31.                 set {factions::%uuid of arg-1%::invitelocation} to {factions::%uuid of player%::factionlocation}
    32.  
    33. command /join [<text>]:
    34.     trigger:
    35.         if {factions::%uuid of player%::currentinvite} is not "<none>":
    36.             if {factions::%uuid of player%::hasfaction} is not 1:
    37.                 if arg-1 is {factions::%uuid of player%::currentinvite}:
    38.                     set {factions::%uuid of player%::factionname} to {factions::%uuid of player%::currentinvite}
    39.                     set {factions::%uuid of player%::factionlocation} to {factions::%uuid of player%::invitelocation}
    40.                     add "%uuid of player%" to {factions::%factionname%::playerlist}
    41.                     set {factions::%uuid of player%::hasfaction} to 1
    42.                     set {factions::%uuid of player%::isowner} to 0
    43.                     set {factions::%uuid of player%::currentinvite} to "<none>"
    44.                     message "succsefully joined %{factions::%uuid of player%::factionname}%"
    45.                     message "debug: %{factions::%factionname%::playerlist}%"
    46.             else:
    47.                 message "you are already in a faction"
    48.         else:
    49.             message "you are not currently invited to any factions"
    50. command /test:
    51.     trigger:
    52.         message "%{factions::%uuid of player%::currentinvite}%"
    53.  
    54. command /fdelete:
    55.     description: Deletes your faction
    56.     executable by: players
    57.     trigger:
    58.         if {factions::%uuid of player%::hasfaction} is 1:
    59.             if {factions::%uuid of player%::isowner} is 1:
    60.                 message "are you sure you want to <red><bold>delete<reset> %{factions::%uuid of player%::factionname}%?"
    61.                 message "this action <red><bold>cannot be undone<reset>"
    62.                 message "type /fconfirm delete <faction name> if you are sure"
    63.             else:
    64.                 message "you aren't the owner of this faction!"
    65.         else:
    66.             message "you don't have a faction"
    67.  
    68. command /fconfirm [<text>] [<text>]:
    69.     description: Confirms the deletion of your faction
    70.     executable by: players
    71.     trigger:
    72.         if "%arg-1%" is "delete":
    73.             if {factions::%uuid of player%::hasfaction} is 1:
    74.                 if {factions::%uuid of player%::isowner} is 1:
    75.                     if "%arg-2%" is {factions::%uuid of player%::factionname}:
    76.                         set {factions::%uuid of player%::hasfaction} to 0
    77.                         set {factions::%uuid of player%::factionname} to "<none>"
    78.                         set {factions::%uuid of player%::isowner} to 0
    79.                         set {factions::%uuid of player%::factionlocation} to "<none>"
    80.                     else:
    81.                         message "thats not your faction name try %{factions::%uuid of player%::factionname}%"
    82.                 else:
    83.                     message "you don't own %{factions::%uuid of player%::factionname}%"
    84.             else:
    85.                 message "you aren't in a faction"
    86. command /fleave:
    87.     trigger:
    88.         if {factions::%uuid of player%::hasfaction} is 1:
    89.             if {factions::%uuid of player%::isowner} is not 1:
    90.                 message "succsefully left %{factions::%uuid of player%::factionname}%"
    91.                 set {factions::%uuid of player%::isowner} to 0
    92.                 set {factions::%uuid of player%::factionname} to "<none>"
    93.                 set {factions::%uuid of player%::factionlocation} to "<none>"
    94.                 set {factions::%uuid of player%::hasfaction} to 0
    95.                
    96.             else:
    97.                 message "you are the owner of %{factions::%uuid of player%::factionname}% not a member, do /fdelete instead"
    98.         else:
    99.             message "you aren't in a faction"
    100.  
    101. command /fsethome:
    102.     description: Sets your faction home
    103.     executable by: players
    104.     trigger:
    105.         if {factions::%uuid of player%::hasfaction} is 1:
    106.             if {factions::%uuid of player%::isowner} is 1:
    107.                 if "%block below player%" is not "air" or "lava":
    108.                     set {factions::%uuid of player%::faction location} to location of player
    109.                     message "set <lime>%{factions::%uuid of player%::factionname}%'s<reset> home to <grey>%location of player%<reset>"
    110.                 else:
    111.                     message "you arent standing in a safe location"
    112.  
    113. command /fhome:
    114.     description: Teleports you to your faction home
    115.     executable by: players
    116.     trigger:
    117.         if {factions::%uuid of player%::hasfaction} is 1:
    118.             message "Teleporting you to %{factions::%uuid of player%::factionname}%'s home"
    119.             teleport player to {factions::%uuid of player%::factionlocation}
    120.  
    121. command /finfo:
    122.     description: Prevides you with information about your current faction
    123.     executable by: players
    124.     trigger:
    125.         if {factions::%uuid of player%::hasfaction} is 1:
    126.             message "name: %{factions::%uuid of player%::factionname}%"
    127.             message "location: %{factions::%uuid of player%::factionlocation}%"
    128.             if {factions::%uuid of player%::isowner} is 1:
    129.                 message "You are the owner of %{factions::%uuid of player%::factionname}%"
    130.             else:
    131.                 message "you are a member of %{factions::%uuid of player%::factionname}%"
    132.         else:
    133.             message "you aren't in a faction"
    134.         message "this skript was written by mrclipse"
    135.  
    136. on chat:
    137.     if {factions::%uuid of player%::hasfaction} is 1:
    138.         cancel event
    139.         send "[%{factions::%uuid of player%::factionname}%] <%player%> %message%" to all players
    140.  
    141. on join:
    142.     set {factions::%uuid of player%::currentinvite} to "<none>"
    143.  
    144. command /fhelp:
    145.     trigger:
    146.         message "<green>/fcreate <faction name><reset> >> <green>creates a faction with the name specified and sets the home to your location<reset>"
    147.         message "<green>/fdelete<reset> >> <green>prompts you with confirmation to delete your faction<reset>"
    148.         message "<green>/fsethome<reset> >> <green>sets your faction home to your current location<reset>"
    149.         message "<green>/fhome<reset> >> <green>teleports you to your factions home<reset>"
    150.         message "<green>/finfo<reset> >> <green>shows info on the faction you are in<reset>"
    151.         message "<green>/fhelp<reset> >> <green>shows you the commands of mrclipse's faction plugin, you're looking at it right now!<reset>"
    152.  
    153. command /fdebug:
    154.     trigger:
    155.         message "%{factions::%uuid of player%::factionname}% %{factions::%uuid of player%::hasfaction}% %{factions::%uuid of player%::isowner}% %{factions::%uuid of player%::currentinvite}% %{factions::%uuid of player%::factionlocation}%"
    --- Double Post Merged, Sep 19, 2021 ---
    In line 40, I want to add the players name to a list, so they can be removed from the faction when it is deleted.

    Like, when they do /join and it sets their variables i want it to add the players username or uuid to a list so when the owner types /fconfirtm delete [faction name] it removes all of the members on this list so there aren't members without an owner
    --- Double Post Merged, Sep 19, 2021 ---
    https://forums.skunity.com/threads/list-contains-a-value.3527/
    --- Double Post Merged, Sep 19, 2021 ---
    Code (Text):
    1. #https://forums.skunity.com/threads/rezzs-snippets-things-you-can-do-in-pure-skript-2-2.2471/
    2. #TYSM Rezz
    3. function contains(list: objects, check: object) :: boolean:
    4.     loop {_list::*}:
    5.         if loop-value is {_check}:
    6.             return true
    7.     return false
    8. #example:
    9. #add "a", "bunch", "of", "list", "items", "to", and "check" to {_list::*}
    10.  #
    11. #if contains({_list::*}, "check") is true:
    12. #    send "Yep! The list does indeed contain 'check'"
    13.  
    14.  
    15.  
    16. command /fcreate [<text>]:
    17.     description: Creates a faction
    18.     executable by: players
    19.     trigger:
    20.         if {factions::factionlist::*} does not contain arg-1:
    21.             add arg-1 to {factions::factionlist::*}
    22.             if {factions::%uuid of player%::hasfaction} is not 1:
    23.                 if arg-1 is not "<none>":
    24.                     if arg-1 does not contain " ":
    25.                         set {factions::%uuid of player%::factionlocation} to location of player
    26.                         set {factions::%uuid of player%::factionname} to arg-1
    27.                         set {factions::%uuid of player%::isowner} to 1
    28.                         set {factions::%uuid of player%::hasfaction} to 1
    29.                         message "Created the faction <green>%arg-1%<reset> and set its home to your location"
    30.                     else:
    31.                         message "For technical reasons you can't use spaces in your faction, sorry!"
    32.                 else:
    33.                     message "For technical reasons you can't name your faction <none>, sorry!"
    34.             else:
    35.                 message "You are already in a faction"
    36.         else:
    37.             message "That faction name is taken, sorry!"
    38.  
    39. command /invite [<player>]:
    40.     trigger:
    41.         if {factions::%uuid of player%::hasfaction} is 1:
    42.             if {factions::%uuid of player%::isowner} is 1:
    43.                 message "you invited %arg-1% to join %{factions::%uuid of player%::factionname}%"
    44.                 message "%player% invites you to join their faction, %{factions::%uuid of player%::factionname}%","to join type /join %{factions::%uuid of player%::factionname}%" to arg-1
    45.                 set {factions::%uuid of arg-1%::currentinvite} to {factions::%uuid of player%::factionname}
    46.                 set {factions::%uuid of arg-1%::invitelocation} to {factions::%uuid of player%::factionlocation}
    47.  
    48. command /join [<text>]:
    49.     trigger:
    50.         if {factions::%uuid of player%::currentinvite} is not "<none>":
    51.             if {factions::%uuid of player%::hasfaction} is not 1:
    52.                 if arg-1 is {factions::%uuid of player%::currentinvite}:
    53.                     set {factions::%uuid of player%::factionname} to {factions::%uuid of player%::currentinvite}
    54.                     set {factions::%uuid of player%::factionlocation} to {factions::%uuid of player%::invitelocation}
    55.                     add "%uuid of player%" to {factions::%{factions::%uuid of player%::factionname}%::playerlist::*}
    56.                     set {factions::%uuid of player%::hasfaction} to 1
    57.                     set {factions::%uuid of player%::isowner} to 0
    58.                     set {factions::%uuid of player%::currentinvite} to "<none>"
    59.                     message "succsefully joined %{factions::%uuid of player%::factionname}%"
    60.                     message "debug: %{factions::%{factions::%uuid of player%::factionname}%::playerlist::*}%"
    61.             else:
    62.                 message "you are already in a faction"
    63.         else:
    64.             message "you are not currently invited to %arg-1%"
    65.  
    66. command /test:
    67.     trigger:
    68.         message "%{factions::%uuid of player%::currentinvite}%"
    69.  
    70. command /fdelete:
    71.     description: Deletes your faction
    72.     executable by: players
    73.     trigger:
    74.         if {factions::%uuid of player%::hasfaction} is 1:
    75.             if {factions::%uuid of player%::isowner} is 1:
    76.                 message "are you sure you want to <red><bold>delete<reset> %{factions::%uuid of player%::factionname}%?"
    77.                 message "this action <red><bold>cannot be undone<reset>"
    78.                 message "type /fconfirm delete <faction name> if you are sure"
    79.             else:
    80.                 message "you aren't the owner of this faction!"
    81.         else:
    82.             message "you don't have a faction"
    83.  
    84. command /fconfirm [<text>] [<text>]:
    85.     description: Confirms the deletion of your faction
    86.     executable by: players
    87.     trigger:
    88.         if "%arg-1%" is "delete":
    89.             if {factions::%uuid of player%::hasfaction} is 1:
    90.                 if {factions::%uuid of player%::isowner} is 1:
    91.                     if "%arg-2%" is {factions::%uuid of player%::factionname}:
    92.                         remove {factions::%uuid of player%::factionname} from {factions::factionlist::*}
    93.                         set {factions::%uuid of player%::hasfaction} to 0
    94.                         set {factions::%uuid of player%::factionname} to "<none>"
    95.                         set {factions::%uuid of player%::isowner} to 0
    96.                         set {factions::%uuid of player%::factionlocation} to "<none>"
    97.                     else:
    98.                         message "thats not your faction name try %{factions::%uuid of player%::factionname}%"
    99.                 else:
    100.                     message "you don't own %{factions::%uuid of player%::factionname}%"
    101.             else:
    102.                 message "you aren't in a faction"
    103. command /fleave:
    104.     trigger:
    105.         if {factions::%uuid of player%::hasfaction} is 1:
    106.             if {factions::%uuid of player%::isowner} is not 1:
    107.                 message "succsefully left %{factions::%uuid of player%::factionname}%"
    108.                 set {factions::%uuid of player%::isowner} to 0
    109.                 set {factions::%uuid of player%::factionname} to "<none>"
    110.                 set {factions::%uuid of player%::factionlocation} to "<none>"
    111.                 set {factions::%uuid of player%::hasfaction} to 0
    112.                
    113.             else:
    114.                 message "you are the owner of %{factions::%uuid of player%::factionname}% not a member, do /fdelete instead"
    115.         else:
    116.             message "you aren't in a faction"
    117.  
    118. command /fsethome:
    119.     description: Sets your faction home
    120.     executable by: players
    121.     trigger:
    122.         if {factions::%uuid of player%::hasfaction} is 1:
    123.             if {factions::%uuid of player%::isowner} is 1:
    124.                 if "%block below player%" is not "air" or "lava":
    125.                     set {factions::%uuid of player%::faction location} to location of player
    126.                     message "set <lime>%{factions::%uuid of player%::factionname}%'s<reset> home to <grey>%location of player%<reset>"
    127.                 else:
    128.                     message "you arent standing in a safe location"
    129.  
    130. command /fhome:
    131.     description: Teleports you to your faction home
    132.     executable by: players
    133.     trigger:
    134.         if {factions::%uuid of player%::hasfaction} is 1:
    135.             message "Teleporting you to %{factions::%uuid of player%::factionname}%'s home"
    136.             teleport player to {factions::%uuid of player%::factionlocation}
    137.  
    138. command /finfo:
    139.     description: Prevides you with information about your current faction
    140.     executable by: players
    141.     trigger:
    142.         if {factions::%uuid of player%::hasfaction} is 1:
    143.             message "name: %{factions::%uuid of player%::factionname}%"
    144.             message "location: %{factions::%uuid of player%::factionlocation}%"
    145.             if {factions::%uuid of player%::isowner} is 1:
    146.                 message "You are the owner of %{factions::%uuid of player%::factionname}%"
    147.             else:
    148.                 message "you are a member of %{factions::%uuid of player%::factionname}%"
    149.         else:
    150.             message "you aren't in a faction"
    151.         message "this skript was written by mrclipse"
    152.  
    153. on chat:
    154.     if {factions::%uuid of player%::hasfaction} is 1:
    155.         cancel event
    156.         send "[%{factions::%uuid of player%::factionname}%] <%player%> %message%" to all players
    157.  
    158. on join:
    159.     set {factions::%uuid of player%::currentinvite} to "<none>"
    160.  
    161. command /fhelp:
    162.     trigger:
    163.         message "<green>/fcreate <faction name><reset> >> <green>creates a faction with the name specified and sets the home to your location<reset>"
    164.         message "<green>/fdelete<reset> >> <green>prompts you with confirmation to delete your faction<reset>"
    165.         message "<green>/fsethome<reset> >> <green>sets your faction home to your current location<reset>"
    166.         message "<green>/fhome<reset> >> <green>teleports you to your factions home<reset>"
    167.         message "<green>/finfo<reset> >> <green>shows info on the faction you are in<reset>"
    168.         message "<green>/fhelp<reset> >> <green>shows you the commands of mrclipse's faction plugin, you're looking at it right now!<reset>"
    169.  
    170. command /fdebug:
    171.     trigger:
    172.         message "%{factions::%uuid of player%::factionname}% %{factions::%uuid of player%::hasfaction}% %{factions::%uuid of player%::isowner}% %{factions::%uuid of player%::currentinvite}% %{factions::%uuid of player%::factionlocation}%"
    173.  
    174. command /flist:
    175.     permission: skript.factions.admin
    176.     trigger:
    177.         message "%{factions::factionlist::*}%"
    178.  
    179. command /fremove [<text>]:
    180.     permission: skript.factions.admin
    181.     trigger:
    182.         if contains({factions::factionlist::*}, "%arg-1%") is true:
    183.             remove arg-1 from {factions::factionlist::*}
    184.             message "removed %arg-1% from {factions::factionlist::*}"
    185.         else:
    186.             message "{factions::factionlist::*} doesn't contain %arg-1%"
     
Thread Status:
Not open for further replies.

Share This Page

Loading...