• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

TFS 0.X talkaction to show the date you can do the quest again

zexus

Member
Joined
Oct 1, 2016
Messages
133
Reaction score
18
i have this amazing quest system, where players can do quests more then one time, i mean
you can do katana quest on rookgaard each 10 hours, it is working for every quest

quests.lua

Code:
local mins = 60
local hours = 60 * 60
local days = 24 * 60 * 60
local quests = {
    -- /data/creaturescripts/quests.lua
    -- rook
    [8000] = { name = "Sabre Rook", item = 2385, lvl = 1, time = 15 * mins},
    [8001] = { name = "Doublet Rook", item = 2485, lvl = 2, time = 30 * mins},
    [8002] = { name = "Studded Shield Rook", item = 2526, lvl = 3, time = 50 * mins},
    [8003] = { name = "Copper Shield Rook", item = 2530, lvl = 5, time = 3 * hours},
    [8004] = { name = "Legion Helmet Rook", item = 2480, lvl = 5, time = 5 * hours},
    [8005] = { name = "Katana Rook", item = 2412, lvl = 5, time = 10 * hours},
}
function isLevelRequired(value)
    return type(value) == "table" and true, value.item, value.lvl or false, value
end
function onUse(cid, item, fromPos, item2, toPos)
    local levelRequired, quest, level = isLevelRequired(quests[item.actionid])
    if levelRequired then
        if getPlayerLevel(cid) < level then
            doPlayerSendCancel(cid, "Sorry, level: " .. level .. " or higher to complete this quest.")
            doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
            return true
        end
    end
    if quest then
        local storage = 200000 + item.actionid
        local quest = quests[item.actionid]
        if quest then
            local timeNow = os.time()
            if timeNow - getPlayerStorageValue(cid, item.actionid) >= 0 then
                if getPlayerFreeCap(cid) >= getItemWeightById(quest.item, 1) then
                    doPlayerAddItem(cid, quest.item, 1)
                    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You have found a '..getItemNameById(quest.item)..'.')
                    setPlayerStorageValue(cid, item.actionid, timeNow + quest.time)
                else
                    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You have found a '..getItemNameById(quest.item)..'. It weighs '..getItemWeightById(quest.item, 1)..'.00 and it is too heavy.')         
                end
            elseif getPlayerStorageValue(cid, item.actionid) < 0 then
                doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'It is empty.')
            elseif getPlayerStorageValue(cid, item.actionid)-timeNow > days then
                doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'It is empty, you must wait '.. math.ceil(((getPlayerStorageValue(cid, item.actionid)) - timeNow)/days) ..' days to do it again.')
            elseif getPlayerStorageValue(cid, item.actionid)-timeNow > hours then
                doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'It is empty, you must wait '.. math.ceil(((getPlayerStorageValue(cid, item.actionid)) - timeNow)/hours) ..' hours to do it again.')
            else
                doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'It is empty, you must wait '.. math.ceil(((getPlayerStorageValue(cid, item.actionid)) - timeNow)/mins) ..' minutes to do it again.')
            end
        end
    end
    return true
end


I tried this, but its not working
/talkactions/scripts/quests.lua
Code:
dofile(getDataDir() .. "actions/scripts/actions.lua")

function onSay(cid, words, param, channel)
    local finalStr = ""
    for q=8000,8200,+1 do
        if quest then
            if getPlayerStorageValue(cid, item.actionid) < 0 then
                local timeToWait
                elseif getPlayerStorageValue(cid, item.actionid)-timeNow > days then
                    timeToWait = 'is in exausted, wait '.. math.ceil(((getPlayerStorageValue(cid, item.actionid)) - timeNow)/days) ..' days to do it again.')
                elseif getPlayerStorageValue(cid, item.actionid)-timeNow > hours then
                    timeToWait = 'is in exausted, wait '.. math.ceil(((getPlayerStorageValue(cid, item.actionid)) - timeNow)/hours) ..' hours to do it again.')
                else
                    timeToWait = 'is in exausted, wait '.. math.ceil(((getPlayerStorageValue(cid, item.actionid)) - timeNow)/mins) ..' minutes to do it again.')
                end
                finalStr = finalStr .. "[" .. quest.name .. "]: " .. timeToWait .. + "\n"
            end
        end
    end
    doShowTextDialog(cid, 2175, finalStr)
    return true
end

Is anyone could help me to make it work?
 
