Solved Shop Teleporting System

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

NCSGeek

Member
Jul 22, 2017
19
3
0
Skript Version: 2.2-dev22g
Skript Author: Me (Skript Version Author is bensku)
Minecraft Version: 1.11.2
---
Full Code:

code_language.skript:
command /shops <string> [<string>]:
    usage: &7/shops <&blist&7/&etp&7/&3create&7/&6remove&7> [&bNull&7/&eShop&7/&3ShopName&7/&6ShopName&7]
    trigger:
        if arg-1 is "list":
            send "&9Shops:"
            send "&7%{shop-name-cache::*}%"
        else if arg-1 is "create":
            if player's money is greater than 100:
                remove 100 from the player's account
                set {shop-loc-cache::%arg-2%} to the player's location
                add arg-2 to {shop-name-cache::*}
                add arg-2 to {shops.owned.%player%::*}
            else:
                send "You do not have sufficient funds to create a shop!"
        else if arg-1 is "remove" or "delete":
            if {shops.owned.%player%::*} contains arg-2:
                add 30 to the player's balance
                remove arg-2 from {shop-name-cache::*}
                remove arg-2 from {shops.owned.%player%::*}
                delete {shop-loc-cache::%arg-2%}
                send "Shop '%arg-2%' deleted"
            else:
                send "You do not own that shop!"
        else if arg-1 is "tp" or "teleport":
            if {shop-name-cache::*} contains arg-2:
                teleport player to {shop-loc-cache::%arg-2%}
                send "Welcome"
            #else:
                #send "&4Unknown Shop"

Errors on Reload: none

Console Errors: none


Addons using:
Umbaska
SkRayfall

Troubleshooting:

Have you tried searching the docs? Yes
Have you tried searching the forums? No


----

Hello! It's been a long time since I've been on these forums. I used to have an existing account but it must have gotten deleted. Anyway, I am trying to make a skript that lets players purchase a warp to their shops. My issue with my already mostly working skript is; when I create a new shop with my command it does not allow me to teleport to it. It does show up in the list of shops though.

I am willing to do a rewrite of the skript, as I am not fluent in skripting and I am sure that there is a better way this could have been written. Thank you for anyone who is willing to lend a hand. Also I tried to follow all guidelines on forum posting, if I missed anything, let me know.
 
i think its because checking if a list contains something is buggy (line 26)
do this instead:
code_language.skript:
loop {shop-name-cache::*}:
    if loop-value is arg-2:
        #tp player
        stop
#unknown shop
 
i think its because checking if a list contains something is buggy (line 26)
do this instead:
code_language.skript:
loop {shop-name-cache::*}:
    if loop-value is arg-2:
        #tp player
        stop
#unknown shop

Yeah I've always had problems with lists in Skript. So use your code there instead of checking the list as I did?
 
Alright.

It returns x: -212.84, y: 46.06, z: -377.14, x: 216.24, y: 79, z: 156.47 and x: -212.84, y: 46.06, z: -377.14

One of the locations, I already had, which works for whatever reason. That is why there are multiple.
 
No, it says unknown shop, from the last else statement. (Its commented out because I was testing, but it isnt when the error happens.)
 
So the issue is with the list contain check.... using what i said above ^ doesnt fix it?

Your loop interacts with the {shop-name-cache::*}: list, that list only handles the names of the shop, so it only handles what is seen when you use the command to list all shops.

I have two lists, one for names, one for locations. So since you didnt interact with the location list, I dont think that loop fixes it?
 
i dont think the problem is with the loc list. you said that it says unknown shop which would mean that its not detecting that {shop-name-cache::*} contains arg-2 which as i said before, is known to be buggy.
 
i dont think the problem is with the loc list. you said that it says unknown shop which would mean that its not detecting that {shop-name-cache::*} contains arg-2 which as i said before, is known to be buggy.

Ok, i will try your loop,

So you want it here
```
  1. else if arg-1 is "tp" or "teleport":
  2. if {shop-name-cache::*} contains arg-2:
  3. teleport player to {shop-loc-cache::%arg-2%}
  4. send "Welcome"
  5. #else:
  6. #send "&4Unknown Shop"
```
in place of the if statement?
 
Status
Not open for further replies.