Skocz do zawartości
  • 0

Obstawianie


gnomq

Pytanie

Jeśli gracz wpisze komendę '/obstaw' otworzy się gui (3 rows) na środku trzymany przez gracza przedmiot i w lore tego przedmiotu: ''50% szans - stracisz przedmiot, 50% szans - otrzymasz go x2, kliknij, aby obstawić'. Po obstawieniu usuwa graczowi z eq dany przedmiot.Jeśli gracz przegra, to zamknie się gui z wiadomością na czacie, a jeśli wygra, to po kliknięciu w ten przedmiot, gracz dostanie go do ekwipunku x2. Jeśli wygra, to dodatkowa wiadomość w nazwie tego przedmiotu: 'wygrałeś, kliknij, aby odebrać'.

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

16 odpowiedzi na to pytanie

Rekomendowane odpowiedzi

  • 0
49 minut temu, gnomq2000 napisał:

Jeśli gracz wpisze komendę '/obstaw' otworzy się gui (3 rows) na środku trzymany przez gracza przedmiot i w lore tego przedmiotu: ''50% szans - stracisz przedmiot, 50% szans - otrzymasz go x2, kliknij, aby obstawić'. Po obstawieniu usuwa graczowi z eq dany przedmiot.Jeśli gracz przegra, to zamknie się gui z wiadomością na czacie, a jeśli wygra, to po kliknięciu w ten przedmiot, gracz dostanie go do ekwipunku x2. Jeśli wygra, to dodatkowa wiadomość w nazwie tego przedmiotu: 'wygrałeś, kliknij, aby odebrać'.

Sprawdź czy zadziała. Proszę, oto skrypt.

command /obstaw:
	executable by: players
	trigger:
		if player's tool is air:
			send "&cMusisz trzymac cos w rece, aby moc obstawiac!" to player
			stop
		open chest inventory with 3 rows named "&6&lObstawianie" to player
		loop integers between 0 and 8:
			set slot loop-integer of player's current inventory to white stained glass pane named " "
		loop integers between 9 and 17:
			set slot loop-integer of player's current inventory to gray stained glass pane named " "
		loop integers between 18 and 26:
			set slot loop-integer of player's current inventory to white stained glass pane named " "
		set {_d} and {obstawianie::t::%player%} to player's tool
		set {_l::*} to lore of {_d}
		set line (size of {_l::*} + 1) of {_d} to " "
		set line (size of {_l::*} + 2) of {_d} to "&250%% &aszans na podwojenie przedmiotu"
		set line (size of {_l::*} + 3) of {_d} to "&450%% &cszans na utratę przedmiotu"
		set line (size of {_l::*} + 4) of {_d} to " "
		set line (size of {_l::*} + 5) of {_d} to "&aKliknij, aby obstawić!"
		set slot 13 of player's current inventory to {_d}

on inventory click:
	if name of player's current inventory is not "&6&lObstawianie":
		stop
	if clicked inventory is player's inventory:
		stop
	cancel event
	if clicked slot is 13:
		set {_t} to player's tool
		if slot 13 of player's current inventory is {obstawianie::t::%player%} named "&aWygrales, kliknij aby odebrac!":
			give 2 of {obstawianie::t::%player%} to player
			close player's inventory
			stop
		delete player's tool
		chance of 50%:
			play sound "block_note_block_pling" with volume 3 and pitch 4 to player
			set slot 13 of player's current inventory to {_t} named "&aWygrales, kliknij aby odebrac!"
			stop
		chance of 50%:
			play sound "entity_blaze_ambient" with volume 3 and pitch 4 to player
			close player's inventory
			send "&cNiestety przegrales, powodzenia nastepnym razem!" to player
			
on inventory close:			
	if name of player's current inventory is not "&6&lObstawianie":
		stop
	if slot 13 of player's current inventory is not {obstawianie::t::%player%} named "&aWygrales, kliknij aby odebrac!":
		stop
	give 2 of {obstawianie::t::%player%} to player
	clear {obstawianie::t::%player%}

EDIT:

Mała poprawka, pozbyłem się 'loop-number'.

EDIT:

Poprawiłem zmienne.

Edytowane przez Kormic
Odnośnik do komentarza
https://skript.pl/temat/41539-obstawianie/#findComment-260077
Udostępnij na innych stronach

  • 0
