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

Status
Not open for further replies.

mrclipse

Member
Sep 18, 2021
11
0
1
5111 98th St, Lubbock, TX 79424
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:
command /fcreate [<text>]:
    description: Creates a faction
    executable by: players
    trigger:
        if {factions::factionlist::*} does not contain arg-1:
            add arg-1 to {factions::factionlist::*}
            if {factions::%uuid of player%::hasfaction} is not 1:
                if arg-1 is not "<none>":
                    if arg-1 does not contain " ":
                        set {factions::%uuid of player%::factionlocation} to location of player
                        set {factions::%uuid of player%::factionname} to arg-1
                        set {factions::%uuid of player%::isowner} to 1
                        set {factions::%uuid of player%::hasfaction} to 1
                        message "Created the faction <green>%arg-1%<reset> and set its home to your location"
                    else:
                        message "For technical reasons you can't use spaces in your faction, sorry!" 
                else:
                    message "For technical reasons you can't name your faction <none>, sorry!"
            else:
            message "You are already in a faction"
        else:
            message "That faction name is taken, sorry!"

command /invite [<player>]:
    trigger:
        if {factions::%uuid of player%::hasfaction} is 1:
            if {factions::%uuid of player%::isowner} is 1:
                message "you invited %arg-1% to join %{factions::%uuid of player%::factionname}%"
                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
                set {factions::%uuid of arg-1%::currentinvite} to {factions::%uuid of player%::factionname}
                set {factions::%uuid of arg-1%::invitelocation} to {factions::%uuid of player%::factionlocation}

command /join [<text>]:
    trigger:
        if {factions::%uuid of player%::currentinvite} is not "<none>":
            if {factions::%uuid of player%::hasfaction} is not 1:
                if arg-1 is {factions::%uuid of player%::currentinvite}:
                    set {factions::%uuid of player%::factionname} to {factions::%uuid of player%::currentinvite}
                    set {factions::%uuid of player%::factionlocation} to {factions::%uuid of player%::invitelocation}
                    set {factions::%uuid of player%::hasfaction} to 1
                    set {factions::%uuid of player%::isowner} to 0
                    set {factions::%uuid of player%::currentinvite} to "<none>"
                    message "succsefully joined %{factions::%uuid of player%::factionname}%"
            else:
                message "you are already in a faction"
        else:
            message "you are not currently invited to any factions"
command /test:
    trigger:
        message "%{factions::%uuid of player%::currentinvite}%"

command /fdelete:
    description: Deletes your faction
    executable by: players
    trigger:
        if {factions::%uuid of player%::hasfaction} is 1:
            if {factions::%uuid of player%::isowner} is 1:
                message "are you sure you want to <red><bold>delete<reset> %{factions::%uuid of player%::factionname}%?"
                message "this action <red><bold>cannot be undone<reset>"
                message "type /fconfirm delete <faction name> if you are sure"
            else:
                message "you aren't the owner of this faction!"
        else:
            message "you don't have a faction"

command /fconfirm [<text>] [<text>]:
    description: Confirms the deletion of your faction
    executable by: players
    trigger:
        if "%arg-1%" is "delete":
            if {factions::%uuid of player%::hasfaction} is 1:
                if {factions::%uuid of player%::isowner} is 1:
                    if "%arg-2%" is {factions::%uuid of player%::factionname}:
                        set {factions::%uuid of player%::hasfaction} to 0
                        set {factions::%uuid of player%::factionname} to "<none>"
                        set {factions::%uuid of player%::isowner} to 0
                        set {factions::%uuid of player%::factionlocation} to "<none>"
                    else:
                        message "thats not your faction name try %{factions::%uuid of player%::factionname}%"
                else:
                    message "you don't own %{factions::%uuid of player%::factionname}%"
            else:
                message "you aren't in a faction"