Lucky timing :) I just finished work ( I'm on CET)

You need a "print zexus_quest_list" directly after this:

zexus_quest_list = {
-- rook
[8000] = { name = "Sabre Rook", item = 2385, lvl = 1, time = 15 * mins},
[8001] = { name = "Doublet Rook", item = 2485, lvl = 2, time = 30 * mins},
[8002] = { name = "Studded Shield Rook", item = 2526, lvl = 3, time = 50 * mins},
[8003] = { name = "Copper Shield Rook", item = 2530, lvl = 5, time = 3 * hours},
[8004] = { name = "Legion Helmet Rook", item = 2480, lvl = 5, time = 5 * hours},
[8005] = { name = "Katana Rook", item = 2412, lvl = 5, time = 10 * hours},
}

Print zexus_two there as well.

I know it sounds unlikely that zexus_quest_list isn't being set, but something weird is going on, so we have to check all possibilities.

BTW - I checked the docs - as far as I can see, the "," in the second-last position of th table is ok, but tit's the only thing that looks like it might be out of place. Try removing that, and also "--rook" from the start.
 
Thinking Think GIF by Rodney Dangerfield


On a serious note though..
Lua:
print(zexus_quest_list)
The above print is useless. lol

Use this instead.
Lua:
for v, k in pairs(zexus_quest_list) do
    print(v, k.name, k.item, k.lvl, k.time)
end
Untitled.png
 
Lucky timing :) I just finished work ( I'm on CET)

You need a "print zexus_quest_list" directly after this:

zexus_quest_list = {
-- rook
[8000] = { name = "Sabre Rook", item = 2385, lvl = 1, time = 15 * mins},
[8001] = { name = "Doublet Rook", item = 2485, lvl = 2, time = 30 * mins},
[8002] = { name = "Studded Shield Rook", item = 2526, lvl = 3, time = 50 * mins},
[8003] = { name = "Copper Shield Rook", item = 2530, lvl = 5, time = 3 * hours},
[8004] = { name = "Legion Helmet Rook", item = 2480, lvl = 5, time = 5 * hours},
[8005] = { name = "Katana Rook", item = 2412, lvl = 5, time = 10 * hours},
}

Print zexus_two there as well.

I know it sounds unlikely that zexus_quest_list isn't being set, but something weird is going on, so we have to check all possibilities.

BTW - I checked the docs - as far as I can see, the "," in the second-last position of th table is ok, but tit's the only thing that looks like it might be out of place. Try removing that, and also "--rook" from the start.

What are u mean?
Print on action?
Even removing the last ,
It still print empty


Thinking Think GIF by Rodney Dangerfield


On a serious note though..
Lua:
print(zexus_quest_list)
The above print is useless. lol

Use this instead.
Lua:
for v, k in pairs(zexus_quest_list) do
    print(v, k.name, k.item, k.lvl, k.time)
end
View attachment 54432

With this one it is priting everything wtf
Why the script is not working?
 
Based on reading a Lua page on the web, I expected that print(tablename) would print something like "Table:9B8A7F6E" (i.e. a string version of the table's address in Lua's internal storage).

This, if it worked, would be a compact way to see if the table (which, as I see it, is your single most important data structure) existed at that point in the code.

As to why the script isn't working - I don't think we're a good combination for solving that.
GL!
 
With this one it is priting everything wtf
Why the script is not working?
Not sure.

But, try this.
Lua:
dofile(getDataDir() .. "actions/scripts/quests.lua")

function onSay(cid, words, param, channel)
    print("----------")
    print(mins, hours, days)
    local time = os.time()
    local final = ''
    for q in pairs(zexus_quest_list) do -- We are looping from 8000 to 8005, so those are the storages that we will check.
        print(q)
        print(q.name)
        local storage = zexus_quest_list[q] -- In this local we get the information, for example if q is equal to 8000 and you print storage.name you will get "Sabre Rook".
        local str = ''
        if getPlayerStorageValue(cid, q) < 0 then
            str = 'You have never done '..storage.name..' quest! Time to get to it.'
        elseif time - getPlayerStorageValue(cid, q) >= 0 then
            str = 'You can now do '..storage.name..' quest again!'
    
    
        elseif getPlayerStorageValue(cid, q) - time > days then
            str = 'You must wait '.. math.ceil(((getPlayerStorageValue(cid, q)) - time) / days) ..' days to do the '..storage.name..' quest again.'
        elseif getPlayerStorageValue(cid, q) - time > hours then
            str = 'You must wait '.. math.ceil(((getPlayerStorageValue(cid, q)) - time) / hours) ..' hours to do the '..storage.name..' quest again.'
        else
            str = 'You must wait '.. math.ceil(((getPlayerStorageValue(cid, q)) - time) / mins) ..' minutes to do the '..storage.name..' quest again.'
        end
        final = final .. "[" .. storage.name .. "]: " .. str .. "\n\n"
    end
    doShowTextDialog(cid, 2175, final)
    return true
end
Lua:
local mins = 60
local hours = 60 * 60
local days = 24 * 60 * 60

local zexus_quest_list = {
    -- rook
    [8000] = { name = "Sabre Rook", item = 2385, lvl = 1, time = 15 * mins},
    [8001] = { name = "Doublet Rook", item = 2485, lvl = 2, time = 30 * mins},
    [8002] = { name = "Studded Shield Rook", item = 2526, lvl = 3, time = 50 * mins},
    [8003] = { name = "Copper Shield Rook", item = 2530, lvl = 5, time = 3 * hours},
    [8004] = { name = "Legion Helmet Rookx", item = 2480, lvl = 5, time = 5 * hours},
    [8005] = { name = "Katana Rook", item = 2412, lvl = 5, time = 10 * hours},
}
function isLevelRequired(value)
    return type(value) == "table" and true, value.item, value.lvl or false, value
end
function onUse(cid, item, fromPos, item2, toPos)
    local levelRequired, quest, level = isLevelRequired(zexus_quest_list[item.actionid])
    if levelRequired then
        if getPlayerLevel(cid) < level then
            doPlayerSendCancel(cid, "Sorry, level: " .. level .. " or higher to complete this quest.")
            doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
            return true
        end
    end
    if quest then
        local storage = 200000 + item.actionid
        local quest = zexus_quest_list[item.actionid]
        if quest then
            local timeNow = os.time()
            if timeNow - getPlayerStorageValue(cid, item.actionid) >= 0 then
                if getPlayerFreeCap(cid) >= getItemWeightById(quest.item, 1) then
                    doPlayerAddItem(cid, quest.item, 1)
                    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You have found a '..getItemNameById(quest.item)..'.')
                    setPlayerStorageValue(cid, item.actionid, timeNow + quest.time)
                else
                    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You have found a '..getItemNameById(quest.item)..'. It weighs '..getItemWeightById(quest.item, 1)..'.00 and it is too heavy.')          
                end
            elseif getPlayerStorageValue(cid, item.actionid) < 0 then
                doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'It is empty.')
            elseif getPlayerStorageValue(cid, item.actionid)-timeNow > days then
                doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'It is empty, you must wait '.. math.ceil(((getPlayerStorageValue(cid, item.actionid)) - timeNow)/days) ..' days to do it again.')
            elseif getPlayerStorageValue(cid, item.actionid)-timeNow > hours then
                doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'It is empty, you must wait '.. math.ceil(((getPlayerStorageValue(cid, item.actionid)) - timeNow)/hours) ..' hours to do it again.')
            else
                doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'It is empty, you must wait '.. math.ceil(((getPlayerStorageValue(cid, item.actionid)) - timeNow)/mins) ..' minutes to do it again.')
            end
        end
    end
    return true
end
 
Not sure.

But, try this.
Lua:
dofile(getDataDir() .. "actions/scripts/quests.lua")

