function onUse(cid, item, fromPosition, itemEx, toPosition)
local config = {
item1 = 55,
item1name = "Sword",
item2 = 55,
item2name = "club",
item3 = 55,
item3name = "axe",
questStorage = 55446
}
if item.actionid == 4100 then
if getPlayerStorageValue(cid, config.questStorage) == -1 then
doPlayerAddItem(cid, config.item1, 1)
doPlayerSendTextMessage(getPlayerPosition(cid), CONST_ME_MAGIC_BLUE)
doPlayerSendTextMessage(cid, 22, "You have found a "..config.item1name..".")
setPlayerStorageValue(cid, config.questStorage, 1)
else
doPlayerSendTextMessage(cid, 22, "The chest is empty.")
end
elseif item.actionid == 4200 then
if getPlayerStorageValue(cid, config.questStorage) == -1 then
doPlayerAddItem(cid, config.item2, 1)
doPlayerSendTextMessage(getPlayerPosition(cid), CONST_ME_MAGIC_BLUE)
doPlayerSendTextMessage(cid, 22, "You have found a "..config.item2name..".")
setPlayerStorageValue(cid, config.questStorage, 1)
else
doPlayerSendTextMessage(cid, 22, "The chest is empty.")
end
elseif item.actionid == 4300 then
if getPlayerStorageValue(cid, config.questStorage) == -1 then
doPlayerAddItem(cid, config.item3, 1)
doPlayerSendTextMessage(getPlayerPosition(cid), CONST_ME_MAGIC_BLUE)
doPlayerSendTextMessage(cid, 22, "You have found a "..config.item2name..".")
setPlayerStorageValue(cid, config.questStorage, 1)
else
doPlayerSendTextMessage(cid, 22, "The chest is empty.")
end
end
return TRUE
end