Skocz do zawartości

skrypt na enderchesty (wymagane SkQuery)


Rekomendowane odpowiedzi

# --- KONFIGURACJA ---

#---Made by W4F3L ---
options:
    p: &d&lE-CHEST &8»&f

# Obsługa kliknięcia na postawiony blok Enderchesta
on right click on ender chest:
    cancel event
    open_ec_selector(player)

# Komendy /ec i /enderchest
command /enderchest:
    aliases: /ec
    trigger:
        open_ec_selector(player)

# Menu wyboru stron (4 eceki)
function open_ec_selector(p: player):
    open chest inventory with 1 rows named "{@p} Wybierz stronę" to {_p}
    set slot 1 of {_p}'s current inventory to ender chest named "&dStrona 1" with lore "&7Kliknij, aby otworzyć"
    set slot 3 of {_p}'s current inventory to ender chest named "&dStrona 2" with lore "&7Kliknij, aby otworzyć"
    set slot 5 of {_p}'s current inventory to ender chest named "&dStrona 3" with lore "&7Kliknij, aby otworzyć"
    set slot 7 of {_p}'s current inventory to ender chest named "&dStrona 4" with lore "&7Kliknij, aby otworzyć"

# Funkcja otwierania strony (6 rzędów, ostatni na nawigację)
function open_ec_page(p: player, page: number):
    open chest inventory with 6 rows named "{@p} Strona %{_page}%" to {_p}
    
    # Ładowanie itemów (sloty 0-44)
    loop 45 times:
        set {_slot} to loop-number - 1
        set slot {_slot} of {_p}'s current inventory to {ec::%{_p}'s uuid%::%{_page}%::%{_slot}%}
    
    # Dolny pasek (sloty 45-53)
    loop 9 times:
        set {_s} to 44 + loop-number
        set slot {_s} of {_p}'s current inventory to gray stained glass pane named " "
        
    set slot 49 of {_p}'s current inventory to nether star named "&bMenu Główne"
    
    if {_page} > 1:
        set slot 48 of {_p}'s current inventory to arrow named "&e« Poprzednia strona"
    if {_page} < 4:
        set slot 50 of {_p}'s current inventory to arrow named "&eNastępna strona »"

# Logika kliknięć wewnątrz GUI
on inventory click:
    if name of event-inventory contains "{@p}":
        
        # Blokada w Menu Wyboru
        if name of event-inventory is "{@p} Wybierz stronę":
            cancel event
            if clicked slot is 1:
                open_ec_page(player, 1)
            if clicked slot is 3:
                open_ec_page(player, 2)
            if clicked slot is 5:
                open_ec_page(player, 3)
            if clicked slot is 7:
                open_ec_page(player, 4)
            stop

        # Blokada dolnego paska w stronach
        if name of event-inventory contains "Strona":
            if index of event-slot >= 45:
                cancel event
                
                # Dynamiczne sprawdzanie strony
                set {_title} to uncolored name of event-inventory
                replace all "E-CHEST » Strona " with "" in {_title}
                set {_current} to {_title} parsed as number

                if clicked slot is 49:
                    open_ec_selector(player)
                
                if clicked slot is 48:
                    if {_current} > 1:
                        save_ec(player, {_current}) # Zapisujemy przed zmianą
                        open_ec_page(player, ({_current} - 1))
                
                if clicked slot is 50:
                    if {_current} < 4:
                        save_ec(player, {_current}) # Zapisujemy przed zmianą
                        open_ec_page(player, ({_current} + 1))
            
            # Blokada Shift-Click do dolnego rzędu
            if event-clicktype is left mouse button with shift or right mouse button with shift:
                if index of event-slot < 45:
                    if player has enough space for event-slot:
                        stop
                    else:
                        cancel event

# Funkcja pomocnicza do zapisu (żeby strzałki nie gubiły itemów)
function save_ec(p: player, page: number):
    loop 45 times:
        set {_slot} to loop-number - 1
        set {ec::%{_p}'s uuid%::%{_page}%::%{_slot}%} to slot {_slot} of {_p}'s current inventory

# Zapis przy zamykaniu okna
on inventory close:
    if name of event-inventory contains "Strona":
        set {_title} to uncolored name of event-inventory
        replace all "E-CHEST » Strona " with "" in {_title}
        set {_page} to {_title} parsed as number
        save_ec(player, {_page})

Odnośnik do komentarza
https://skript.pl/temat/59104-skrypt-na-enderchesty-wymagane-skquery/
Udostępnij na innych stronach

Dołącz do dyskusji

Możesz dodać zawartość już teraz a zarejestrować się później. Jeśli posiadasz już konto, zaloguj się aby dodać zawartość za jego pomocą.

Nieaktywny
Dodaj odpowiedź do tematu...

×   Wklejono zawartość z formatowaniem.   Usuń formatowanie

  Dozwolonych jest tylko 75 emoji.

×   Odnośnik został automatycznie osadzony.   Przywróć wyświetlanie jako odnośnik

×   Przywrócono poprzednią zawartość.   Wyczyść edytor

×   Nie możesz bezpośrednio wkleić grafiki. Dodaj lub załącz grafiki z adresu URL.

  • Ostatnio przeglądający   0 użytkowników

    • Brak zarejestrowanych użytkowników przeglądających tę stronę.
×
×
  • Dodaj nową pozycję...