function onSay(cid, words, param, channel)
    print("----------")
    print(mins, hours, days)
    local time = os.time()
    local final = ''
    for q in pairs(zexus_quest_list) do -- We are looping from 8000 to 8005, so those are the storages that we will check.
        print(q)
        print(q.name)
        local storage = zexus_quest_list[q] -- In this local we get the information, for example if q is equal to 8000 and you print storage.name you will get "Sabre Rook".
        local str = ''
        if getPlayerStorageValue(cid, q) < 0 then
            str = 'You have never done '..storage.name..' quest! Time to get to it.'
        elseif time - getPlayerStorageValue(cid, q) >= 0 then
            str = 'You can now do '..storage.name..' quest again!'
   
   
        elseif getPlayerStorageValue(cid, q) - time > days then
            str = 'You must wait '.. math.ceil(((getPlayerStorageValue(cid, q)) - time) / days) ..' days to do the '..storage.name..' quest again.'
        elseif getPlayerStorageValue(cid, q) - time > hours then
            str = 'You must wait '.. math.ceil(((getPlayerStorageValue(cid, q)) - time) / hours) ..' hours to do the '..storage.name..' quest again.'
        else
            str = 'You must wait '.. math.ceil(((getPlayerStorageValue(cid, q)) - time) / mins) ..' minutes to do the '..storage.name..' quest again.'
        end
        final = final .. "[" .. storage.name .. "]: " .. str .. "\n\n"
    end
    doShowTextDialog(cid, 2175, final)
    return true
end
Lua:
local mins = 60
local hours = 60 * 60
local days = 24 * 60 * 60

local zexus_quest_list = {
    -- rook
    [8000] = { name = "Sabre Rook", item = 2385, lvl = 1, time = 15 * mins},
    [8001] = { name = "Doublet Rook", item = 2485, lvl = 2, time = 30 * mins},
    [8002] = { name = "Studded Shield Rook", item = 2526, lvl = 3, time = 50 * mins},
    [8003] = { name = "Copper Shield Rook", item = 2530, lvl = 5, time = 3 * hours},
    [8004] = { name = "Legion Helmet Rookx", item = 2480, lvl = 5, time = 5 * hours},
    [8005] = { name = "Katana Rook", item = 2412, lvl = 5, time = 10 * hours},
}
function isLevelRequired(value)
    return type(value) == "table" and true, value.item, value.lvl or false, value
end
function onUse(cid, item, fromPos, item2, toPos)
    local levelRequired, quest, level = isLevelRequired(zexus_quest_list[item.actionid])
    if levelRequired then
        if getPlayerLevel(cid) < level then
            doPlayerSendCancel(cid, "Sorry, level: " .. level .. " or higher to complete this quest.")
            doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
            return true
        end
    end
    if quest then
        local storage = 200000 + item.actionid
        local quest = zexus_quest_list[item.actionid]
        if quest then
            local timeNow = os.time()
            if timeNow - getPlayerStorageValue(cid, item.actionid) >= 0 then
                if getPlayerFreeCap(cid) >= getItemWeightById(quest.item, 1) then
                    doPlayerAddItem(cid, quest.item, 1)
                    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You have found a '..getItemNameById(quest.item)..'.')
                    setPlayerStorageValue(cid, item.actionid, timeNow + quest.time)
                else
                    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You have found a '..getItemNameById(quest.item)..'. It weighs '..getItemWeightById(quest.item, 1)..'.00 and it is too heavy.')         
                end
            elseif getPlayerStorageValue(cid, item.actionid) < 0 then
                doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'It is empty.')
            elseif getPlayerStorageValue(cid, item.actionid)-timeNow > days then
                doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'It is empty, you must wait '.. math.ceil(((getPlayerStorageValue(cid, item.actionid)) - timeNow)/days) ..' days to do it again.')
            elseif getPlayerStorageValue(cid, item.actionid)-timeNow > hours then
                doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'It is empty, you must wait '.. math.ceil(((getPlayerStorageValue(cid, item.actionid)) - timeNow)/hours) ..' hours to do it again.')
            else
                doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'It is empty, you must wait '.. math.ceil(((getPlayerStorageValue(cid, item.actionid)) - timeNow)/mins) ..' minutes to do it again.')
            end
        end
    end
    return true
end

It shouldn't be zexus_quest_list = { instead of local zexus_quest_list = {?

I tried:
Code:
dofile(getDataDir() .. "actions/scripts/quests.lua")

function onSay(cid, words, param, channel)
    local mins = 60
    local hours = 60 * 60
    local days = 24 * 60 * 60
    print("----------")
    print(mins, hours, days)
    local time = os.time()
    local final = ''
    for q in pairs(zexus_quest_list) do -- We are looping from 8000 to 8005, so those are the storages that we will check.
        print(q)
        print(q.name)
        local storage = zexus_quest_list[q] -- In this local we get the information, for example if q is equal to 8000 and you print storage.name you will get "Sabre Rook".
        local str = ''
        if getPlayerStorageValue(cid, q) < 0 then
            str = 'You have never done '..storage.name..' quest! Time to get to it.'
        elseif time - getPlayerStorageValue(cid, q) >= 0 then
            str = 'You can now do '..storage.name..' quest again!'
    
    
        elseif getPlayerStorageValue(cid, q) - time > days then
            str = 'You must wait '.. math.ceil(((getPlayerStorageValue(cid, q)) - time) / days) ..' days to do the '..storage.name..' quest again.'
        elseif getPlayerStorageValue(cid, q) - time > hours then
            str = 'You must wait '.. math.ceil(((getPlayerStorageValue(cid, q)) - time) / hours) ..' hours to do the '..storage.name..' quest again.'
        else
            str = 'You must wait '.. math.ceil(((getPlayerStorageValue(cid, q)) - time) / mins) ..' minutes to do the '..storage.name..' quest again.'
        end
        final = final .. "[" .. storage.name .. "]: " .. str .. "\n\n"
    end
    doShowTextDialog(cid, 2175, final)
    return true
end

Code:
local mins = 60
local hours = 60 * 60
local days = 24 * 60 * 60

