function provaFunzione(p: player , s: slot , i: item):
if inventory name of current inventory of {_p} is {@inv-name}:
if name of {_i} is "{@slot1}":
if slot {_s} of {_p} is not air:
if {_p} have diamond pickaxe:
cancel event
send "{@slot-full}" to {_p}
play sound "{@error-sound}" with volume {@volume3} with pitch {@pitch3} at {_p} for {_p}
if slot {_s} of {_p} is air:
loop all items in {_p}'s inventory:
if loop-item is diamond pickaxe:
set {picck} to loop-item
remove {picck} from {_p}'s inventory
set slot {_s} of {_p} to {picck}
play sound "{@sel-slot-sound}" with volume {@volume2} with pitch {@pitch2} at {_p} for {_p}
cancel event
if {_p} doesn't have diamond pickaxe:
cancel event
send "{@no-pick}" to {_p}
play sound "{@error-sound}" with volume {@volume3} with pitch {@pitch3} at {_p} for {_p}
on inventory click:
provaFunzione(player , 0 , event-item)
I created this code with a function, only when I reload the skript it tells me that it is not possible to use the cancel event in the function, can anyone help me?
if inventory name of current inventory of {_p} is {@inv-name}:
if name of {_i} is "{@slot1}":
if slot {_s} of {_p} is not air:
if {_p} have diamond pickaxe:
cancel event
send "{@slot-full}" to {_p}
play sound "{@error-sound}" with volume {@volume3} with pitch {@pitch3} at {_p} for {_p}
if slot {_s} of {_p} is air:
loop all items in {_p}'s inventory:
if loop-item is diamond pickaxe:
set {picck} to loop-item
remove {picck} from {_p}'s inventory
set slot {_s} of {_p} to {picck}
play sound "{@sel-slot-sound}" with volume {@volume2} with pitch {@pitch2} at {_p} for {_p}
cancel event
if {_p} doesn't have diamond pickaxe:
cancel event
send "{@no-pick}" to {_p}
play sound "{@error-sound}" with volume {@volume3} with pitch {@pitch3} at {_p} for {_p}
on inventory click:
provaFunzione(player , 0 , event-item)
I created this code with a function, only when I reload the skript it tells me that it is not possible to use the cancel event in the function, can anyone help me?