command /fleave:
    trigger:
        if {factions::%uuid of player%::hasfaction} is 1:
            if {factions::%uuid of player%::isowner} is not 1:
                message "succsefully left %{factions::%uuid of player%::factionname}%"
                set {factions::%uuid of player%::isowner} to 0
                set {factions::%uuid of player%::factionname} to "<none>"
                set {factions::%uuid of player%::factionlocation} to "<none>"
                set {factions::%uuid of player%::hasfaction} to 0
               
            else:
                message "you are the owner of %{factions::%uuid of player%::factionname}% not a member, do /fdelete instead"
        else:
            message "you aren't in a faction"

command /fsethome:
    description: Sets your faction home
    executable by: players
    trigger:
        if {factions::%uuid of player%::hasfaction} is 1:
            if {factions::%uuid of player%::isowner} is 1:
                if "%block below player%" is not "air" or "lava":
                    set {factions::%uuid of player%::faction location} to location of player
                    message "set <lime>%{factions::%uuid of player%::factionname}%'s<reset> home to <grey>%location of player%<reset>"
                else:
                    message "you arent standing in a safe location"

command /fhome:
    description: Teleports you to your faction home
    executable by: players
    trigger:
        if {factions::%uuid of player%::hasfaction} is 1:
            message "Teleporting you to %{factions::%uuid of player%::factionname}%'s home"
            teleport player to {factions::%uuid of player%::factionlocation}

command /finfo:
    description: Prevides you with information about your current faction
    executable by: players
    trigger:
        if {factions::%uuid of player%::hasfaction} is 1:
            message "name: %{factions::%uuid of player%::factionname}%"
            message "location: %{factions::%uuid of player%::factionlocation}%"
            if {factions::%uuid of player%::isowner} is 1:
                message "You are the owner of %{factions::%uuid of player%::factionname}%"
            else:
                message "you are a member of %{factions::%uuid of player%::factionname}%"
        else:
            message "you aren't in a faction"
        message "this skript was written by mrclipse"

on chat:
    if {factions::%uuid of player%::hasfaction} is 1:
        cancel event
        send "[%{factions::%uuid of player%::factionname}%] <%player%> %message%" to all players

on join:
    set {factions::%uuid of player%::currentinvite} to "<none>"

command /fhelp:
    trigger:
        message "<green>/fcreate <faction name><reset> >> <green>creates a faction with the name specified and sets the home to your location<reset>"
        message "<green>/fdelete<reset> >> <green>prompts you with confirmation to delete your faction<reset>"
        message "<green>/fsethome<reset> >> <green>sets your faction home to your current location<reset>"
        message "<green>/fhome<reset> >> <green>teleports you to your factions home<reset>"
        message "<green>/finfo<reset> >> <green>shows info on the faction you are in<reset>"
        message "<green>/fhelp<reset> >> <green>shows you the commands of mrclipse's faction plugin, you're looking at it right now!<reset>"

command /fdebug:
    trigger:
        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}%"
 
Last edited:
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
 
  • Like
Reactions: mrclipse
Tysm!
Is this better?

Code:
command /fcreate [<text>]:
    description: Creates a faction
    executable by: players
    trigger:
        if {factions::factionlist::*} does not contain arg-1:
            add arg-1 to {factions::factionlist::*}
            if {factions::%uuid of player%::hasfaction} is not 1:
                if arg-1 is not "<none>":
                    if arg-1 does not contain " ":
                        set {factions::%uuid of player%::factionlocation} to location of player
                        set {factions::%uuid of player%::factionname} to arg-1
                        set {factions::%uuid of player%::isowner} to 1
                        set {factions::%uuid of player%::hasfaction} to 1
                        message "Created the faction <green>%arg-1%<reset> and set its home to your location"
                    else:
                        message "For technical reasons you can't use spaces in your faction, sorry!"
                else:
                    message "For technical reasons you can't name your faction <none>, sorry!"
            else:
            message "You are already in a faction"
        else:
            message "That faction name is taken, sorry!"

command /invite [<player>]:
    trigger:
        if {factions::%uuid of player%::hasfaction} is 1:
            if {factions::%uuid of player%::isowner} is 1:
                message "you invited %arg-1% to join %{factions::%uuid of player%::factionname}%"
                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
                set {factions::%uuid of arg-1%::currentinvite} to {factions::%uuid of player%::factionname}
                set {factions::%uuid of arg-1%::invitelocation} to {factions::%uuid of player%::factionlocation}

