![]() |
Need Help for hooks - 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: Need Help for hooks (/thread-3460.html) |
Need Help for hooks - Dredd - 02-03-2025 Hi all, i have a problem. I don't understand how to do it right. Need: When opening the oven or chest, notice the movement of objects, and perform some actions before closing the window. My code doesn't work because the hook doesn't have the necessary functions. My code: Init.lua contains: PHP Code: cPluginManager:AddHook(cPluginManager.HOOK_PLAYER_OPENING_WINDOW, OnOpeningWindow) Hooks.lua contains: PHP Code: function OnOpeningWindow(Player, Window) I don't understand how to get a callback to track clicks or movements of objects in an open window. if I open a new window unrelated to the chest or furnace block, then I can receive a callback. It works, but the window is not attached to the chest block: PHP Code: local OnClicked = function(Window, ClickingPlayer, SlotNum, ClickAction, ClickedItem) Hhow to transfer an object to cLuaWindow and whether it is necessary? |