local config = {
["demon"] = {storage = 5000, maxKills = 100, finishedValue = 101},
["example1"] = {storage = 5001, maxKills = 50, finishedValue = 51},
["example2"] = {storage = 5002, maxKills = 50, finishedValue = 51}
}
function onSay(cid, words, param)
param = param:lower()
if param == "" then
doPlayerSendTextMessage(cid, 22, "You must provide the quest you're wanting information about. !quest demon | !quest list")
return true
end
if param == "list" then
local text = ""
local storageValue
for v, k in pairs(config) do
storageValue = getPlayerStorageValue(cid, k.storage)
if storageValue ~= 1 and storageValue < k.finishedValue then
if text ~= "" then
text = text .. ", "
end
text = text .. v
end
end
if text ~= "" then
text = "Active Quests: " .. text .. "."
else
text = "You do not currently have any active quests."
end
doPlayerSendTextMessage(cid, 22, text)
return true
end
local index = config[param]
if not index then
doPlayerSendTextMessage(cid, 22, "Unknown quest (" .. param .. "). Find your active quests by using: !quest list")
return true
end
local storageValue = getPlayerStorageValue(cid, index.storage)
if storageValue == -1 or storageValue >= index.finishedValue then
doPlayerSendTextMessage(cid, 22, "The quest (" .. param .. ") is not an active quest. Find your active quests by using: !quest list")
return true
end
doPlayerSendTextMessage(cid, 22, "You have killed " .. storageValue .."/" .. index.maxKills .. " " .. param .. ".")
return true
end