command /join [<text>]:
    trigger:
        if {factions::%uuid of player%::currentinvite} is not "<none>":
            if {factions::%uuid of player%::hasfaction} is not 1:
                if arg-1 is {factions::%uuid of player%::currentinvite}:
                    set {factions::%uuid of player%::factionname} to {factions::%uuid of player%::currentinvite}
                    set {factions::%uuid of player%::factionlocation} to {factions::%uuid of player%::invitelocation}
                    set {factions::%uuid of player%::hasfaction} to 1
                    set {factions::%uuid of player%::isowner} to 0
                    set {factions::%uuid of player%::currentinvite} to "<none>"
                    message "succsefully joined %{factions::%uuid of player%::factionname}%"
            else:
                message "you are already in a faction"
        else:
            message "you are not currently invited to any factions"
command /test:
    trigger:
        message "%{factions::%uuid of player%::currentinvite}%"

command /fdelete:
    description: Deletes your faction
    executable by: players
    trigger:
        if {factions::%uuid of player%::hasfaction} is 1:
            if {factions::%uuid of player%::isowner} is 1:
                message "are you sure you want to <red><bold>delete<reset> %{factions::%uuid of player%::factionname}%?"
                message "this action <red><bold>cannot be undone<reset>"
                message "type /fconfirm delete <faction name> if you are sure"
            else:
                message "you aren't the owner of this faction!"
        else:
            message "you don't have a faction"

command /fconfirm [<text>] [<text>]:
    description: Confirms the deletion of your faction
    executable by: players
    trigger:
        if "%arg-1%" is "delete":
            if {factions::%uuid of player%::hasfaction} is 1:
                if {factions::%uuid of player%::isowner} is 1:
                    if "%arg-2%" is {factions::%uuid of player%::factionname}:
                        set {factions::%uuid of player%::hasfaction} to 0
                        set {factions::%uuid of player%::factionname} to "<none>"
                        set {factions::%uuid of player%::isowner} to 0
                        set {factions::%uuid of player%::factionlocation} to "<none>"
                    else:
                        message "thats not your faction name try %{factions::%uuid of player%::factionname}%"
                else:
                    message "you don't own %{factions::%uuid of player%::factionname}%"
            else:
                message "you aren't in a faction"
command /fleave:
    trigger:
        if {factions::%uuid of player%::hasfaction} is 1:
            if {factions::%uuid of player%::isowner} is not 1:
                message "succsefully left %{factions::%uuid of player%::factionname}%"
                set {factions::%uuid of player%::isowner} to 0
                set {factions::%uuid of player%::factionname} to "<none>"
                set {factions::%uuid of player%::factionlocation} to "<none>"
                set {factions::%uuid of player%::hasfaction} to 0
             
            else:
                message "you are the owner of %{factions::%uuid of player%::factionname}% not a member, do /fdelete instead"
        else:
            message "you aren't in a faction"

command /fsethome:
    description: Sets your faction home
    executable by: players
    trigger:
        if {factions::%uuid of player%::hasfaction} is 1:
            if {factions::%uuid of player%::isowner} is 1:
                if "%block below player%" is not "air" or "lava":
                    set {factions::%uuid of player%::faction location} to location of player
                    message "set <lime>%{factions::%uuid of player%::factionname}%'s<reset> home to <grey>%location of player%<reset>"
                else:
                    message "you arent standing in a safe location"

command /fhome:
    description: Teleports you to your faction home
    executable by: players
    trigger:
        if {factions::%uuid of player%::hasfaction} is 1:
            message "Teleporting you to %{factions::%uuid of player%::factionname}%'s home"
            teleport player to {factions::%uuid of player%::factionlocation}

