-- this might be overkill but its easier to test if you have a table to control everything :p
local c = {
idToCheckFor = 10027,
itemToGive = 2485,
amount = 1,
minAccess = 0,
returnFalse = 0, -- this might need to be set to false
returnTrue = 1 -- this might need to be set to true
}
function onUse(cid, item, frompos, item2, topos)
if item.actionid == c.idToCheckFor then
queststatus = getPlayerStorageValue(cid, c.idToCheckFor)
if queststatus == -1 and getPlayerAccess(cid) == c.minAccess then
doPlayerSendTextMessage(cid, 22, "You have found a doublet.")
doPlayerAddItem(cid, itemToGive, c.amount)
setPlayerStorageValue(cid, idToCheckFor, c.amount)
else
doPlayerSendTextMessage(cid, 22, "The barrel is empty.")
end
else
return c.returnFalse
end
return c.returnTrue
end