Homes GUI teleport

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

Mattllama987

Active Member
Aug 5, 2018
225
7
18
24
Hello, im working on a homes GUI, and im having a little trouble with the teleporting part. Im use to using Tuske, and i updated my server, and it no longer works. So, im remaking it in vanilla skript now. How can i get the name of the slot the player picks, and then teleport them to that home? Here is the whole code. If anyone knows how to get this to work, please let me know ASAP.

Thanks!
~Matt


Code:
on first join:
    set {maxhomes::%player%} to 0
command /sethome [<text>]:
    trigger:
        if arg-1 isn't set:
            send "&7[&aHomes&7] &7You must have a home name!"
        else:
            if {HOME::%player%::*} contains arg-1:
                send "&7[&aHomes&7] &7You already have a home named that!"
            set {LOC::HOME::%player%::%arg 1%} to player's location
            add arg-1 to {HOME::%player%::*}
            set {HCOL::%player%::%arg 1%} to "&c&l"
            send "&7[&aHomes&7] &7You set a home named %arg-1%&7!"
command /delhome [<offlineplayer>]:
    trigger:
        if player has permission "%{SKHOME::DB::PERM::DELH}%":
            if arg-1 is set:
                delete {HOME::%arg-1%::*}
                send "&7[&aHomes&7] &7You deleted all of %arg-1%&7's homes!"
command /homes:
    trigger:
        open chest inventory with 6 rows named "&c&lHomes(s)" to player
        set {_o} to 0
        loop 55 times:
            set slot {_o} of player's current inventory to gray glass pane named ""
            add 1 to {_o}
        if size of {HOME::%player%::*} is bigger than 0:
            set {_home} to 0
            loop {HOME::%player%::*}:
                set {_ahome} to loop-value
                set slot {_home} of player's current inventory to chest named "%{HCOL::%player%::%{_ahome}%}%%{_ahome}%"
                add 1 to {_home}
on inventory click:
    if "%event.getView().getTitle()%" = "&c&lHomes(s)":
        cancel event
        set {_var} to 0
        loop 66 times:
            add 1 to {_var}
            set {_name} to loop-value
            teleport player to {LOC::HOME::%player%::%{_name}%}
 
You can get the name of the slot the player clicked by using "event-item's name"
 
Code:
on first join:
    set {maxhomes::%player%} to 0
Also I would NOT recommend you using "on first join" event, there may be problems with it. I would rather do something like this:
Code:
variables:
    {maxhomes::%player%} = 0
or
Code:
on join:
    if {maxhomes::%player%} is not set:
        set {maxhomes::%player%} to 0
 
Thank you both for responding to me! But how would i actually do the teleporting part? I tried this, and it might be wrong because its not working xD