10 minut temu, Kormic napisał:

Sprawdź czy zadziała. Proszę, oto skrypt.


command /obstaw:
	executable by: players
	trigger:
		if player's tool is air:
			send "&cMusisz trzymac cos w rece, aby moc obstawiac!" to player
			stop
		open chest inventory with 3 rows named "&6&lObstawianie" to player
		loop integers between 0 and 8:
			set slot loop-integer of player's current inventory to white stained glass pane named " "
		loop integers between 9 and 17:
			set slot loop-integer of player's current inventory to gray stained glass pane named " "
		loop integers between 18 and 26:
			set slot loop-integer of player's current inventory to white stained glass pane named " "
		set {_d} and {obstawianie::t::%player%} to player's tool
		set {_l::*} to lore of {_d}
		set line (size of {_l::*} + 1) of {_d} to " "
		set line (size of {_l::*} + 2) of {_d} to "&250%% &aszans na podwojenie przedmiotu"
		set line (size of {_l::*} + 3) of {_d} to "&450%% &cszans na utratę przedmiotu"
		set line (size of {_l::*} + 4) of {_d} to " "
		set line (size of {_l::*} + 5) of {_d} to "&aKliknij, aby obstawić!"
		set slot 13 of player's current inventory to {_d}

on inventory click:
	if name of player's current inventory is not "&6&lObstawianie":
		stop
	if clicked inventory is player's inventory:
		stop
	cancel event
	if clicked slot is 13:
		set {_t} to player's tool
		if slot 13 of player's current inventory is {_t} named "&aWygrales, kliknij aby odebrac!":
			give 2 of {_t} to player
			close player's inventory
			stop
		delete player's tool
		chance of 50%:
			play sound "block_note_block_pling" with volume 3 and pitch 4 to player
			set slot 13 of player's current inventory to {_t} named "&aWygrales, kliknij aby odebrac!"
			stop
		chance of 50%:
			play sound "entity_blaze_ambient" with volume 3 and pitch 4 to player
			close player's inventory
			send "&cNiestety przegrales, powodzenia nastepnym razem!" to player
			
on inventory close:			
	if name of player's current inventory is not "&6&lObstawianie":
		stop
	if slot 13 of player's current inventory is not {obstawianie::t::%player%} named "&aWygrales, kliknij aby odebrac!":
		stop
	give 2 of {obstawianie::t::%player%} to player
	clear {obstawianie::t::%player%}

EDIT:

Mała poprawka, pozbyłem się 'loop-number'.

dzięki, ale jak wygrałem klikam to nic się nie dzieje, a jak kliknę drugi raz to znika item z gui i nic się nie dzieje :thonk:

Odnośnik do komentarza
https://skript.pl/temat/41539-obstawianie/#findComment-260081
Udostępnij na innych stronach

  • 0
1 minutę temu, gnomq2000 napisał:

dzięki, ale jak wygrałem klikam to nic się nie dzieje, a jak kliknę drugi raz to znika item z gui i nic się nie dzieje :thonk:

Czy usuwa się trzymany przez ciebie item?

Odnośnik do komentarza
https://skript.pl/temat/41539-obstawianie/#findComment-260085
Udostępnij na innych stronach

  • 0
1 minutę temu, Kormic napisał:

Inaczej. Powiedz dokładnie co się dzieje podczas wykonywania komendy.

jeśli wygram usuwa mi itemy, a po kliknięciu w gui na niego, aby go odebrać nic się nie dzieje, a gdy kliknę po raz drugi to znika i jest pusty slot, a gdy kliknę w pusty slot zamyka się gui

Edytowane przez gnomq2000
Odnośnik do komentarza
https://skript.pl/temat/41539-obstawianie/#findComment-260089
Udostępnij na innych stronach

  • 0
3 minuty temu, gnomq2000 napisał:

jeśli wygram usuwa mi itemy, a po kliknięciu w gui na niego, aby go odebrać nic się nie dzieje, a gdy kliknę po raz drugi to znika i jest pusty slot

