Skocz do zawartości
  • 0

Problem


fiXed

Pytanie

Witam!
Napisałem dzisiaj skrypt na drop. Chciałem zrobić menu, aby szło poszczególne itemy wyłączać lub włączać.

command /drop [<text>]:
    trigger:
        set {_drop} to chest inventory with 3 rows named "&4&lDROP:"
        set slot 0 of {_drop} to diamond named "&b&lDiament:" with lore "&8&l➔ &r&7Szansa: 3%" and "&8&l➔ &r&7Ilosc: 1x" and "&8&l➔ &r&7Aktywny: %{status.drop1.%player%}%"
        set slot 1 of {_drop} to black stained glass pane
        set slot 2 of {_drop} to black stained glass pane
        set slot 3 of {_drop} to black stained glass pane
        set slot 4 of {_drop} to black stained glass pane
        set slot 5 of {_drop} to black stained glass pane
        set slot 6 of {_drop} to black stained glass pane
        set slot 7 of {_drop} to black stained glass pane
        set slot 8 of {_drop} to black stained glass pane
        set slot 9 of {_drop} to black stained glass pane
        set slot 10 of {_drop} to black stained glass pane
        set slot 11 of {_drop} to black stained glass pane
        set slot 12 of {_drop} to black stained glass pane
        set slot 13 of {_drop} to black stained glass pane
        set slot 14 of {_drop} to black stained glass pane
        set slot 15 of {_drop} to black stained glass pane
        set slot 16 of {_drop} to black stained glass pane
        set slot 17 of {_drop} to black stained glass pane
        set slot 18 of {_drop} to black stained glass pane
        set slot 19 of {_drop} to black stained glass pane
        set slot 20 of {_drop} to black stained glass pane
        set slot 21 of {_drop} to black stained glass pane
        set slot 22 of {_drop} to black stained glass pane
        set slot 23 of {_drop} to black stained glass pane
        set slot 24 of {_drop} to black stained glass pane
        set slot 25 of {_drop} to black stained glass pane
        set slot 26 of {_drop} to black stained glass pane
        open {_drop} to player

command /drop1:
    permission: fixed.drop
    permission message: &7[&4&lCS-OWO.PL&r&7] &8>> &cNie masz dostepu do tej komendy! &7(fixed.drop)
    trigger:
        if {drop1.%player%} is false:
            set {drop1.%player%} to true
            set {status.drop1.%player%} to "&a&l✔"
            set {wiadomosc.drop1.%player%} to "&a&l&nwlaczony"
        else:
            set {drop1.%player%} to false
            set {status.drop1.%player%} to "&c&l✘"
            set {wiadomosc.drop1.%player%} to "&c&l&nwylaczony"

 

Moje pytanie brzmi: da się te dwie komendy złączyć w jedną? Chciałbym aby po wpisaniu samego /drop wyświetlało się gui, a po wpisaniu /drop 1 wykonywały się komendy właśnie oto z tej komendy. 

Odnośnik do komentarza
https://skript.pl/temat/45670-problem/
Udostępnij na innych stronach

7 odpowiedzi na to pytanie

Rekomendowane odpowiedzi

  • 1
1 minutę temu, fiXed napisał:

Moje pytanie brzmi: da się te dwie komendy złączyć w jedną? Chciałbym aby po wpisaniu samego /drop wyświetlało się gui, a po wpisaniu /drop 1 wykonywały się komendy właśnie oto z tej komendy. 

Tak. Definiujesz komendę z opcjonalnym argumentem nr 1 typu 'text'.

Sprawdzasz w niej czy argument 1 jest ustawiony - jeżeli tak, wykonujesz kod od "/drop1"; jeżeli nie, wykonujesz kod od otwierania GUI.

Jedna uwaga co do twojego GUI, a konkretniej ustawiania szyb. Można je znacznie skrócić.

set slot (integers between 1 and 26) of {_drop} to black stained glass pane

Efekt będzie taki sam, a robisz to w jednej linijce.

Odnośnik do komentarza
https://skript.pl/temat/45670-problem/#findComment-287669
Udostępnij na innych stronach

  • 0
3 minuty temu, Kormic napisał:

Sprawdzasz w niej czy argument 1 jest ustawiony - jeżeli tak, wykonujesz kod od "/drop1"; jeżeli nie, wykonujesz kod od otwierania GUI.

tylko ja chcialem aby konkretny argument wykonywał konkretny kod (np. /drop jeden - wykonuje pierwszy kod; /drop dwa - wykonuje drugi kod)

Edytowane przez fiXed
Odnośnik do komentarza
https://skript.pl/temat/45670-problem/#findComment-287671
Udostępnij na innych stronach

  • 1
2 minuty temu, fiXed napisał:

tylko ja chcialem aby konkretny argument wykonywał konkretny kod (np. /drop jeden - wykonuje pierwszy kod; /drop dwa - wykonuje drugi kod)

No to porównuj argument nr 1 do tego co tam sobie chcesz.

if arg-1 is "jeden":

 

Odnośnik do komentarza
https://skript.pl/temat/45670-problem/#findComment-287673
Udostępnij na innych stronach

  • 0

Mam teraz tak:

command /drop [<text>]:
    trigger:
        if arg-1 is not set:
            set {_drop} to chest inventory with 3 rows named "&4&lDROP:"
            set slot 0 of {_drop} to diamond named "&b&lDiament:" with lore "&8&l➔ &r&7Szansa: 3%" and "&8&l➔ &r&7Ilosc: 1x" and "&8&l➔ &r&7Aktywny: %{status.drop1.%player%}%"
            set slot (integers between 1 and 26) of {_drop} to black stained glass pane
            open {_drop} to player
        if arg-1 is "jeden":
            if {drop1.%player%} is false:           #to jest linia 63#
            set {drop1.%player%} to true
            set {status.drop1.%player%} to "&a&l✔"
            set {wiadomosc.drop1.%player%} to "&a&l&nwlaczony"
        else:
            set {drop1.%player%} to false
            set {status.drop1.%player%} to "&c&l✘"
            set {wiadomosc.drop1.%player%} to "&c&l&nwylaczony"

on inventory click:
    name of player's current inventory is "&4&lDROP:"
    clicked inventory is not player's inventory
    cancel event
    if clicked slot is 0:
        execute player command "/drop jeden"
        close player's inventory
        send "&7[&4&lCS-OWO.PL&r&7] &8>> &aDrop diamentu z kamienia zostal pomyslnie %{wiadomosc.drop1.%player%}%"

 

I na chacie wyskakuje taki błąd: 

Cytat

 Empty configuration section! You might want to indent one or more of the subsequent lines to make them belong to this section or remove the colon at the end of the line if you don't want this line to start a section. (drop.sk, line 63: if {drop1.%player%} is false:')

 

Edytowane przez fiXed
Odnośnik do komentarza
https://skript.pl/temat/45670-problem/#findComment-287674
Udostępnij na innych stronach

  • 1
23 minuty temu, fiXed napisał:

I na chacie wyskakuje taki błąd: 

Cytat

 Empty configuration section! You might want to indent one or more of the subsequent lines to make them belong to this section or remove the colon at the end of the line if you don't want this line to start a section. (drop.sk, line 63: if {drop1.%player%} is false:')

 

Wystarczy usunąć 'if' oraz dwukropek na końcu warunku.

Odnośnik do komentarza
https://skript.pl/temat/45670-problem/#findComment-287677
Udostępnij na innych stronach

Nieaktywny
Ten temat został zamknięty. Brak możliwości dodania odpowiedzi.
  • Ostatnio przeglądający   0 użytkowników

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