local config = {
["Wizard Helmet Addon"] = {
storage = 21000,
outfit = {
sex = {
[] = 149, -- Sex
[1] = 145, -- Sex 1
},
addons = 1
},
items = {
[2536] = {count = 1, pos = {x = 182, y = 262, z = 9}}, -- [Item1] = {posição 1}
[2492] = {count = 1, pos = {x = 183, y = 262, z = 9}}, -- [Item2] = {posição 2}
[2488] = {count = 1, pos = {x = 185, y = 262, z = 9}}, -- [Item3] = {posição 3}
[2123] = {count = 1, pos = {x = 186, y = 262, z = 9}}, -- [Item4] = {posição 4}
}
-- Caso tenha a necessidade de usar mais itens é só ir adicionando mais à tabela
},
}
function onUse(cid, item, frompos, item2, topos, pos)
for i, v in pairs(config) do
local ok = true
for item_id, c in pairs(v.items) do
local item = getTileItemById(c.pos, item_id)
if item.uid < 100 or item.type < c.count then
ok = false
break
end
end
if ok then
if getPlayerStorageValue(cid, v.storage) > then
return doPlayerSendCancel(cid, "You already have this addon.")
end
for item_id, c in pairs(v.items) do
local item = getTileItemById(c.pos, item_id)
doRemoveItem(item.uid, c.count)
end
setPlayerStorageValue(cid, v.storage, 1)
doPlayerSendTextMessage(cid, 21, "You just earned the ".. i ..".")
doSendMagicEffect(getThingPos(cid), 28)
doPlayerAddOutfit(cid, v.outfit.sex[getPlayerSex(cid)], v.outfit.addons)
return true
end
end
return true
end