Solved I'm running in a problem deleting homes

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

Jayden13O

Member
Jun 9, 2021
22
1
3
21
Skript version: custom minehut version.
Minecraft version: 1.16.5

The problem in my code i'm running into is when using '/homeremove13o all' it does correctly delete all homes, but if i do '/homeremove13o home', it wont do anything.
Does anyone have any advice on getting it to work? Here is my full code:
Code:
command /sethome13O <text>:
    trigger:
        if {homes.%player's UUID%::*} does not contain argument 1:
            add argument 1 to {homes.%player's UUID%::*}
            set {homes.%player's UUID%::%argument 1%.location} to player's location
            send "<green>[13O] Home %argument 1%<green> made at %player's location%!<green>" to player
        else:
            send "<red>[13O] Home %argument 1%<red> already exists, pick another name" to player

command /homelist13O:
    trigger:
        send {homes.%player's UUID%::*} to player
        send "[13O] If you received no home names, you own no homes"

command /home13O <text>:
    trigger:
        if {homes.%player's UUID%::*} contains argument 1:
            teleport player to {homes.%player's UUID%::%argument 1%.location}
            send "woosh" to player
        else:
            send "<red>[13O] Home %argument 1%<red> does not exist, check for proper spelling" to player

command /homeremove13O <text>:
    trigger:
        if argument 1 is "all":
            delete {homes.%player's UUID%::*}
            send "<green>[13O] Deleted <red>ALL YOUR HOMES<green>!"
        else if {homes.%player's UUID%::*} contains argument 1:
            send "<red>[13O] Deleting home %argument 1%<red>!"
            delete {homes.%player's UUID%::%argument 1%}
        else:
            send "<red>[13O] Home %argument 1%<red> does not exist! Please check for proper spelling! If you try to delete all homes type 'all'!"
 
why are you using multiple variables??
I don't really understand your question but i'm trying to have multiple homes, hope you ment that.
If it helps this is the line that doesn't work as intended but gives no errors:
Code:
            delete {homes.%player's UUID%::%argument 1%}

And also, i'm seeing you everywhere on the forums helping people! Thank you for that! Free like from me.
 
I re-skript that for you, give me a second
[doublepost=1623591098,1623589743][/doublepost]sry had some trouble finding smth out
Code:
command /home13O [<text>]:
  trigger:
    if arg-1 is set:
      loop {homes::%player's UUID%::*}:
        add loop-index to {_homes::*}
      if {_homes::*} contains arg-1:
        teleport player to {homes::%player's UUID%::%arg-1%}
        send "woosh" to player
      else:
        send "<red>[13O] Home ""%arg-1%""<red> does not exist, check for proper spelling" to player
    else:
      send "<red>[13O] You have to provide a proper name for the home you want to delete"

command /homeremove13O [<text>]:
  trigger:
    if arg-1 is not set:
      send "<green>[13O] You have to provide a name or use ""all"" to delete all of your homes."
    else:
      if arg-1 is "all":
        delete {homes::%player's uuid%::*}
        send "<green>[13O] Deleted <red>ALL YOUR HOMES<green>!"
        stop
      else:
        loop {homes::%player's UUID%::*}:
        add loop-index to {_homes::*}     
        if {_homes::*} contains arg-1: 
          send "<red>[13O] Deleting home %arg-1%<red>!"
          delete {homes::%player's uuid%::%arg-1%}
        else:
          send "<red>[13O] Home %arg-1%<red> does not exist! Please check for proper spelling! If you try to delete all homes type 'all'!"

command /sethome13O [<text>]:
  trigger:
    if arg-1 is set:
      loop {homes::%player's UUID%::*}:
        add loop-index to {_homes::*}
      if {_homes::*} does not contain arg-1:
        set {homes::%player's uuid%::%arg-1%} to location of player
        send "<green>[13O] Home %arg-1%<green> made at %player's location%!<green>" to player
      else:
        send "<red>[13O] Home %arg-1%<red> already exists, pick another name or delete it"
    else:
      send "&c[13O] You have to provide a proper name for your home e.g.: /sethome13O myhome"

command /homelist13O [<text>]:
  trigger:
    set {_homes::*} to {homes::%player's uuid%::*}
    if {_homes::*} is not set:
      send "<red> [13O] You don't have any homes set"
    else:
      loop {homes::%player's uuid%::*}:
        add loop-index to {_x::*}
      send "<green>[13O] Your homes: %{_x::*}%"
 
  • Like
Reactions: Jayden13O
Thank you for re-skripting, i fixed some tiny problems with your code and it works perfectly!
I'm going to set this thread to solved.

For if someone wants the slightly fixed code
Code:
command /homeremove13O [<text>]:
  trigger:
    if arg-1 is not set:
      send "<green>[13O] You have to provide a name or use ""all"" to delete all of your homes."
    else:
      if arg-1 is "all":
        delete {homes::%player's uuid%::*}
        send "<green>[13O] Deleted <red>ALL YOUR HOMES<green>!"
        stop
      else:
        loop {homes::%player's UUID%::*}:
          add loop-index to {_homes::*}   
        if {_homes::*} contains arg-1:
          send "<red>[13O] Deleting home %arg-1%<red>!"
          delete {homes::%player's uuid%::%arg-1%}
        else:
          send "<red>[13O] Home %arg-1%<red> does not exist! Please check for proper spelling! If you try to delete all homes type 'all'!"
 
command /sethome13O [<text>]:
  trigger:
    if arg-1 is set:
      loop {homes::%player's UUID%::*}:
        add loop-index to {_homes::*}
      if {_homes::*} does not contain arg-1:
        set {homes::%player's uuid%::%arg-1%} to location of player
        send "<green>[13O] Home %arg-1%<green> made at %player's location%<red>!" to player
      else:
        send "<red>[13O] Home %arg-1%<red> already exists, pick another name or delete it"
    else:
      send "&c[13O] You have to provide a proper name for your home e.g.: /sethome13O myhome"
 
command /homelist13O [<text>]:
  trigger:
    set {_homes::*} to {homes::%player's uuid%::*}
    if {_homes::*} is not set:
      send "<red> [13O] You don't have any homes set"
    else:
      loop {homes::%player's uuid%::*}:
        add loop-index to {_x::*}
      send "<green>[13O] Your homes: %{_x::*}%"

Correct me if there are any problems with the code.
[doublepost=1624020634,1623597236][/doublepost]For some reason the homes got reset for me
any idea why?
 
Every home or just for some players? And is it just this variable?
Don't know because i was the only person with the home, seems to be working fine.
Thought there might have been a bug causing it, but it seems to be fine now.
And it could have been me being stupid too actually.
But thanks for helping me!
 
Status
Not open for further replies.