Code:
on inventory click:
    if "%event.getView().getTitle()%" = "&c&lHomes(s)":
        cancel event
        teleport player to {LOC::HOME::%player%::%event-item's name%}
[doublepost=1592775893,1592579879][/doublepost]bump
 
Have you tried debugging?
Have you tried upgrading/downgrading your Skript?
Have you tried upgrading all of your addons?
 
Have you tried debugging?
Have you tried upgrading/downgrading your Skript?
Have you tried upgrading all of your addons?
Ive tried all of them. I debugged, and all the debug messages go through, its just not teleporting the player
 
I think it's because you are naming the item like this: "&c&lHOME".
Because of that, it searches for "{LOC::HOME::%player%::&c&lHOME}" which does not exist, instead of "{LOC::HOME::%player%::HOME}"

I think the easiest way is to remove the color code (= {HCOL::%player%::%arg 1%}) but if you want to keep it, use spliting:
Code:
set {_name} to "%event-item's name%"
set {_nameparts::*} to {_name} split at "&l"
teleport player to {LOC::HOME::%player%::%{_nameparts::2}%}
 
I think it's because you are naming the item like this: "&c&lHOME".
Because of that, it searches for "{LOC::HOME::%player%::&c&lHOME}" which does not exist, instead of "{LOC::HOME::%player%::HOME}"

I think the easiest way is to remove the color code (= {HCOL::%player%::%arg 1%}) but if you want to keep it, use spliting:
Code:
set {_name} to "%event-item's name%"
set {_nameparts::*} to {_name} split at "&l"
teleport player to {LOC::HOME::%player%::%{_nameparts::2}%}
I tried that, and its doing nothing when i click the slot xD I also tried something similar
 
Have you tried just removing the color code from the "set slot ..." in the /homes command?
Try putting something like " broadcast "%{LOC::HOME::%thenamevariable%}%" ".
Doesn't that display <none>?

I would like to help you, but if you response like "I did something similar", I dunno what you did, what happened etc... :emoji_confused::emoji_wink:
 
Have you tried just removing the color code from the "set slot ..." in the /homes command?
Try putting something like " broadcast "%{LOC::HOME::%thenamevariable%}%" ".
Doesn't that display <none>?

I would like to help you, but if you response like "I did something similar", I dunno what you did, what happened etc... :emoji_confused::emoji_wink:
I tried to set a var to the name of the event-slot, and then teleport to that var lol. But i tried what you said, and it broadcast <none>
 
Its still coming back with <none>. I have this here:

Code:
on inventory click:
    if "%event.getView().getTitle()%" = "&c&lHomes(s)":
        cancel event
        teleport player to {LOC::HOME::%player%::%uncolored name of event-item%}
        broadcast "%{LOC::HOME::%player%::%uncolored name of event-item%}%"
 
Its still coming back with <none>. I have this here:

Code:
on inventory click:
    if "%event.getView().getTitle()%" = "&c&lHomes(s)":
        cancel event
        teleport player to {LOC::HOME::%player%::%uncolored name of event-item%}
        broadcast "%{LOC::HOME::%player%::%uncolored name of event-item%}%"
Try a basic command to set the var, and see. If you set the var and then it broadcasts fine when you click on the slot, it fails when you save the location.
Code:
command /test [<text>]:
    trigger:
        set {LOC::HOME::%player%::%arg%} to arg
Edit: or your variables file is corrupted. it happens to me sometimes.
 
Here is what i found out. When i have this, it broadcast the correct message. It doesnt send <none>, it sends "test". Test is just the name of my home. It only sends the message if it doesnt have "%uncolored name of event-item%". If it has that, it sends <none>. But what i have now sends "test" in chat. But its the colors &c&ltest. It also still doesnt teleport the player. xD

Code:
on inventory click:
    if "%event.getView().getTitle()%" = "&c&lHomes(s)":
        cancel event
        set {_var} to name of event-slot
        teleport player to {HOME::%player%::%name of event-item%}
        broadcast "%{_var}%"
 
Here is what i found out. When i have this, it broadcast the correct message. It doesnt send <none>, it sends "test". Test is just the name of my home. It only sends the message if it doesnt have "%uncolored name of event-item%". If it has that, it sends <none>. But what i have now sends "test" in chat. But its the colors &c&ltest. It also still doesnt teleport the player. xD

Code:
on inventory click:
    if "%event.getView().getTitle()%" = "&c&lHomes(s)":
        cancel event
        set {_var} to name of event-slot
        teleport player to {HOME::%player%::%name of event-item%}
        broadcast "%{_var}%"
Why do you need to color it? It seems that you're always making it the same color so just do it later on.
 
You guys are stupid xD It's because you need to do
Code:
 teleport player to location at
not
Code:
 teleport player to



Edit 2 seconds later: Lol sorry about saying "stupid" :emoji_grinning: Just saying because you needed 15 comments to solve it
 
You guys are stupid xD It's because you need to do
Code:
 teleport player to location at
not
Code:
 teleport player to



Edit 2 seconds later: Lol sorry about saying "stupid" :emoji_grinning: Just saying because you needed 15 comments to solve it
Not working. :/

Code:
on inventory click:
    if "%event.getView().getTitle()%" = "&c&lHomes(s)":
        cancel event
        set {_var} to name of event-slot
        teleport player to location at {LOC::HOME::%player%::%uncolored name of event-item%}
        broadcast "%{_var}%"
 
Code:
teleport player to
Should work, check if the location is set
Ive tried that, and it doesnt work. I made a command to teleport the player, and it does work. So it has to do with something with the GUI part. Im not sure about that?


Code:
command /test <text>:
    trigger:
        teleport player to {LOC::HOME::%player%::%arg-1%}
 
Status
Not open for further replies.