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.

Solved Creating GUI That Shows Heads Of Online Players

Discussion in 'Skript' started by Lanchester, Jan 14, 2018.

Thread Status:
Not open for further replies.
  1. Lanchester

    Lanchester New Member

    Joined:
    Jan 14, 2018
    Messages:
    9
    Likes Received:
    0
    I'm trying to create a moderator tool that allows me to view a GUI that shows me the heads of all online players, and then if I were to click on a head it would teleport me to that player. I haven't bothered trying to code the click/teleport function, because I am so far unable to get showing the heads to work. I'm still new to Skript and coding in general, but I understand the issue with my code is that with the way I worded it, it's attempting to format each individual slot with every person's head at the same time, and I do not know the right way to say "I want the first online player's head to occupy the first slot, and the next online player's head to occupy the next slot, and so on until all the online player's heads are listed." I've searched everywhere I can think of but I can't find any sort of Skript that resembles that sort of action

    Code (Skript):
    1. command /stalk:
    2.     description: Opens a GUI that allows a mod to select the player they wish to teleport to
    3.     permission: skript.mod
    4.     trigger:
    5.         open chest with 3 rows named "Victim List" to player
    6.         wait 2 ticks
    7.         loop integers between 0 and 26:
    8.             format slot loop-number of player with skull of all players to be unstealable
     
  2. Best Answer:
    Post #2 by Donut, Jan 14, 2018
  3. Donut

    Donut Well-Known Member

    Joined:
    Mar 27, 2017
    Messages:
    1,340
    Likes Received:
    176
    Medals:
    tuske guis are better
    Code (Skript):
    1. set {_slot} to 0
    2. loop all players:
    3.     if loop-value is not player:
    4.         format gui slot {_slot} of player with loop-value's skull to close then run player command "/tp %loop-value%"
    5.         add 1 to {slot}
    however this gets slightly more complicated if you want multiple pages if theres more than 27 players on
     
  4. Lanchester

    Lanchester New Member

    Joined:
    Jan 14, 2018
    Messages:
    9
    Likes Received:
    0
    You're a lifesaver! Thank you so much!

    EDIT: so I ended up editing your code a little bit as well as mine, because I was getting a few errors and I had to change the chest to Tuske's syntax, and this is what I have so far
    Code (Skript):
    1. command /stalk:
    2.     description: Opens a GUI that allows a mod to select the player they wish to teleport to
    3.     permission: skript.mod
    4.     trigger:
    5.         open virtual chest with 3 rows named "Victim List" to player
    6.         set {_slot} to 0
    7.         loop all players:
    8.             if loop-value is player:
    9.                 format gui slot {_slot} of player with loop-value's skull to close then run player command "/tp %loop-value%"
    10.                 add 1 to {_slot}
    and the issue I'm having is that whenever I try this with more than one person online it only ever shows me my head, and I'm not sure why that would be
     
    #3 Lanchester, Jan 14, 2018
    Last edited: Jan 14, 2018
  5. Snow-Pyon

    Moderator Resource Staff

    Joined:
    Jan 25, 2017
    Messages:
    1,236
    Likes Received:
    176
    Medals:
    This line is the problem:
    Code (Skript):
    1. if loop-value is player:
    You're checking if the current looped player out of all the players is you, therefore it doesn't show anyone else's head, only yours.
     
  6. Lanchester

    Lanchester New Member

    Joined:
    Jan 14, 2018
    Messages:
    9
    Likes Received:
    0
    Oh of course, I can't believe I missed that. Thanks a ton!
     
Thread Status:
Not open for further replies.

Share This Page

Loading...