Skocz do zawartości
  • 0

argument w on inventory click


Pytanie

Siemka, zrobiłem skrypt ktory polega na tym ze wpisuje /isp nick i otwiera mi sie gui czy chce opcje nr 1 albo 2 (1= mniej informacji o graczu) -> (2= wiecej) i mam takie cos potem:

on inventory click:
	if inventory name of current inventory of player contains "isp":
		cancel event
		if clicked slot is 3:
			send "IRON"
		if clicked slot is 6:
			send "DIAMOND"
			open chest inventory with 3 rows named "%arg 1%" to player

ale nie otwiera poniewaz w on inventory click nie ma arguemntu 1(gracza nick) i jakby to zrobic ze bedzie wychwytywac ze ten arg1 to nick gracza z komendy? 

Odnośnik do komentarza
https://skript.pl/temat/49017-argument-w-on-inventory-click/
Udostępnij na innych stronach

15 odpowiedzi na to pytanie

Rekomendowane odpowiedzi

  • 0
command /isp <text>:
	trigger:
		set {_inv} to chest with 1 row named "isp %arg%"
		set slot 3 of {_inv} to iron ingot
		set slot 6 of {_inv} to diamond
		open {_inv} to player
on inventory click:
	if inventory name of current inventory of player contains "isp":
		set {_player} to name of current inventory
		replace "isp " with "" in {_player}
		cancel event
		if clicked slot is 3:
			send "IRON"
		if clicked slot is 6:
			send "DIAMOND"
			open chest inventory with 3 rows named "%{_player}%" to player

 

Odnośnik do komentarza
https://skript.pl/temat/49017-argument-w-on-inventory-click/#findComment-304862
Udostępnij na innych stronach

  • 0

Okej git, a ogolnie da sie to jakos zrobic ze jesli wpisze np. /isp ma a mam nick marek to ze nie dziala bo musze wpisac dokladny nick? zrobilem ogolnie:

		if arg 1 is offline:
			send "offline gracz" to player
			stop

ale to dziala tylko gdy wpisze np. /isp asjndanjsdj a jak wpisze nawet pierwszą literke nicku to dziala na mnie (sam jestem na serwie)

Odnośnik do komentarza
https://skript.pl/temat/49017-argument-w-on-inventory-click/#findComment-304865
Udostępnij na innych stronach

  • 0
26 minut temu, Shooterowy napisał:

command /isp <text>:
	trigger:
		set {_inv} to chest with 1 row named "isp %arg%"
		set slot 3 of {_inv} to iron ingot
		set slot 6 of {_inv} to diamond
		open {_inv} to player
on inventory click:
	if inventory name of current inventory of player contains "isp":
		set {_player} to name of current inventory
		replace "isp " with "" in {_player}
		cancel event
		if clicked slot is 3:
			send "IRON"
		if clicked slot is 6:
			send "DIAMOND"
			open chest inventory with 3 rows named "%{_player}%" to player

 

I mam cos takiego:

			if arg-1's chestplate is not air:
				set slot 48 of player's current inventory to arg-1's chestplate

ale wtedy jest 

[23:33:14 ERROR]: The expression 'argument' can only be used within a command (1.sk, line 242: if arg-1's chestplate is not air:')

a jak zrobie

			if {_player} chestplate is not air:
				set slot 48 of player's current inventory to {_player} chestplate

to jest wtedy

[23:34:30 ERROR]: Can't compare '{_player} chestplate' with an item type (1.sk, line 242: if {_player} chestplate is not air:')

 

Odnośnik do komentarza
https://skript.pl/temat/49017-argument-w-on-inventory-click/#findComment-304866
Udostępnij na innych stronach

  • 0
18 minut temu, Walasz napisał:

a jak zrobie


			if {_player} chestplate is not air:
				set slot 48 of player's current inventory to {_player} chestplate

to jest wtedy


[23:34:30 ERROR]: Can't compare '{_player} chestplate' with an item type (1.sk, line 242: if {_player} chestplate is not air:')

Podstawy angielskiego

{_player}'s chestplate

lub

chestplate of {_player}

 

Odnośnik do komentarza
https://skript.pl/temat/49017-argument-w-on-inventory-click/#findComment-304869
Udostępnij na innych stronach

  • 0
2 minuty temu, Shooterowy napisał:

Podstawy angielskiego


{_player}'s chestplate

lub


chestplate of {_player}

 

