Waypoints/Locations Help

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

Chim Chimoi

Member
May 28, 2020
1
0
0
33
So I am attempting to create a command where player's can store coordinates into a list by using the command /addlocation, which will take the current location of the player and add it to a list. Later they can access this list by typing /viewlocations. My problem is that I don't know how to create separate lists for each player, where one player can access their locations while another player can access their locations, which will be stored in a separate list.
 
This works.
Code:
options:

    prefix:    &8&l[ &3&lLocations &8&l]

function refreshUUID(p: player, uuid: object):
    if {uuid.player::%{_uuid}%} is not {_p}:
        set {uuid.player::%{_uuid}%} to {_p}
    if {uuid::%{_p}%} is not {_uuid}:
        set {uuid::%{_p}%} to {_uuid}

on load:
    loop all players:
        refreshUUID(loop-player, uuid of loop-player)

on join:
    refreshUUID(player, uuid of player)

command /addlocation:
    permission: locations.add
    trigger:
        add player's location to {locations::%uuid of player%::*}
        send "{@prefix} &7Your current location has been added to your location list."

command /viewlocations [<offline player>]:
    permission: locations.view
    trigger:
        if arg 1 is not set:   
            if size of {locations::%uuid of player%::*} is greater than 0:
                send "{@prefix} &7Your locations:"
                loop {locations::%uuid of player%::*}:
                    send " &3%loop-index%: &b%loop-value%"
            else:
                send "{@prefix} &cYou've not set any locations."
        else if player has permission "locations.view.others":
            if size of {locations::%{uuid::%arg 1%}%::*} is greater than 0:
                send "{@prefix} &7%arg 1%&7's locations:"
                loop {locations::%{uuid::%arg 1%}%::*}:
                    send " &3%loop-index%: &b%loop-value%"
            else:
                send "{@prefix} &c%arg 1% &chas not set any locations."
 
Status
Not open for further replies.