command /finfo:
    description: Prevides you with information about your current faction
    executable by: players
    trigger:
        if {factions::%uuid of player%::hasfaction} is 1:
            message "name: %{factions::%uuid of player%::factionname}%"
            message "location: %{factions::%uuid of player%::factionlocation}%"
            if {factions::%uuid of player%::isowner} is 1:
                message "You are the owner of %{factions::%uuid of player%::factionname}%"
            else:
                message "you are a member of %{factions::%uuid of player%::factionname}%"
        else:
            message "you aren't in a faction"
        message "this skript was written by mrclipse"

on chat:
    if {factions::%uuid of player%::hasfaction} is 1:
        cancel event
        send "[%{factions::%uuid of player%::factionname}%] <%player%> %message%" to all players

on join:
    set {factions::%uuid of player%::currentinvite} to "<none>"

command /fhelp:
    trigger:
        message "<green>/fcreate <faction name><reset> >> <green>creates a faction with the name specified and sets the home to your location<reset>"
        message "<green>/fdelete<reset> >> <green>prompts you with confirmation to delete your faction<reset>"
        message "<green>/fsethome<reset> >> <green>sets your faction home to your current location<reset>"
        message "<green>/fhome<reset> >> <green>teleports you to your factions home<reset>"
        message "<green>/finfo<reset> >> <green>shows info on the faction you are in<reset>"
        message "<green>/fhelp<reset> >> <green>shows you the commands of mrclipse's faction plugin, you're looking at it right now!<reset>"

command /fdebug:
    trigger:
        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}%"
[doublepost=1632073550,1632072444][/doublepost]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 ):
[doublepost=1632074406][/doublepost]im stuck again ):
[doublepost=1632074443][/doublepost]
Code:
command /fcreate [<text>]:
    description: Creates a faction
    executable by: players
    trigger:
        if {factions::factionlist::*} does not contain arg-1:
            add arg-1 to {factions::factionlist::*}
            if {factions::%uuid of player%::hasfaction} is not 1:
                if arg-1 is not "<none>":
                    if arg-1 does not contain " ":
                        set {factions::%uuid of player%::factionlocation} to location of player
                        set {factions::%uuid of player%::factionname} to arg-1
                        set {factions::%uuid of player%::isowner} to 1
                        set {factions::%uuid of player%::hasfaction} to 1
                        message "Created the faction <green>%arg-1%<reset> and set its home to your location"
                    else:
                        message "For technical reasons you can't use spaces in your faction, sorry!" 
                else:
                    message "For technical reasons you can't name your faction <none>, sorry!"
            else:
            message "You are already in a faction"
        else:
            message "That faction name is taken, sorry!"

command /invite [<player>]:
    trigger:
        if {factions::%uuid of player%::hasfaction} is 1:
            if {factions::%uuid of player%::isowner} is 1:
                message "you invited %arg-1% to join %{factions::%uuid of player%::factionname}%"
                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
                set {factions::%uuid of arg-1%::currentinvite} to {factions::%uuid of player%::factionname}
                set {factions::%uuid of arg-1%::invitelocation} to {factions::%uuid of player%::factionlocation}

command /join [<text>]:
    trigger:
        if {factions::%uuid of player%::currentinvite} is not "<none>":
            if {factions::%uuid of player%::hasfaction} is not 1:
                if arg-1 is {factions::%uuid of player%::currentinvite}:
                    set {factions::%uuid of player%::factionname} to {factions::%uuid of player%::currentinvite}
                    set {factions::%uuid of player%::factionlocation} to {factions::%uuid of player%::invitelocation}
                    add "%uuid of player%" to {factions::%factionname%::playerlist}
                    set {factions::%uuid of player%::hasfaction} to 1
                    set {factions::%uuid of player%::isowner} to 0
                    set {factions::%uuid of player%::currentinvite} to "<none>"
                    message "succsefully joined %{factions::%uuid of player%::factionname}%"
                    message "debug: %{factions::%factionname%::playerlist}%"
            else:
                message "you are already in a faction"
        else:
            message "you are not currently invited to any factions"
command /test:
    trigger:
        message "%{factions::%uuid of player%::currentinvite}%"