Robie tak

			if {_player}'s chestplate is not air:
				set slot 48 of player's current inventory to {_player}'s chestplate

i tez tak

			if chestplate of {_player} is not air:
				set slot 48 of player's current inventory to chestplate of {_player}

ale nie dziala po prostu nie ma nic w tym slocie, 

 

Odnośnik do komentarza
https://skript.pl/temat/49017-argument-w-on-inventory-click/#findComment-304870
Udostępnij na innych stronach

  • 0

Rowniez mam cos takiego:

			loop 36 times:
				if {_num} is between 0 and 8:
					set slot ({_num} + 27) of player's current inventory to slot {_num} of arg-1's inventory
				if {_num} is between 9 and 35:
					set slot ({_num} - 9) of player's current inventory to slot {_num} of arg-1's inventory
				add 1 to {_num}

i gdy bylo to w komendzie -> trigger -> if arg 1 is set:

to dzialalo normalnie ale teraz jak mam to bardziej skomplikowane i robie tak:

			loop 36 times:
				if {_num} is between 0 and 8:
					set slot ({_num} + 27) of player's current inventory to slot {_num} of {_player}'s inventory
				if {_num} is between 9 and 35:
					set slot ({_num} - 9) of player's current inventory to slot {_num} of {_player}'s inventory
				add 1 to {_num}

to tez nie dziala ale bledow nie ma, probowalem tez bez 's przy {_player} super jakbys pomogl z tym bo to jest naprawde wazne dla mnie;v

Odnośnik do komentarza
https://skript.pl/temat/49017-argument-w-on-inventory-click/#findComment-304871
Udostępnij na innych stronach

  • 0

tak wyglada caly kod:

command /komenda [<offlineplayer>] [<text>]:
	executable by: players
	trigger:
		if arg 1 is set:
			if arg 1 is online:
				set {_inv} to chest with 1 row named "&eisp: &6%arg 1%"
				set slot 3 of {_inv} to iron pickaxe
				set slot 6 of {_inv} to diamond pickaxe
				open {_inv} to player
				stop
			else:
				send "a"
on inventory click:
	if inventory name of current inventory of player contains "&eisp:":
		set {_player} to name of current inventory
		replace "&eisp: " with "" in {_player}
		cancel event
		if clicked slot is 3:
			send "IRON"
		if clicked slot is 6:
			send "DIAMOND"
			open chest inventory with 6 rows named "&eisp: &6%{_player}%" to player
			set {_num} to 0
			loop 36 times:
				if {_num} is between 0 and 8:
					set slot ({_num} + 27) of player's current inventory to slot {_num} of {_player}'s inventory
				if {_num} is between 9 and 35:
					set slot ({_num} - 9) of player's current inventory to slot {_num} of arg-1's inventory
				add 1 to {_num}
			set slot (integers between 36 and 44) of player's current inventory to black stained glass pane named " "
			set slot 46 of player's current inventory to white stained glass pane named ""
			set slot 45 of player's current inventory to black stained glass pane named " "
			set slot 49 of player's current inventory to black stained glass pane named " "
			set slot 52 of player's current inventory to black stained glass pane named " "
			if {_player}'s helmet  is not air:
				set slot 47 of player's current inventory to player's helmet named "%{_player}%"
			if {_player}'s chestplate is not air:
				set slot 48 of player's current inventory to {_player}'s chestplate
			if player's leggings is not air:
				set slot 50 of player's current inventory to player's leggings
			if player's boots is not air:
				set slot 51 of player's current inventory to player's boots
			set {_h} to player's health*2
			set slot 53 of player's current inventory to dirt named "&azdrowie: &a%{_h}%&f/&c20"  

 

Odnośnik do komentarza
https://skript.pl/temat/49017-argument-w-on-inventory-click/#findComment-304872
Udostępnij na innych stronach

  • 0
Godzinę temu, Shooterowy napisał:

sprobuj wymusić typ zmiennej jako gracz, dodając 


set {_player} to {_player} parsed as player

po linijce


replace "&eisp: " with "" in {_player}

 

Sprobowalem z tym 

			if {_player} chestplate is not air:
				set slot 48 of player's current inventory to {_player} chestplate
			if {_player}'s leggings is not air:
				set slot 50 of player's current inventory to {_player}'s leggings

ale nie dziala nic sie nie wyswietla w tym slocie (sprawdzalem z 's i bez)

Odnośnik do komentarza
https://skript.pl/temat/49017-argument-w-on-inventory-click/#findComment-304874
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ę...