#Offhand slot
1 messages · Page 1 of 1 (latest)
offhand slot is slot 45 of the player's inventory
try if event-slot = 45?
sorry, 40
on inventory click:
if index of event-slot = 40:
@elder sandal
event-slot itself is just the item IN the slot, not the slot itself
yeah ik
alr that worked
but
its not what i wanted
lets say i got a stick in my hotbar
then opened my inventory
then clicked on the stick and dragged it to the offhand slot then clicked there
how do i detect that the player clicked on the offhand slot
@sacred canopy
the same code should work with that though? if you want to check if the player puts an item in the offhand through the inventory, itll call a check to the original slot it was in AND when you put it in the offhand slot
ofc itll only fire when put IN the slot, since thats when the event-slot is the offhand
can you gimme some pseudo code/ skript
on inventory click:
if index of event-slot = 40:
send "you put it in the offhand."
this'll also trigger when theyre not holding anything, keep that in mind
i just shut down my server so i can't actively test this snippet, but this should also check if the player is holding any item while clicking the off hand slot:
on inventory click:
if all:
index of event-slot = 40
cursor slot of player is not air
then:
send "you put it in the offhand."
well, if you open any inventory that is not your own, typically you wont have access to your offhand slot
on inventory click:
if all:
index of event-slot is 40
cursor slot of player is not air
then:
if event-item is stick:
broadcast "yes"
this is the problem
i have a stick on my hotbar
clicked it
and draged to the offhand slot
then clicked the offhand slot
after that
it does'nt broadcast "yes"
do cursor slot instead of event-item since event-item IS the item currently in the slot, whilst cursor slot is the item youre dragging over there
on inventory click:
if all:
index of event-slot is 40
cursor slot of player is not air
then:
if cursor slot is stick:
broadcast "yes"
so like this?
that should work
maybe try (cursor slot of player)?