Cuberite Forum
[SOLVED] Catch left click on frame? - Printable Version

+- Cuberite Forum (https://forum.cuberite.org)
+-- Forum: Plugins (https://forum.cuberite.org/forum-1.html)
+--- Forum: Plugin Discussion (https://forum.cuberite.org/forum-8.html)
+--- Thread: [SOLVED] Catch left click on frame? (/thread-2294.html)



[SOLVED] Catch left click on frame? - DrMasik - 01-01-2016

Is it possible catch left click on the frame (#389)?


RE: Catch left click on frame? - NiLSPACE - 01-01-2016

Try this hook: http://api-docs.cuberite.org/OnPlayerRightClickingEntity.html


RE: Catch left click on frame? - DrMasik - 01-02-2016

(01-01-2016, 03:23 AM)NiLSPACE Wrote: Try this hook: http://api-docs.cuberite.org/OnPlayerRightClickingEntity.html

Clicking on the right button works fine Smile. But I need a _left_ button.


RE: Catch left click on frame? - NiLSPACE - 01-02-2016

Try the OnTakeDamage hook.
function OnTakeDamage(a_Receiver, a_TDI)
   if (a_TDI.Attacker == nil or not a_Receiver:IsItemFrame() or not a_TDI.Attacker:IsPlayer()) then
      return false
   end
   -- Your code
end



RE: Catch left click on frame? - DrMasik - 01-02-2016

(01-02-2016, 02:07 AM)NiLSPACE Wrote: Try the OnTakeDamage hook.
function OnTakeDamage(a_Receiver, a_TDI)
   if (a_TDI.Attacker == nil or not a_Receiver:IsItemFrame() or not a_TDI.Attacker:IsPlayer()) then
      return false
   end
   -- Your code
end

You're ahead of me Smile Thank you!