zexus_quest_list = {
    -- rook
    [8000] = { name = "Sabre Rook", item = 2385, lvl = 1, time = 15 * mins},
    [8001] = { name = "Doublet Rook", item = 2485, lvl = 2, time = 30 * mins},
    [8002] = { name = "Studded Shield Rook", item = 2526, lvl = 3, time = 50 * mins},
    [8003] = { name = "Copper Shield Rook", item = 2530, lvl = 5, time = 3 * hours},
    [8004] = { name = "Legion Helmet Rookx", item = 2480, lvl = 5, time = 5 * hours},
    [8005] = { name = "Katana Rook", item = 2412, lvl = 5, time = 10 * hours},
}
function isLevelRequired(value)
    return type(value) == "table" and true, value.item, value.lvl or false, value
end
function onUse(cid, item, fromPos, item2, toPos)
    local levelRequired, quest, level = isLevelRequired(zexus_quest_list[item.actionid])
    if levelRequired then
        if getPlayerLevel(cid) < level then
            doPlayerSendCancel(cid, "Sorry, level: " .. level .. " or higher to complete this quest.")
            doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
            return true
        end
    end
    if quest then
        local storage = 200000 + item.actionid
        local quest = zexus_quest_list[item.actionid]
        if quest then
            local timeNow = os.time()
            if timeNow - getPlayerStorageValue(cid, item.actionid) >= 0 then
                if getPlayerFreeCap(cid) >= getItemWeightById(quest.item, 1) then
                    doPlayerAddItem(cid, quest.item, 1)
                    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You have found a '..getItemNameById(quest.item)..'.')
                    setPlayerStorageValue(cid, item.actionid, timeNow + quest.time)
                else
                    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You have found a '..getItemNameById(quest.item)..'. It weighs '..getItemWeightById(quest.item, 1)..'.00 and it is too heavy.')          
                end
            elseif getPlayerStorageValue(cid, item.actionid) < 0 then
                doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'It is empty.')
            elseif getPlayerStorageValue(cid, item.actionid)-timeNow > days then
                doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'It is empty, you must wait '.. math.ceil(((getPlayerStorageValue(cid, item.actionid)) - timeNow)/days) ..' days to do it again.')
            elseif getPlayerStorageValue(cid, item.actionid)-timeNow > hours then
                doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'It is empty, you must wait '.. math.ceil(((getPlayerStorageValue(cid, item.actionid)) - timeNow)/hours) ..' hours to do it again.')
            else
                doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'It is empty, you must wait '.. math.ceil(((getPlayerStorageValue(cid, item.actionid)) - timeNow)/mins) ..' minutes to do it again.')
            end
        end
    end
    return true
end

but shows this errors:
Code:
[18:45:16.719] [Error - TalkAction Interface] 
[18:45:16.719] data/talkactions/scripts/quests.lua:onSay
[18:45:16.719] Description: 
[18:45:16.719] data/talkactions/scripts/quests.lua:13: attempt to index local 'q' (a number value)
[18:45:16.719] stack traceback:
[18:45:16.719]     data/talkactions/scripts/quests.lua:13: in function <data/talkactions/scripts/quests.lua:3>
 
FYI: the error is essentially just a typo.

Line 4 of the error message is telling you that the context (q.name) implies variable "q" can be indexed (like a table), but that it's a number, which can't be indexed.
The actual code that pops is at line 13 of the first script: "print(q.name)".
 
Last edited:
how to use goto or continue on LUA?

Code:
dofile(getDataDir() .. "actions/scripts/quests.lua")

function onSay(cid, words, param, channel)
    local mins = 60
    local hours = 60 * 60
    local days = 24 * 60 * 60
    print("----------")
    print(mins, hours, days)
    local time = os.time()
    local final = ''
    -- We are looping from 8000 to 8005, so those are the storages that we will check.
    for q, quest in pairs(zexus_quest_list) do
        print(q)
        local storage = quest -- In this local we get the information, for example if q is equal to 8000 and you print storage.name you will get "Sabre Rook".
        local str = ''



        -- don't show everything, only exausted one, cause there are a lot of quests
        if getPlayerStorageValue(cid, q) < 0 then
            -- str = 'You have never done '..storage.name..' quest! Time to get to it.'
            goto continue
        elseif time - getPlayerStorageValue(cid, q) >= 0 then
            -- str = 'You can now do '..storage.name..' quest again!'
            goto continue



        if getPlayerStorageValue(cid, q) - time > days then
            str = 'You must wait '.. math.ceil(((getPlayerStorageValue(cid, q)) - time) / days) ..' days to do the '..storage.name..' quest again.'
        elseif getPlayerStorageValue(cid, q) - time > hours then
            str = 'You must wait '.. math.ceil(((getPlayerStorageValue(cid, q)) - time) / hours) ..' hours to do the '..storage.name..' quest again.'
        else
            str = 'You must wait '.. math.ceil(((getPlayerStorageValue(cid, q)) - time) / mins) ..' minutes to do the '..storage.name..' quest again.'
        end
        final = final .. "[" .. storage.name .. "]: " .. str .. "\n\n"

        ::continue::
    end
    doShowTextDialog(cid, 2175, final)
    return true
end

Code:
[14:19:31.152] [Error - LuaInterface::loadFile] data/talkactions/scripts/quests.lua:22: '=' expected near 'continue'
[14:19:31.152] [Warning - Event::loadScript] Cannot load script (data/talkactions/scripts/quests.lua)
[14:19:31.152] data/talkactions/scripts/quests.lua:22: '=' expected near 'continue'
 
you dont need continue there, you can just use the function doShowTextDialog(cid, 2175, final) and do a break. all after the "final" string.
example:

final = final .. "[" .. storage.name .. "]: " .. str .. "\n\n"
doShowTextDialog(cid, 2175, final)
break


@edit i didnt see your trying to print multiple quests, in this case the break shouldnt be there and the fnc outside of the loop.
add me to discod because seems like you want to add more stuff to it and im happy to help
 
Last edited:
how to use goto or continue on LUA?

Code:
dofile(getDataDir() .. "actions/scripts/quests.lua")