command /fdelete:
    description: Deletes your faction
    executable by: players
    trigger:
        if {factions::%uuid of player%::hasfaction} is 1:
            if {factions::%uuid of player%::isowner} is 1:
                message "are you sure you want to <red><bold>delete<reset> %{factions::%uuid of player%::factionname}%?"
                message "this action <red><bold>cannot be undone<reset>"
                message "type /fconfirm delete <faction name> if you are sure"
            else:
                message "you aren't the owner of this faction!"
        else:
            message "you don't have a faction"

command /fconfirm [<text>] [<text>]:
    description: Confirms the deletion of your faction
    executable by: players
    trigger:
        if "%arg-1%" is "delete":
            if {factions::%uuid of player%::hasfaction} is 1:
                if {factions::%uuid of player%::isowner} is 1:
                    if "%arg-2%" is {factions::%uuid of player%::factionname}:
                        set {factions::%uuid of player%::hasfaction} to 0
                        set {factions::%uuid of player%::factionname} to "<none>"
                        set {factions::%uuid of player%::isowner} to 0
                        set {factions::%uuid of player%::factionlocation} to "<none>"
                    else:
                        message "thats not your faction name try %{factions::%uuid of player%::factionname}%"
                else:
                    message "you don't own %{factions::%uuid of player%::factionname}%"
            else:
                message "you aren't in a faction"
command /fleave:
    trigger:
        if {factions::%uuid of player%::hasfaction} is 1:
            if {factions::%uuid of player%::isowner} is not 1:
                message "succsefully left %{factions::%uuid of player%::factionname}%"
                set {factions::%uuid of player%::isowner} to 0
                set {factions::%uuid of player%::factionname} to "<none>"
                set {factions::%uuid of player%::factionlocation} to "<none>"
                set {factions::%uuid of player%::hasfaction} to 0
               
            else:
                message "you are the owner of %{factions::%uuid of player%::factionname}% not a member, do /fdelete instead"
        else:
            message "you aren't in a faction"

command /fsethome:
    description: Sets your faction home
    executable by: players
    trigger:
        if {factions::%uuid of player%::hasfaction} is 1:
            if {factions::%uuid of player%::isowner} is 1:
                if "%block below player%" is not "air" or "lava":
                    set {factions::%uuid of player%::faction location} to location of player
                    message "set <lime>%{factions::%uuid of player%::factionname}%'s<reset> home to <grey>%location of player%<reset>"
                else:
                    message "you arent standing in a safe location"

command /fhome:
    description: Teleports you to your faction home
    executable by: players
    trigger:
        if {factions::%uuid of player%::hasfaction} is 1:
            message "Teleporting you to %{factions::%uuid of player%::factionname}%'s home"
            teleport player to {factions::%uuid of player%::factionlocation}

command /finfo:
    description: Prevides you with information about your current faction
    executable by: players
    trigger:
        if {factions::%uuid of player%::hasfaction} is 1:
            message "name: %{factions::%uuid of player%::factionname}%"
            message "location: %{factions::%uuid of player%::factionlocation}%"
            if {factions::%uuid of player%::isowner} is 1:
                message "You are the owner of %{factions::%uuid of player%::factionname}%"
            else:
                message "you are a member of %{factions::%uuid of player%::factionname}%"
        else:
            message "you aren't in a faction"
        message "this skript was written by mrclipse"

on chat:
    if {factions::%uuid of player%::hasfaction} is 1:
        cancel event
        send "[%{factions::%uuid of player%::factionname}%] <%player%> %message%" to all players

on join:
    set {factions::%uuid of player%::currentinvite} to "<none>"

command /fhelp:
    trigger:
        message "<green>/fcreate <faction name><reset> >> <green>creates a faction with the name specified and sets the home to your location<reset>"
        message "<green>/fdelete<reset> >> <green>prompts you with confirmation to delete your faction<reset>"
        message "<green>/fsethome<reset> >> <green>sets your faction home to your current location<reset>"
        message "<green>/fhome<reset> >> <green>teleports you to your factions home<reset>"
        message "<green>/finfo<reset> >> <green>shows info on the faction you are in<reset>"
        message "<green>/fhelp<reset> >> <green>shows you the commands of mrclipse's faction plugin, you're looking at it right now!<reset>"

