Solved Creating GUI That Shows Heads Of Online Players

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

Lanchester

New Member
Jan 14, 2018
9
0
0
27
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_language.skript:
command /stalk:
    description: Opens a GUI that allows a mod to select the player they wish to teleport to
    permission: skript.mod
    trigger:
        open chest with 3 rows named "Victim List" to player
        wait 2 ticks
        loop integers between 0 and 26:
            format slot loop-number of player with skull of all players to be unstealable
 
tuske guis are better
code_language.skript:
set {_slot} to 0
loop all players:
    if loop-value is not player:
        format gui slot {_slot} of player with loop-value's skull to close then run player command "/tp %loop-value%"
        add 1 to {slot}
however this gets slightly more complicated if you want multiple pages if theres more than 27 players on
 
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_language.skript:
command /stalk:
    description: Opens a GUI that allows a mod to select the player they wish to teleport to
    permission: skript.mod
    trigger:
        open virtual chest with 3 rows named "Victim List" to player
        set {_slot} to 0
        loop all players:
            if loop-value is player:
                format gui slot {_slot} of player with loop-value's skull to close then run player command "/tp %loop-value%"
                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
 
Last edited:
This line is the problem:
code_language.skript:
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.

Oh of course, I can't believe I missed that. Thanks a ton!
 
Status
Not open for further replies.