function onSay(cid, words, param, channel)
    local mins = 60
    local hours = 60 * 60
    local days = 24 * 60 * 60
    print("----------")
    print(mins, hours, days)
    local time = os.time()
    local final = ''
    -- We are looping from 8000 to 8005, so those are the storages that we will check.
    for q, quest in pairs(zexus_quest_list) do
        print(q)
        local storage = quest -- In this local we get the information, for example if q is equal to 8000 and you print storage.name you will get "Sabre Rook".
        local str = ''



        -- don't show everything, only exausted one, cause there are a lot of quests
        if getPlayerStorageValue(cid, q) < 0 then
            -- str = 'You have never done '..storage.name..' quest! Time to get to it.'
            goto continue
        elseif time - getPlayerStorageValue(cid, q) >= 0 then
            -- str = 'You can now do '..storage.name..' quest again!'
            goto continue



        if getPlayerStorageValue(cid, q) - time > days then
            str = 'You must wait '.. math.ceil(((getPlayerStorageValue(cid, q)) - time) / days) ..' days to do the '..storage.name..' quest again.'
        elseif getPlayerStorageValue(cid, q) - time > hours then
            str = 'You must wait '.. math.ceil(((getPlayerStorageValue(cid, q)) - time) / hours) ..' hours to do the '..storage.name..' quest again.'
        else
            str = 'You must wait '.. math.ceil(((getPlayerStorageValue(cid, q)) - time) / mins) ..' minutes to do the '..storage.name..' quest again.'
        end
        final = final .. "[" .. storage.name .. "]: " .. str .. "\n\n"

        ::continue::
    end
    doShowTextDialog(cid, 2175, final)
    return true
end

Code:
[14:19:31.152] [Error - LuaInterface::loadFile] data/talkactions/scripts/quests.lua:22: '=' expected near 'continue'
[14:19:31.152] [Warning - Event::loadScript] Cannot load script (data/talkactions/scripts/quests.lua)
[14:19:31.152] data/talkactions/scripts/quests.lua:22: '=' expected near 'continue'

bump
 
how to use goto or continue on LUA?

Code:
dofile(getDataDir() .. "actions/scripts/quests.lua")

function onSay(cid, words, param, channel)
    local mins = 60
    local hours = 60 * 60
    local days = 24 * 60 * 60
    print("----------")
    print(mins, hours, days)
    local time = os.time()
    local final = ''
    -- We are looping from 8000 to 8005, so those are the storages that we will check.
    for q, quest in pairs(zexus_quest_list) do
        print(q)
        local storage = quest -- In this local we get the information, for example if q is equal to 8000 and you print storage.name you will get "Sabre Rook".
        local str = ''



        -- don't show everything, only exausted one, cause there are a lot of quests
        if getPlayerStorageValue(cid, q) < 0 then
            -- str = 'You have never done '..storage.name..' quest! Time to get to it.'
            goto continue
        elseif time - getPlayerStorageValue(cid, q) >= 0 then
            -- str = 'You can now do '..storage.name..' quest again!'
            goto continue



        if getPlayerStorageValue(cid, q) - time > days then
            str = 'You must wait '.. math.ceil(((getPlayerStorageValue(cid, q)) - time) / days) ..' days to do the '..storage.name..' quest again.'
        elseif getPlayerStorageValue(cid, q) - time > hours then
            str = 'You must wait '.. math.ceil(((getPlayerStorageValue(cid, q)) - time) / hours) ..' hours to do the '..storage.name..' quest again.'
        else
            str = 'You must wait '.. math.ceil(((getPlayerStorageValue(cid, q)) - time) / mins) ..' minutes to do the '..storage.name..' quest again.'
        end
        final = final .. "[" .. storage.name .. "]: " .. str .. "\n\n"

        ::continue::
    end
    doShowTextDialog(cid, 2175, final)
    return true
end

Code:
[14:19:31.152] [Error - LuaInterface::loadFile] data/talkactions/scripts/quests.lua:22: '=' expected near 'continue'
[14:19:31.152] [Warning - Event::loadScript] Cannot load script (data/talkactions/scripts/quests.lua)
[14:19:31.152] data/talkactions/scripts/quests.lua:22: '=' expected near 'continue'

bump
 
i've forgot a end on line 26
but the problem still there:

Code:
[16:26:17.343] [Error - LuaInterface::loadFile] data/talkactions/scripts/quests.lua:22: '=' expected near 'continue'
[16:26:17.343] [Warning - Event::loadScript] Cannot load script (data/talkactions/scripts/quests.lua)
[16:26:17.343] data/talkactions/scripts/quests.lua:22: '=' expected near 'continue'

Code:
dofile(getDataDir() .. "actions/scripts/quests.lua")

function onSay(cid, words, param, channel)
    local mins = 60
    local hours = 60 * 60
    local days = 24 * 60 * 60
    print("----------")
    print(mins, hours, days)
    local time = os.time()
    local final = ''
    -- We are looping from 8000 to 8005, so those are the storages that we will check.
    for q, quest in pairs(zexus_quest_list) do
        print(q)
        local storage = quest -- In this local we get the information, for example if q is equal to 8000 and you print storage.name you will get "Sabre Rook".
        local str = ''



        -- don't show everything, only exausted one, cause there are a lot of quests
        if getPlayerStorageValue(cid, q) < 0 then
            -- str = 'You have never done '..storage.name..' quest! Time to get to it.'
            goto continue
        elseif time - getPlayerStorageValue(cid, q) >= 0 then
            -- str = 'You can now do '..storage.name..' quest again!'
            goto continue
        end


        if getPlayerStorageValue(cid, q) - time > days then
            str = 'You must wait '.. math.ceil(((getPlayerStorageValue(cid, q)) - time) / days) ..' days to do the '..storage.name..' quest again.'
        elseif getPlayerStorageValue(cid, q) - time > hours then
            str = 'You must wait '.. math.ceil(((getPlayerStorageValue(cid, q)) - time) / hours) ..' hours to do the '..storage.name..' quest again.'
        else
            str = 'You must wait '.. math.ceil(((getPlayerStorageValue(cid, q)) - time) / mins) ..' minutes to do the '..storage.name..' quest again.'
        end
        final = final .. "[" .. storage.name .. "]: " .. str .. "\n\n"

        ::continue::
    end
    doShowTextDialog(cid, 2175, final)
    return true
