Solved Multible Page

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

Runakai

Supporter
Apr 27, 2018
496
32
28
21
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_language.skript:
function Friendsmenu(p: player, page: number):
    set {_pageStart} to 36*{_page}
    set {_i} to 1
    set {_s} to 35
    set {_aa} to 0
    {_i} is 1:
        open chest with 6 rows named "&cFreunde" to {_p}
        loop 11 times:
            set slot {_s} of {_p}'s current inventory to air
            {_s} is 36 or 37 or 38 or 39 or 40 or 41 or 42 or 43 or 44:
                set slot {_s} of {_p}'s current inventory to black stained glass pane named " "
            set slot 46 of {_p}'s current inventory to redstone comparator named "&7Einstellungen"
            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!"
            add 1 to {_s}
        set {_s} to 0
        loop {friendliste.%{_p}%::*}:
           # wait 1 tick
            (loop-index parsed as integer) > {_pageStart}
            set {_timespan} to "%{lastlogin.%loop-value%.f}%"
            add 8 hours to {_timespan}
            loop-value is online:
                {friend.setting.world.%loop-value%} is not set:
                    set {_indikator} to loop-value's world
                    add 1 to {_aa}
                else:
                    set {_indikator} to "&8-----"
                    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}%"
                    add 1 to {_aa}
            else:
                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}%"
                add 1 to {_aa}
            if {_aa} = ((36*{_i})):
                exit loop
        format slot 49 of {_p} with {_p}'s skull named "&7Hauptseite" to run [Friendsmenu({_p}, 0)]
        if (amount of {friendliste.%{_p}%::*}) > {_pageStart} + 45:
            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))]
            format slot 49 of {_p} with {_p}'s skull named "&7Zurück zur Startseite" to run [menu({_p},"de.friend", 0)]
        if {_page} > 0:
            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))]
 
on inventory click:
    if name of clicked item is "&7Nächste Seite":
        Friendsmenu(player, ({_page} + 1))
    if name of clicked item is "&8Vorherige Seite":
        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_language.skript:
on inventory click:
    if name of clicked item is "&6Nächste Seite":
        set {_invname} to uncoloured name of player's current inventory
        replace all "Freunde " with "" in {_invname}
        set {_invname} to {_invname} parsed as number
        menu(player, "de.friend",{_invname}+1)
    if name of clicked item is "&8Vorherige Seite":
        set {_invname} to uncoloured name of player's current inventory
        replace all "Freunde " with "" in {_invname}
        set {_invname} to {_invname} parsed as number
        menu(player, "de.friend", {_invname} - 1)
    if name of clicked item is "&7Zurück zur Startseite":
        menu(player, "de.friend", 0)
 
Last edited:
Status
Not open for further replies.