Dobra, już namierzyłem błąd. Problem wynika z tego, że co każde kliknięcie zmienna ustawia się do obecnie trzymanego itemu przez gracza. Dlatego też to nie działa, bo już wcześniej jest usuwane narzędzie gracza, więc ten zapisany item jest powietrzem. Za chwilę poprawię skrypt wyżej, daj mi chwilę.

EDIT:

Poprawiłem skrypt, sprawdź jeszcze raz.

Edytowane przez Kormic
Odnośnik do komentarza
https://skript.pl/temat/41539-obstawianie/#findComment-260091
Udostępnij na innych stronach

  • 0
19 minut temu, Kormic napisał:

Dobra, już namierzyłem błąd. Problem wynika z tego, że co każde kliknięcie zmienna ustawia się do obecnie trzymanego itemu przez gracza. Dlatego też to nie działa, bo już wcześniej jest usuwane narzędzie gracza, więc ten zapisany item jest powietrzem. Za chwilę poprawię skrypt wyżej, daj mi chwilę.

EDIT:

Poprawiłem skrypt, sprawdź jeszcze raz.

teraz dostaję x4, a jak jest np. 64 kamienia, to też jak wygram daje mi 4. jeśli wezmę ten przedmiot i po prostu zdubluję w slocie, to zniknie 

Odnośnik do komentarza
https://skript.pl/temat/41539-obstawianie/#findComment-260093
Udostępnij na innych stronach

  • 0
26 minut temu, gnomq2000 napisał:

teraz dostaję x4, a jak jest np. 64 kamienia, to też jak wygram daje mi 4. jeśli wezmę ten przedmiot i po prostu zdubluję w slocie, to zniknie 

Hmm... A w ten sposób?

command /obstaw:
	executable by: players
	trigger:
		if player's tool is air:
			send "&cMusisz trzymac cos w rece, aby moc obstawiac!" to player
			stop
		open chest inventory with 3 rows named "&6&lObstawianie" to player
		loop integers between 0 and 8:
			set slot loop-integer of player's current inventory to white stained glass pane named " "
		loop integers between 9 and 17:
			set slot loop-integer of player's current inventory to gray stained glass pane named " "
		loop integers between 18 and 26:
			set slot loop-integer of player's current inventory to white stained glass pane named " "
		set {_a} and {obstawianie::a::%player%} to item amount of player's tool	
		set {_d} and {obstawianie::t::%player%} to player's tool
		set {_l::*} to lore of {_d}
		set line (size of {_l::*} + 1) of {_d} to " "
		set line (size of {_l::*} + 2) of {_d} to "&250%% &aszans na podwojenie przedmiotu"
		set line (size of {_l::*} + 3) of {_d} to "&450%% &cszans na utratę przedmiotu"
		set line (size of {_l::*} + 4) of {_d} to " "
		set line (size of {_l::*} + 5) of {_d} to "&aKliknij, aby obstawić!"
		set slot 13 of player's current inventory to {_a} of {_d}

on inventory click:
	if name of player's current inventory is not "&6&lObstawianie":
		stop
	if clicked inventory is player's inventory:
		stop
	cancel event
	if clicked slot is 13:
		set {_a} to item amount of player's tool
		set {_t} to player's tool
		if slot 13 of player's current inventory is {obstawianie::t::%player%} named "&aWygrales, kliknij aby odebrac!":
			give ({obstawianie::a::%player%} * 2) of {obstawianie::t::%player%} to player
			clear {obstawianie::t::%player%}
			clear {obstawianie::a::%player%}
			close player's inventory
			stop
		delete player's tool
		chance of 50%:
			play sound "block_note_block_pling" with volume 3 and pitch 4 to player
			set slot 13 of player's current inventory to {_t} named "&aWygrales, kliknij aby odebrac!"
			stop
		chance of 50%:
			play sound "entity_blaze_ambient" with volume 3 and pitch 4 to player
			close player's inventory
			send "&cNiestety przegrales, powodzenia nastepnym razem!" to player
			
on inventory close:			
	if name of player's current inventory is not "&6&lObstawianie":
		stop
	if {obstawianie::t::%player%} is not set:
		stop
	if slot 13 of player's current inventory is not {obstawianie::t::%player%} named "&aWygrales, kliknij aby odebrac!":
		stop
	give ({obstawianie::a::%player%} * 2) of {obstawianie::t::%player%} to player
	clear {obstawianie::t::%player%}
	clear {obstawianie::a::%player%}