end
 
looks like goto was added on LUA 5.2

i was using 5.1

i tried to sudo apt-get install lua5.2


and change my Makefile editing every lua5.1 to lua5.2:

Code:
SRC = actions.cpp admin.cpp allocator.cpp baseevents.cpp beds.cpp chat.cpp\
      combat.cpp condition.cpp configmanager.cpp connection.cpp container.cpp\
      creature.cpp creatureevent.cpp cylinder.cpp database.cpp\
      databasemanager.cpp databasemysql.cpp databasesqlite.cpp depot.cpp\
      dispatcher.cpp exception.cpp fileloader.cpp game.cpp gameservers.cpp\
      globalevent.cpp group.cpp house.cpp housetile.cpp ioban.cpp ioguild.cpp\
      iologindata.cpp iomap.cpp iomapserialize.cpp itemattributes.cpp item.cpp\
      items.cpp luascript.cpp mailbox.cpp manager.cpp map.cpp monster.cpp\
      monsters.cpp movement.cpp networkmessage.cpp npc.cpp otserv.cpp\
      outfit.cpp outputmessage.cpp party.cpp player.cpp position.cpp\
      protocol.cpp protocolgame.cpp protocolhttp.cpp protocollogin.cpp\
      protocolold.cpp quests.cpp raids.cpp rsa.cpp scheduler.cpp\
      scriptmanager.cpp server.cpp spawn.cpp spells.cpp status.cpp\
      talkaction.cpp teleport.cpp textlogger.cpp thing.cpp tile.cpp tools.cpp\
      trashholder.cpp vocation.cpp waitlist.cpp weapons.cpp

OBJ = ${SRC:.cpp=.o}

CC = g++
INCS = -I/usr/include/libxml2 -I/usr/include/lua5.2 -I.
CPPFLAGS = -DHAVE_CONFIG_H -D__USE_MYSQL__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__ROOT_PERMISSION__ -D_THREAD_SAFE -D_REENTRANT
CXXFLAGS = -std=c++03 -Os -fomit-frame-pointer -Wall -Wextra -Wno-strict-aliasing -Wno-unused-parameter -Wno-array-bounds -pipe ${INCS} ${CPPFLAGS}
LDFLAGS = -s -llua5.2 -lmariadbclient -lcrypto -lboost_filesystem -lboost_date_time -lboost_system -lboost_regex -lboost_thread -lz -lgmp -lxml2 -pthread
all: options tfs

options:
    @echo tfs build options:
    @echo "CXXFLAGS = ${CXXFLAGS}"
    @echo "LDFLAGS  = ${LDFLAGS}"
    @echo "CC       = ${CC}"

.cpp.o:
    @echo '${CC} $<'
    @${CC} -c ${CXXFLAGS} $<

tfs: ${OBJ}
    @echo CC -o $@
    @${CC} -o $@ ${OBJ} ${LDFLAGS}

clean:
    @echo cleaning
    @rm -f tfs ${OBJ}

.PHONY: all clean options

but when i try to compile the project show this errors on console:

make -j`nproc`
Code:
CC -o tfs
tfs build options:
CXXFLAGS = -std=c++03 -Os -fomit-frame-pointer -Wall -Wextra -Wno-strict-aliasing -Wno-unused-parameter -Wno-array-bounds -pipe -I/usr/include/libxml2 -I/usr/include/lua5.2 -I.   -DHAVE_CONFIG_H -D__USE_MYSQL__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__ROOT_PERMISSION__ -D_THREAD_SAFE -D_REENTRANT
LDFLAGS  = -s -llua5.2 -lmariadbclient -lcrypto -lboost_filesystem -lboost_date_time -lboost_system -lboost_regex -lboost_thread -lz -lgmp -lxml2 -pthread
CC       = g++
combat.o: In function `ValueCallback::getMinMaxValues(Player*, int&, int&, bool) const':
combat.cpp:(.text+0xcc4): undefined reference to `lua_pcall'
combat.o: In function `TargetCallback::onTargetCombat(Creature*, Creature*) const':
combat.cpp:(.text+0x1560): undefined reference to `lua_pcall'
configmanager.o: In function `ConfigManager::load()':
configmanager.cpp:(.text+0x258): undefined reference to `luaL_loadfile'
configmanager.cpp:(.text+0x26c): undefined reference to `lua_pcall'
luascript.o: In function `LuaInterface::registerFunctions()':
luascript.cpp:(.text+0x37e0): undefined reference to `luaL_register'
luascript.cpp:(.text+0x37f7): undefined reference to `luaL_register'
luascript.cpp:(.text+0x380e): undefined reference to `luaL_register'
luascript.cpp:(.text+0x3825): undefined reference to `luaL_register'
luascript.o: In function `LuaInterface::handleFunction(lua_State*)':
luascript.cpp:(.text+0x39a3): undefined reference to `lua_call'
luascript.o: In function `LuaInterface::popNumber(lua_State*)':
luascript.cpp:(.text+0x4d43): undefined reference to `lua_tonumber'
luascript.o: In function `LuaInterface::callFunction(unsigned int)':
luascript.cpp:(.text+0x74b6): undefined reference to `lua_pcall'
luascript.o: In function `LuaInterface::getField(lua_State*, char const*)':
luascript.cpp:(.text+0x9db5): undefined reference to `lua_tonumber'
luascript.o: In function `LuaInterface::getFieldUnsigned(lua_State*, char const*)':
luascript.cpp:(.text+0xa6ad): undefined reference to `lua_tonumber'
luascript.o: In function `LuaInterface::getGlobalString(lua_State*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
luascript.cpp:(.text+0xaa26): undefined reference to `lua_objlen'
luascript.o: In function `LuaInterface::getGlobalDouble(lua_State*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, double)':
luascript.cpp:(.text+0xaba5): undefined reference to `lua_tonumber'
luascript.o: In function `LuaInterface::moveValue(lua_State*, lua_State*)':
luascript.cpp:(.text+0xac3b): undefined reference to `lua_tonumber'
luascript.o: In function `LuaInterface::getArea(lua_State*, std::__cxx11::list<unsigned int, std::allocator<unsigned int> >&, unsigned int&)':
luascript.cpp:(.text+0xadaf): undefined reference to `lua_tonumber'
luascript.o: In function `LuaInterface::luaL_domodlib(lua_State*)':
luascript.cpp:(.text+0xaf8d): undefined reference to `lua_pcall'
luascript.o: In function `LuaInterface::loadBuffer(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Npc*)':
luascript.cpp:(.text+0xc850): undefined reference to `luaL_loadbuffer'
luascript.cpp:(.text+0xc8d3): undefined reference to `lua_pcall'
luascript.o: In function `LuaInterface::loadFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Npc*)':
luascript.cpp:(.text+0xc947): undefined reference to `luaL_loadfile'
luascript.cpp:(.text+0xc9e6): undefined reference to `lua_pcall'
luascript.o: In function `LuaInterface::registerFunctions()':
luascript.cpp:(.text+0x383d): undefined reference to `luaL_register'
luascript.o: In function `LuaInterface::popFloatNumber(lua_State*)':
luascript.cpp:(.text+0x5ac5): undefined reference to `lua_tonumber'
collect2: error: ld returned 1 exit status
Makefile:37: recipe for target 'tfs' failed
make: *** [tfs] Error 1
 
