Hello, today i tried to make a skript that searches an item through the whole server (also inside a players' inventory). The part that searches a player's inventory works, although the part that searches the chest's inventory doesn't. How can i make this work?
Errors: None
Code:
function itemSearch(p: player, i: item):
set {_results.%{_p}%} to 0
send "&a&lItemSearch &8- &7You're searching an item..." to {_p}
loop all chests:
set {_loc} to loop-value's location
if block at {_loc} contains {_i}:
add 1 to {_results.%{_p}%}
set {_v} to loop-value
set {_x} to {_v}'s x coordinate
set {_y} to {_v}'s y coordinate
set {_z} to {_v}'s z coordinate
send "&8 - &7Container &8(&7%{_x}% %{_y}% %{_z}%&8)" to {_p}
loop all barrels:
loop items in loop-value:
if loop-value is {_i}:
add 1 to {_results.%{_p}%}
set {_v} to loop-value
set {_x} to {_v}'s x coordinate
set {_y} to {_v}'s y coordinate
set {_z} to {_v}'s z coordinate
send "&8 - &7Container &8(&7%{_x}% %{_y}% %{_z}%&8)" to {_p}
loop all players:
if loop-player has {_i}:
add 1 to {_results.%{_p}%}
send "&8 - &7Player &8(&7Open inv&8)" to {_p}
send "&a&lItemSearch &8- &7Process terminated (Risultati: %{_results.%{_p}%}%)" to {_p}
command /itemsearch:
trigger:
if player's tool isn't air:
set {_i} to player's held item
set {_t} to name of player's held item
set {_l::*} to lore of player's held item
globalSearch(player, {_i})
Errors: None