I use key on the bookcase and dont work..no have any error.
LUA:
local table = {
[15470] = {bookId=15429,chance=10,keyBreak=5},
[15470] = {bookId=15427,chance=20,keyBreak=10},
[15470] = {bookId=15428,chance=30,keyBreak=15}
}
function onUse(cid, item, fromPos, itemEx, toPos)
for k, v in pairs(table) do
if itemEx.itemid == k then
if(math.random(100) <= v.keyBreak) then
doRemoveItem(item.uid, 1)
end
if math.random(100) <= v.chance then
doPlayerAddItem(cid, v.bookId)
end
end
end
return true
end