Why are you even using goto? this leads to spaghetti code and should not be used when you dont need.
My recomendation is to make that:

Lua:
dofile(getDataDir() .. "actions/scripts/quests.lua")

function onSay(cid, words, param, channel)
    local mins = 60
    local hours = 60 * 60
    local days = 24 * 60 * 60
    print("----------")
    print(mins, hours, days)
    local time = os.time()
    local final = ''
    -- We are looping from 8000 to 8005, so those are the storages that we will check.
    for q, quest in pairs(zexus_quest_list) do
        print(q)
        local storage = quest -- In this local we get the information, for example if q is equal to 8000 and you print storage.name you will get "Sabre Rook".
        local str = ''


        local continue = false
        -- don't show everything, only exausted one, cause there are a lot of quests
        if getPlayerStorageValue(cid, q) < 0 then
            -- str = 'You have never done '..storage.name..' quest! Time to get to it.'
            continue = true
        elseif time - getPlayerStorageValue(cid, q) >= 0 then
            -- str = 'You can now do '..storage.name..' quest again!'
            continue = true
        end

        if not continue then
            if getPlayerStorageValue(cid, q) - time > days then
                str = 'You must wait '.. math.ceil(((getPlayerStorageValue(cid, q)) - time) / days) ..' days to do the '..storage.name..' quest again.'
            elseif getPlayerStorageValue(cid, q) - time > hours then
                str = 'You must wait '.. math.ceil(((getPlayerStorageValue(cid, q)) - time) / hours) ..' hours to do the '..storage.name..' quest again.'
            else
                str = 'You must wait '.. math.ceil(((getPlayerStorageValue(cid, q)) - time) / mins) ..' minutes to do the '..storage.name..' quest again.'
            end
            final = final .. "[" .. storage.name .. "]: " .. str .. "\n\n"
        end
    end
    doShowTextDialog(cid, 2175, final)
    return true
end
 
Why are you even using goto? this leads to spaghetti code and should not be used when you dont need.
My recomendation is to make that:

Lua:
dofile(getDataDir() .. "actions/scripts/quests.lua")

function onSay(cid, words, param, channel)
    local mins = 60
    local hours = 60 * 60
    local days = 24 * 60 * 60
    print("----------")
    print(mins, hours, days)
    local time = os.time()
    local final = ''
    -- We are looping from 8000 to 8005, so those are the storages that we will check.
    for q, quest in pairs(zexus_quest_list) do
        print(q)
        local storage = quest -- In this local we get the information, for example if q is equal to 8000 and you print storage.name you will get "Sabre Rook".
        local str = ''


        local continue = false
        -- don't show everything, only exausted one, cause there are a lot of quests
        if getPlayerStorageValue(cid, q) < 0 then
            -- str = 'You have never done '..storage.name..' quest! Time to get to it.'
            continue = true
        elseif time - getPlayerStorageValue(cid, q) >= 0 then
            -- str = 'You can now do '..storage.name..' quest again!'
            continue = true
        end

        if not continue then
            if getPlayerStorageValue(cid, q) - time > days then
                str = 'You must wait '.. math.ceil(((getPlayerStorageValue(cid, q)) - time) / days) ..' days to do the '..storage.name..' quest again.'
            elseif getPlayerStorageValue(cid, q) - time > hours then
                str = 'You must wait '.. math.ceil(((getPlayerStorageValue(cid, q)) - time) / hours) ..' hours to do the '..storage.name..' quest again.'
            else
                str = 'You must wait '.. math.ceil(((getPlayerStorageValue(cid, q)) - time) / mins) ..' minutes to do the '..storage.name..' quest again.'
            end
            final = final .. "[" .. storage.name .. "]: " .. str .. "\n\n"
        end
    end
    doShowTextDialog(cid, 2175, final)
    return true
end

AMAZING

one last thing

when i was trying to test your script, i saw that the action is bugged

did u know why?

data/actions/scripts/quests/quests.lua
Code:
dofile(getDataDir() .. "actions/scripts/quests/quests_list.lua")

function isLevelRequired(value)
    return type(value) == "table" and true, value.item, value.lvl or false, value
