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

Pages in GUI

Discussion in 'Skript' started by Avaplays, Aug 22, 2019.

  1. Avaplays

    Avaplays Member

    Joined:
    Jan 29, 2017
    Messages:
    22
    Likes Received:
    1
    Hello there,

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

    Code (Text):
    1. command home [<text>]:
    2.     trigger:
    3.         if argument 1 is set:
    4.             send "{@prefix} §7Du wirst in §b3 §7Sekunden teleportiert."
    5.             send "{@prefix} §7Teleportation wird bei Bewegung abgebrochen."
    6.             set {_location} to player's location
    7.             loop 6 times:
    8.                 if player's location isn't {_location}:
    9.                     message "{@prefix} §cTeleportation abgebrochen."
    10.                     stop
    11.                 wait 0.5 seconds
    12.             teleport the player to {home::%player%::%argument 1%}
    13.         else:
    14.             #if size of {home::%player%::*} is 0:
    15.             #    send "{@prefix} §7Du hast kein Zuhause gesetzt."
    16.             #else:
    17.             open chest with 1 row named "§8Home" to player
    18.             wait a tick
    19.             set {_page} to 0
    20.             set slot 8 of player's current inventory to ("MHF_ArrowRight" parsed as offline player)'s skull named "§7Nächste Seite"
    21.             #set slot 0 of player's current inventory to ("MHF_ArrowLeft" parsed as offline player)'s skull named "§7Zurück"
     
    #1 Avaplays, Aug 22, 2019
    Last edited: Aug 22, 2019
  2. malia

    malia Well-Known Member

    Joined:
    Jul 24, 2019
    Messages:
    271
    Likes Received:
    17
    Code (Skript):
    1. set slot ... to run function FUNCTION_NAME # something like this, it requires an addon afaik
    2.  
    3. # also the command should be /home not home afaik
     
  3. AsuDev

    VIP

    Joined:
    Jan 27, 2017
    Messages:
    150
    Likes Received:
    15
    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.
     
  4. Avaplays

    Avaplays Member

    Joined:
    Jan 29, 2017
    Messages:
    22
    Likes Received:
    1
    With the size of the list.
    should be {home::%player%::*}
     
  5. Runakai1

    Runakai1 Well-Known Member

    Joined:
    Apr 27, 2018
    Messages:
    394
    Likes Received:
    20
    Code (Text):
    1. options:
    2.     STitem: &7Mainpage
    3.     NSitem: &6nextpage
    4.     VSitem: &7previous page
    5.     GlobalPlayerGuiName: &cPlayers
    6.     pagetext: &6Page
    7.  
    8.  
    9. command test:
    10.     trigger:
    11.         set {GlobalPlayer::*} to all players
    12.         Menu(player, 0)
    13.  
    14.  
    15. function Menu(p: player, page: number):
    16.     set {_pageStart} to 45*{_page}
    17.     set {_s} to 0
    18.     open chest inventory with 6 rows named "Player" to {_p}
    19.     loop {GlobalPlayer::*}:
    20.         (loop-index parsed as integer) > {_pageStart}
    21.         set slot {_s} of {_p}'s current inventory to loop-value
    22.         add 1 to {_s}
    23.         if ({_s}) >= 45:
    24.             exit loop
    25.     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))%"
    26.     if (size of {GlobalPlayer::*}) > {_pageStart} + 45:
    27.         set slot 50 of {_p}'s current inventory to ("MHF_ArrowRight" parsed as offline player)'s skull named "{@NSitem}" with lore "&7%{_page}%"
    28.     if {_page} > 0:
    29.         set slot 48 of {_p}'s current inventory to ("MHF_ArrowLeft" parsed as offline player)'s skull named "{@VSitem}" with lore "&7%{_page}%"
    30.  
    31. inventory click:
    32.     event-inventory != player' inventory:
    33.         name of player' current inventory = "{@GlobalPlayerGuiName}":
    34.             cancel event
    35.             event-slot != air:
    36.                 if index of event-slot = 50:
    37.                     set {_invname} to (uncoloured line 1 of lore of event-slot parsed as integer)+1
    38.                     Menu(player, {_invname})
    39.                 else if index of event-slot = 48:
    40.                     set {_invname} to (uncoloured line 1 of lore of event-slot parsed as integer)-1
    41.                     Menu(player, {_invname})
    42.                 else if index of event-slot = 49:
    43.                     Menu(player, 0)
    --- Double Post Merged, Aug 23, 2019, Original Post Date: Aug 23, 2019 ---
    Just replace the list variable with your own
     
  6. AsuDev

    VIP

    Joined:
    Jan 27, 2017
    Messages:
    150
    Likes Received:
    15
Loading...