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

Avaplays

Member
Jan 29, 2017
23
2
3
28
Hello there,

i'm scripting a home plugin and i wan't a gui with pages. I forgot how to script it. Anybody?

Code:
command home [<text>]:
    trigger:
        if argument 1 is set:
            send "{@prefix} §7Du wirst in §b3 §7Sekunden teleportiert."
            send "{@prefix} §7Teleportation wird bei Bewegung abgebrochen."
            set {_location} to player's location
            loop 6 times:
                if player's location isn't {_location}:
                    message "{@prefix} §cTeleportation abgebrochen."
                    stop
                wait 0.5 seconds
            teleport the player to {home::%player%::%argument 1%}
        else:
            #if size of {home::%player%::*} is 0:
            #    send "{@prefix} §7Du hast kein Zuhause gesetzt."
            #else:
            open chest with 1 row named "§8Home" to player
            wait a tick
            set {_page} to 0
            set slot 8 of player's current inventory to ("MHF_ArrowRight" parsed as offline player)'s skull named "§7Nächste Seite"
            #set slot 0 of player's current inventory to ("MHF_ArrowLeft" parsed as offline player)'s skull named "§7Zurück"
 
Last edited:
What kind of paginated gui do you want Avaplays? Do you want it automatic where it scales with the size of the list or do you want it to where you create separate pages manually.
 
What kind of paginated gui do you want Avaplays? Do you want it automatic where it scales with the size of the list or do you want it to where you create separate pages manually.

With the size of the list.
should be {home::%player%::*}
 
Code:
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)
[doublepost=1566573500,1566573424][/doublepost]Just replace the list variable with your own
 
Status
Not open for further replies.