1. 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!

  2. LOOKING FOR A VERSION OF SKRIPT?

    You can always check out our Wiki for downloads and any other information about Skript!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Waypoints/Locations Help

Discussion in 'Skript' started by Chim Chimoi, May 28, 2020.

Thread Status:
Not open for further replies.
  1. Chim Chimoi

    Chim Chimoi Member

    Joined:
    May 28, 2020
    Messages:
    1
    Likes Received:
    0
    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.
     
  2. WeeHee

    WeeHee Active Member

    Joined:
    Mar 4, 2017
    Messages:
    108
    Likes Received:
    21
    This works.
    Code (Text):
    1. options:
    2.  
    3.     prefix:    &8&l[ &3&lLocations &8&l]
    4.  
    5. function refreshUUID(p: player, uuid: object):
    6.     if {uuid.player::%{_uuid}%} is not {_p}:
    7.         set {uuid.player::%{_uuid}%} to {_p}
    8.     if {uuid::%{_p}%} is not {_uuid}:
    9.         set {uuid::%{_p}%} to {_uuid}
    10.  
    11. on load:
    12.     loop all players:
    13.         refreshUUID(loop-player, uuid of loop-player)
    14.  
    15. on join:
    16.     refreshUUID(player, uuid of player)
    17.  
    18. command /addlocation:
    19.     permission: locations.add
    20.     trigger:
    21.         add player's location to {locations::%uuid of player%::*}
    22.         send "{@prefix} &7Your current location has been added to your location list."
    23.  
    24. command /viewlocations [<offline player>]:
    25.     permission: locations.view
    26.     trigger:
    27.         if arg 1 is not set:  
    28.             if size of {locations::%uuid of player%::*} is greater than 0:
    29.                 send "{@prefix} &7Your locations:"
    30.                 loop {locations::%uuid of player%::*}:
    31.                     send " &3%loop-index%: &b%loop-value%"
    32.             else:
    33.                 send "{@prefix} &cYou've not set any locations."
    34.         else if player has permission "locations.view.others":
    35.             if size of {locations::%{uuid::%arg 1%}%::*} is greater than 0:
    36.                 send "{@prefix} &7%arg 1%&7's locations:"
    37.                 loop {locations::%{uuid::%arg 1%}%::*}:
    38.                     send " &3%loop-index%: &b%loop-value%"
    39.             else:
    40.                 send "{@prefix} &c%arg 1% &chas not set any locations."
     
Thread Status:
Not open for further replies.

Share This Page

Loading...