Solved Heads in gui

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

Ouma Shu

Member
Dec 25, 2017
45
2
0
33
London
Hello, I want to make a skript that when you do "/onlineplayers" it shows you a gui where there are the heads of the online players, but if It reaches the maximum rows for a chest, it makes a new page with the remaining players. Thank you all for the help!
 
Shouldn't this be in requests?
 
Yes it should since you have not provided any kind of code.

Can be shortened using TuSKe:

code_language.skript:
options:
    STitem: &7Mainpage
    NSitem: &6nextpage
    VSitem: &7previous page
    GlobalPlayerGuiName: &cPlayers
    pagetext: &6Page
      
      
command test:
    trigger:
        set {GlobalPlayer::*} to all players
        Menu(player, 0)
      
      
function Menu(p: player, page: number):
    set {_pageStart} to 45*{_page}
    set {_s} to 0
    open chest inventory with 6 rows named "Player" to {_p}
    loop {GlobalPlayer::*}:
        (loop-index parsed as integer) > {_pageStart}
        set slot {_s} of {_p}'s current inventory to loop-value
        add 1 to {_s}
        if ({_s}) >= 45:
            exit loop
    set slot 49 of {_p}'s current inventory to {_p}'s skull named "{@STitem}" with lore "{@pagetext}: &7%{_page}%/%round(size of {GlobalPlayer::*}/(9*6))%"
    if (size of {GlobalPlayer::*}) > {_pageStart} + 45:
        set slot 50 of {_p}'s current inventory to ("MHF_ArrowRight" parsed as offline player)'s skull named "{@NSitem}" with lore "&7%{_page}%"
    if {_page} > 0:
        set slot 48 of {_p}'s current inventory to ("MHF_ArrowLeft" parsed as offline player)'s skull named "{@VSitem}" with lore "&7%{_page}%"
  
inventory click:
    event-inventory != player' inventory:
        name of player' current inventory = "{@GlobalPlayerGuiName}":
            cancel event
            event-slot != air:
                if index of event-slot = 50:
                    set {_invname} to (uncoloured line 1 of lore of event-slot parsed as integer)+1
                    Menu(player, {_invname})
                else if index of event-slot = 48:
                    set {_invname} to (uncoloured line 1 of lore of event-slot parsed as integer)-1
                    Menu(player, {_invname})  
                else if index of event-slot = 49:
                    Menu(player, 0)
 
Last edited:
Status
Not open for further replies.