command /fdebug:
    trigger:
        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}%"
[doublepost=1632074633][/doublepost]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
[doublepost=1632075863][/doublepost]https://forums.skunity.com/threads/list-contains-a-value.3527/
[doublepost=1632077783][/doublepost]
Code:
#https://forums.skunity.com/threads/rezzs-snippets-things-you-can-do-in-pure-skript-2-2.2471/
#TYSM Rezz
function contains(list: objects, check: object) :: boolean:
    loop {_list::*}:
        if loop-value is {_check}:
            return true
    return false
#example:
#add "a", "bunch", "of", "list", "items", "to", and "check" to {_list::*}
 #
#if contains({_list::*}, "check") is true:
#    send "Yep! The list does indeed contain 'check'"



command /fcreate [<text>]:
    description: Creates a faction
    executable by: players
    trigger:
        if {factions::factionlist::*} does not contain arg-1:
            add arg-1 to {factions::factionlist::*}
            if {factions::%uuid of player%::hasfaction} is not 1:
                if arg-1 is not "<none>":
                    if arg-1 does not contain " ":
                        set {factions::%uuid of player%::factionlocation} to location of player
                        set {factions::%uuid of player%::factionname} to arg-1
                        set {factions::%uuid of player%::isowner} to 1
                        set {factions::%uuid of player%::hasfaction} to 1
                        message "Created the faction <green>%arg-1%<reset> and set its home to your location"
                    else:
                        message "For technical reasons you can't use spaces in your faction, sorry!" 
                else:
                    message "For technical reasons you can't name your faction <none>, sorry!"
            else:
                message "You are already in a faction"
        else:
            message "That faction name is taken, sorry!"

command /invite [<player>]:
    trigger:
        if {factions::%uuid of player%::hasfaction} is 1:
            if {factions::%uuid of player%::isowner} is 1:
                message "you invited %arg-1% to join %{factions::%uuid of player%::factionname}%"
                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
                set {factions::%uuid of arg-1%::currentinvite} to {factions::%uuid of player%::factionname}
                set {factions::%uuid of arg-1%::invitelocation} to {factions::%uuid of player%::factionlocation}

command /join [<text>]:
    trigger:
        if {factions::%uuid of player%::currentinvite} is not "<none>":
            if {factions::%uuid of player%::hasfaction} is not 1:
                if arg-1 is {factions::%uuid of player%::currentinvite}:
                    set {factions::%uuid of player%::factionname} to {factions::%uuid of player%::currentinvite}
                    set {factions::%uuid of player%::factionlocation} to {factions::%uuid of player%::invitelocation}
                    add "%uuid of player%" to {factions::%{factions::%uuid of player%::factionname}%::playerlist::*}
                    set {factions::%uuid of player%::hasfaction} to 1
                    set {factions::%uuid of player%::isowner} to 0
                    set {factions::%uuid of player%::currentinvite} to "<none>"
                    message "succsefully joined %{factions::%uuid of player%::factionname}%"
                    message "debug: %{factions::%{factions::%uuid of player%::factionname}%::playerlist::*}%"
            else:
                message "you are already in a faction"
        else:
            message "you are not currently invited to %arg-1%"

command /test:
    trigger:
        message "%{factions::%uuid of player%::currentinvite}%"

command /fdelete:
    description: Deletes your faction
    executable by: players
    trigger:
        if {factions::%uuid of player%::hasfaction} is 1:
            if {factions::%uuid of player%::isowner} is 1:
                message "are you sure you want to <red><bold>delete<reset> %{factions::%uuid of player%::factionname}%?"
                message "this action <red><bold>cannot be undone<reset>"
                message "type /fconfirm delete <faction name> if you are sure"
            else:
                message "you aren't the owner of this faction!"
        else:
            message "you don't have a faction"