end
function onUse(cid, item, fromPos, item2, toPos)
    local levelRequired, quest, level = isLevelRequired(zexus_quest_list[item.actionid])
    if levelRequired then
        if getPlayerLevel(cid) < level then
            doPlayerSendCancel(cid, "Sorry, level: " .. level .. " or higher to complete this quest.")
            doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
            return true
        end
    end
    if quest then
        local storage = 200000 + item.actionid
        local quest = zexus_quest_list[item.actionid]
        if quest then
            local timeNow = os.time()
            if timeNow - getPlayerStorageValue(cid, item.actionid) >= 0 then
                if getPlayerFreeCap(cid) >= getItemWeightById(quest.item, 1) then
                    doPlayerAddItem(cid, quest.item, 1)
                    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You have found a '..getItemNameById(quest.item)..'.')
                    setPlayerStorageValue(cid, item.actionid, timeNow + quest.time)
                else
                    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You have found a '..getItemNameById(quest.item)..'. It weighs '..getItemWeightById(quest.item, 1)..'.00 and it is too heavy.')          
                end
            elseif getPlayerStorageValue(cid, item.actionid) < 0 then
                doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'It is empty.')
            elseif getPlayerStorageValue(cid, item.actionid)-timeNow > days then
                doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'It is empty, you must wait '.. math.ceil(((getPlayerStorageValue(cid, item.actionid)) - timeNow)/days) ..' days to do it again.')
            elseif getPlayerStorageValue(cid, item.actionid)-timeNow > hours then
                doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'It is empty, you must wait '.. math.ceil(((getPlayerStorageValue(cid, item.actionid)) - timeNow)/hours) ..' hours to do it again.')
            else
                doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'It is empty, you must wait '.. math.ceil(((getPlayerStorageValue(cid, item.actionid)) - timeNow)/mins) ..' minutes to do it again.')
            end
        end
    end
    return true
end

data/actions/scripts/quests/quests_list.lua
Code:
mins = 60
hours = 60 * 60
days = 24 * 60 * 60

zexus_quest_list = {
    -- rook
    [8000] = { name = "Sabre Rook", item = 2385, lvl = 1, time = 15 * mins},
    [8001] = { name = "Doublet Rook", item = 2485, lvl = 2, time = 30 * mins},
    [8002] = { name = "Studded Shield Rook", item = 2526, lvl = 3, time = 50 * mins},
    [8003] = { name = "Copper Shield Rook", item = 2530, lvl = 5, time = 3 * hours},
    [8004] = { name = "Legion Helmet Rookx", item = 2480, lvl = 5, time = 5 * hours},
    [8005] = { name = "Katana Rook", item = 2412, lvl = 5, time = 10 * hours}
}

errors on console:
Code:
[20:0:29.635] [Error - Action Interface] 
[20:0:29.635] data/actions/scripts/quests/quests.lua:onUse
[20:0:29.635] Description: 
[20:0:29.635] data/actions/scripts/quests/quests.lua:4: attempt to index local 'value' (a nil value)
[20:0:29.635] stack traceback:
[20:0:29.635]     data/actions/scripts/quests/quests.lua:4: in function 'isLevelRequired'
[20:0:29.635]     data/actions/scripts/quests/quests.lua:7: in function <data/actions/scripts/quests/quests.lua:6>
 
AMAZING

one last thing

when i was trying to test your script, i saw that the action is bugged

did u know why?

data/actions/scripts/quests/quests.lua
Code:
dofile(getDataDir() .. "actions/scripts/quests/quests_list.lua")

function isLevelRequired(value)
    return type(value) == "table" and true, value.item, value.lvl or false, value
end
function onUse(cid, item, fromPos, item2, toPos)
    local levelRequired, quest, level = isLevelRequired(zexus_quest_list[item.actionid])
    if levelRequired then
        if getPlayerLevel(cid) < level then
            doPlayerSendCancel(cid, "Sorry, level: " .. level .. " or higher to complete this quest.")
            doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
            return true
        end
    end
    if quest then
        local storage = 200000 + item.actionid
        local quest = zexus_quest_list[item.actionid]
        if quest then
            local timeNow = os.time()
            if timeNow - getPlayerStorageValue(cid, item.actionid) >= 0 then
                if getPlayerFreeCap(cid) >= getItemWeightById(quest.item, 1) then
                    doPlayerAddItem(cid, quest.item, 1)
                    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You have found a '..getItemNameById(quest.item)..'.')
                    setPlayerStorageValue(cid, item.actionid, timeNow + quest.time)
                else
                    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You have found a '..getItemNameById(quest.item)..'. It weighs '..getItemWeightById(quest.item, 1)..'.00 and it is too heavy.')         
                end
            elseif getPlayerStorageValue(cid, item.actionid) < 0 then
                doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'It is empty.')
            elseif getPlayerStorageValue(cid, item.actionid)-timeNow > days then
                doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'It is empty, you must wait '.. math.ceil(((getPlayerStorageValue(cid, item.actionid)) - timeNow)/days) ..' days to do it again.')
            elseif getPlayerStorageValue(cid, item.actionid)-timeNow > hours then
                doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'It is empty, you must wait '.. math.ceil(((getPlayerStorageValue(cid, item.actionid)) - timeNow)/hours) ..' hours to do it again.')
            else
                doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'It is empty, you must wait '.. math.ceil(((getPlayerStorageValue(cid, item.actionid)) - timeNow)/mins) ..' minutes to do it again.')
            end
        end
    end
    return true
end

data/actions/scripts/quests/quests_list.lua
Code:
mins = 60
hours = 60 * 60
days = 24 * 60 * 60

zexus_quest_list = {
    -- rook
    [8000] = { name = "Sabre Rook", item = 2385, lvl = 1, time = 15 * mins},
    [8001] = { name = "Doublet Rook", item = 2485, lvl = 2, time = 30 * mins},
    [8002] = { name = "Studded Shield Rook", item = 2526, lvl = 3, time = 50 * mins},
    [8003] = { name = "Copper Shield Rook", item = 2530, lvl = 5, time = 3 * hours},
    [8004] = { name = "Legion Helmet Rookx", item = 2480, lvl = 5, time = 5 * hours},
    [8005] = { name = "Katana Rook", item = 2412, lvl = 5, time = 10 * hours}
}

errors on console:
Code:
[20:0:29.635] [Error - Action Interface]
[20:0:29.635] data/actions/scripts/quests/quests.lua:onUse
[20:0:29.635] Description:
[20:0:29.635] data/actions/scripts/quests/quests.lua:4: attempt to index local 'value' (a nil value)
[20:0:29.635] stack traceback:
[20:0:29.635]     data/actions/scripts/quests/quests.lua:4: in function 'isLevelRequired'
[20:0:29.635]     data/actions/scripts/quests/quests.lua:7: in function <data/actions/scripts/quests/quests.lua:6>

it was working... what i have done wrong?
 

Similar threads

Replies
0
Views
362
Back
Top