local config = {
uniqueatchest = 20003, -- Put this Unique At Chest with map editor.
lvl = 20, -- Level Player Need.
reward = 1111, -- id of item that player will got.
rewardcount = 1, -- count ...
itemfound = "You have a xXxX.", -- msg when player open the chest.
alreadygot = "You have already got it!", -- msg if player already completed that quest.
levelneedmsg = "You need level 20 to open this chest.", -- msg if player don't have level 20+ yet.
storage = 20003 -- stogare ID, change this for each quest.
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if item.uid == config.uniqueatchest then
local queststatus = getPlayerStorageValue(cid, config.storage)
if queststatus == -1 and getPlayerLevel(cid) >= config.lvl then
doPlayerAddItem(cid, config.reward, config.rewardcount)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, config.itemfound)
setPlayerStorageValue(cid, config.storage ,1)
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, config.alreadygot)
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, config.levelneedmsg)
end
end
return TRUE
end