command /fconfirm [<text>] [<text>]:
    description: Confirms the deletion of your faction
    executable by: players
    trigger:
        if "%arg-1%" is "delete":
            if {factions::%uuid of player%::hasfaction} is 1:
                if {factions::%uuid of player%::isowner} is 1:
                    if "%arg-2%" is {factions::%uuid of player%::factionname}:
                        remove {factions::%uuid of player%::factionname} from {factions::factionlist::*}
                        set {factions::%uuid of player%::hasfaction} to 0
                        set {factions::%uuid of player%::factionname} to "<none>"
                        set {factions::%uuid of player%::isowner} to 0
                        set {factions::%uuid of player%::factionlocation} to "<none>"
                    else:
                        message "thats not your faction name try %{factions::%uuid of player%::factionname}%"
                else:
                    message "you don't own %{factions::%uuid of player%::factionname}%"
            else:
                message "you aren't in a faction"
command /fleave:
    trigger:
        if {factions::%uuid of player%::hasfaction} is 1:
            if {factions::%uuid of player%::isowner} is not 1:
                message "succsefully left %{factions::%uuid of player%::factionname}%"
                set {factions::%uuid of player%::isowner} to 0
                set {factions::%uuid of player%::factionname} to "<none>"
                set {factions::%uuid of player%::factionlocation} to "<none>"
                set {factions::%uuid of player%::hasfaction} to 0
               
            else:
                message "you are the owner of %{factions::%uuid of player%::factionname}% not a member, do /fdelete instead"
        else:
            message "you aren't in a faction"

command /fsethome:
    description: Sets your faction home
    executable by: players
    trigger:
        if {factions::%uuid of player%::hasfaction} is 1:
            if {factions::%uuid of player%::isowner} is 1:
                if "%block below player%" is not "air" or "lava":
                    set {factions::%uuid of player%::faction location} to location of player
                    message "set <lime>%{factions::%uuid of player%::factionname}%'s<reset> home to <grey>%location of player%<reset>"
                else:
                    message "you arent standing in a safe location"

command /fhome:
    description: Teleports you to your faction home
    executable by: players
    trigger:
        if {factions::%uuid of player%::hasfaction} is 1:
            message "Teleporting you to %{factions::%uuid of player%::factionname}%'s home"
            teleport player to {factions::%uuid of player%::factionlocation}

command /finfo:
    description: Prevides you with information about your current faction
    executable by: players
    trigger:
        if {factions::%uuid of player%::hasfaction} is 1:
            message "name: %{factions::%uuid of player%::factionname}%"
            message "location: %{factions::%uuid of player%::factionlocation}%"
            if {factions::%uuid of player%::isowner} is 1:
                message "You are the owner of %{factions::%uuid of player%::factionname}%"
            else:
                message "you are a member of %{factions::%uuid of player%::factionname}%"
        else:
            message "you aren't in a faction"
        message "this skript was written by mrclipse"

on chat:
    if {factions::%uuid of player%::hasfaction} is 1:
        cancel event
        send "[%{factions::%uuid of player%::factionname}%] <%player%> %message%" to all players

on join:
    set {factions::%uuid of player%::currentinvite} to "<none>"

command /fhelp:
    trigger:
        message "<green>/fcreate <faction name><reset> >> <green>creates a faction with the name specified and sets the home to your location<reset>"
        message "<green>/fdelete<reset> >> <green>prompts you with confirmation to delete your faction<reset>"
        message "<green>/fsethome<reset> >> <green>sets your faction home to your current location<reset>"
        message "<green>/fhome<reset> >> <green>teleports you to your factions home<reset>"
        message "<green>/finfo<reset> >> <green>shows info on the faction you are in<reset>"
        message "<green>/fhelp<reset> >> <green>shows you the commands of mrclipse's faction plugin, you're looking at it right now!<reset>"

command /fdebug:
    trigger:
        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}%"

command /flist:
    permission: skript.factions.admin
    trigger:
        message "%{factions::factionlist::*}%"

command /fremove [<text>]:
    permission: skript.factions.admin
    trigger:
        if contains({factions::factionlist::*}, "%arg-1%") is true:
            remove arg-1 from {factions::factionlist::*}
            message "removed %arg-1% from {factions::factionlist::*}"
        else:
            message "{factions::factionlist::*} doesn't contain %arg-1%"
 
Status
Not open for further replies.