morphsx
New Member
Hello guys, i'm trying to make a separate button to use the fishing rod, but i'm having some trouble... Here's my code:
This way, it simply does nothing.
If I change "g_game.useInventoryItemWith..." to "g_game.useInventoryItem(...", when i click the button i receive a "sendCancel" saying "Sorry, not possible"
I would like some help, as I made exactly the same code strucutre for opening backpack, and it worked... but for "UseWith" items, it doesn't work...
Thanks in advance!
Code:
local rodButton
function init()
rodButton = modules.client_topmenu.addRightGameToggleButton('rodButton', tr('Vara de Pesca') .. ' ', '/images/topbuttons/rod', use)
end
function use()
local player = g_game.getLocalPlayer()
g_game.useInventoryItemWith(player:getInventoryItem(2):getId())
end
This way, it simply does nothing.
If I change "g_game.useInventoryItemWith..." to "g_game.useInventoryItem(...", when i click the button i receive a "sendCancel" saying "Sorry, not possible"
I would like some help, as I made exactly the same code strucutre for opening backpack, and it worked... but for "UseWith" items, it doesn't work...
Thanks in advance!