EDIT:

Poprawiłem zmienną.

Edytowane przez Kormic
Odnośnik do komentarza
https://skript.pl/temat/41539-obstawianie/#findComment-260094
Udostępnij na innych stronach

  • 0
8 minut temu, Kormic napisał:

Hmm... A w ten sposób?


command /obstaw:
	executable by: players
	trigger:
		if player's tool is air:
			send "&cMusisz trzymac cos w rece, aby moc obstawiac!" to player
			stop
		open chest inventory with 3 rows named "&6&lObstawianie" to player
		loop integers between 0 and 8:
			set slot loop-integer of player's current inventory to white stained glass pane named " "
		loop integers between 9 and 17:
			set slot loop-integer of player's current inventory to gray stained glass pane named " "
		loop integers between 18 and 26:
			set slot loop-integer of player's current inventory to white stained glass pane named " "
		set {_a} and {obstawianie::a::%player%} to item amount of player's tool	
		set {_d} and {obstawianie::t::%player%} to player's tool
		set {_l::*} to lore of {_d}
		set line (size of {_l::*} + 1) of {_d} to " "
		set line (size of {_l::*} + 2) of {_d} to "&250%% &aszans na podwojenie przedmiotu"
		set line (size of {_l::*} + 3) of {_d} to "&450%% &cszans na utratę przedmiotu"
		set line (size of {_l::*} + 4) of {_d} to " "
		set line (size of {_l::*} + 5) of {_d} to "&aKliknij, aby obstawić!"
		set slot 13 of player's current inventory to {_a} of {_d}

on inventory click:
	if name of player's current inventory is not "&6&lObstawianie":
		stop
	if clicked inventory is player's inventory:
		stop
	cancel event
	if clicked slot is 13:
		set {_a} to item amount of player's tool
		set {_t} to player's tool
		if slot 13 of player's current inventory is {obstawianie::t::%player%} named "&aWygrales, kliknij aby odebrac!":
			give ({_a} * 2) of {obstawianie::t::%player%} to player
			clear {obstawianie::t::%player%}
			clear {obstawianie::a::%player%}
			close player's inventory
			stop
		delete player's tool
		chance of 50%:
			play sound "block_note_block_pling" with volume 3 and pitch 4 to player
			set slot 13 of player's current inventory to {_t} named "&aWygrales, kliknij aby odebrac!"
			stop
		chance of 50%:
			play sound "entity_blaze_ambient" with volume 3 and pitch 4 to player
			close player's inventory
			send "&cNiestety przegrales, powodzenia nastepnym razem!" to player
			
on inventory close:			
	if name of player's current inventory is not "&6&lObstawianie":
		stop
	if {obstawianie::t::%player%} is not set:
		stop
	if slot 13 of player's current inventory is not {obstawianie::t::%player%} named "&aWygrales, kliknij aby odebrac!":
		stop
	give ({obstawianie::a::%player%} * 2) of {obstawianie::t::%player%} to player
	clear {obstawianie::t::%player%}
	clear {obstawianie::a::%player%}

 

błąd 22 linijka

Odnośnik do komentarza
https://skript.pl/temat/41539-obstawianie/#findComment-260095
Udostępnij na innych stronach

  • 0
1 minutę temu, Kormic napisał:

Zaraz, zaraz. Czy gdy obstawiałeś 64 cobblestone'a to czy pojawiało się w GUI tyle samo?

teraz gdy obstawiam, to nie ma slotu z przedmiotem, tylko czarne szkło, a jak kliknę, to znika i jest pusty slot

Odnośnik do komentarza
https://skript.pl/temat/41539-obstawianie/#findComment-260100
Udostępnij na innych stronach

  • 0
Teraz, gnomq2000 napisał:

teraz gdy obstawiam, to nie ma slotu z przedmiotem, tylko czarne szkło, a jak kliknę, to znika i jest pusty slot

Nie to mam na myśli... mówię o pierwotnym skrypcie. Jeśli było 64 cobblestone w slocie, to możesz usunąć '{_a} of' z tej linijki.

Odnośnik do komentarza
https://skript.pl/temat/41539-obstawianie/#findComment-260101
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
Odpowiedz na pytanie...

×   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ę...