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 Multible Page

Discussion in 'Skript' started by Runakai, Dec 29, 2018.

Tags:
Thread Status:
Not open for further replies.
  1. Runakai

    Moderator Supporter

    Joined:
    Apr 27, 2018
    Messages:
    497
    Likes Received:
    31
    So. I had found a skript where you were able to loop something in a gui with multible pages. I think it was from ShaneBee. Well, since I am upgrading my Server to 1.13.2 it is not working anymore. It just works for ONE more page. Like 36 Heads on the one page, then 36 on the other but it is just not working after those 72 total heads.

    Code (Skript):
    1.  
    2. function Friendsmenu(p: player, page: number):
    3.     set {_pageStart} to 36*{_page}
    4.     set {_i} to 1
    5.     set {_s} to 35
    6.     set {_aa} to 0
    7.     {_i} is 1:
    8.         open chest with 6 rows named "&cFreunde" to {_p}
    9.         loop 11 times:
    10.             set slot {_s} of {_p}'s current inventory to air
    11.             {_s} is 36 or 37 or 38 or 39 or 40 or 41 or 42 or 43 or 44:
    12.                 set slot {_s} of {_p}'s current inventory to black stained glass pane named " "
    13.             set slot 46 of {_p}'s current inventory to redstone comparator named "&7Einstellungen"
    14.             set slot 52 of {_p}'s current inventory to ("MHF_Question" parsed as offline player)'s skull named "&7---------------" with lore "&7Du brauchst Hilfe? " and " &7Benutze &c/friend help" and "&7oder klicke auf mich!"
    15.             add 1 to {_s}
    16.         set {_s} to 0
    17.         loop {friendliste.%{_p}%::*}:
    18.            # wait 1 tick
    19.             (loop-index parsed as integer) > {_pageStart}
    20.             set {_timespan} to "%{lastlogin.%loop-value%.f}%"
    21.             add 8 hours to {_timespan}
    22.             loop-value is online:
    23.                 {friend.setting.world.%loop-value%} is not set:
    24.                     set {_indikator} to loop-value's world
    25.                     add 1 to {_aa}
    26.                 else:
    27.                     set {_indikator} to "&8-----"
    28.                     set slot {_aa} of {_p}'s current inventory to loop-value's skull named "&6%loop-value%" with lore "&7Status: &aOnline" and "&7In der Welt: &6%{_indikator}%"
    29.                     add 1 to {_aa}
    30.             else:
    31.                 set slot {_aa} of {_p}'s current inventory to ("MHF_Skeleton" parsed as offline player)'s skull named "&7%loop-value%" with lore "&7Status: &cOffline" and "&7Zuletzt online:&6 %{_timespan}%"
    32.                 add 1 to {_aa}
    33.             if {_aa} = ((36*{_i})):
    34.                 exit loop
    35.         format slot 49 of {_p} with {_p}'s skull named "&7Hauptseite" to run [Friendsmenu({_p}, 0)]
    36.         if (amount of {friendliste.%{_p}%::*}) > {_pageStart} + 45:
    37.             set slot 50 of {_p}'s current inventory to ("MHF_ArrowRight" parsed as offline player)'s skull named "&7Nächste Seite"# to run [menu({_p},"de.friend", ({_page} + 1))]
    38.             format slot 49 of {_p} with {_p}'s skull named "&7Zurück zur Startseite" to run [menu({_p},"de.friend", 0)]
    39.         if {_page} > 0:
    40.             set slot 48 of {_p}'s current inventory to ("MHF_ArrowLeft" parsed as offline player)'s skull named "&8Vorherige Seite"# to run [menu({_p},"de.friend", ({_page} - 1))]
    41.  
    42. on inventory click:
    43.     if name of clicked item is "&7Nächste Seite":
    44.         Friendsmenu(player, ({_page} + 1))
    45.     if name of clicked item is "&8Vorherige Seite":
    46.         Friendsmenu(player, ({_page} - 1))
    You can ignore line 7... I was just too lazy to remove those spaces and just created an expression so i dont have to move it.. xD
    Is there maybe a better solution to do multible pages?

    Edit:
    So i tried testing the function every single time by editing the number argument. It works completely fine if I edit the number manually in the skript. But the {_page}+1 part won’t work after the first time anymore.

    Just add the current page as inventory name and use this:
    Code (Skript):
    1.  
    2. on inventory click:
    3.     if name of clicked item is "&6Nächste Seite":
    4.         set {_invname} to uncoloured name of player's current inventory
    5.         replace all "Freunde " with "" in {_invname}
    6.         set {_invname} to {_invname} parsed as number
    7.         menu(player, "de.friend",{_invname}+1)
    8.     if name of clicked item is "&8Vorherige Seite":
    9.         set {_invname} to uncoloured name of player's current inventory
    10.         replace all "Freunde " with "" in {_invname}
    11.         set {_invname} to {_invname} parsed as number
    12.         menu(player, "de.friend", {_invname} - 1)
    13.     if name of clicked item is "&7Zurück zur Startseite":
    14.         menu(player, "de.friend", 0)
     
    #1 Runakai, Dec 29, 2018
    Last edited: Jan 20, 2019
Thread Status:
Not open for further replies.

Share This Page

Loading...