• 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!

Solved Problem with value

Advent

Custom RPG Maker
Joined
Oct 3, 2009
Messages
306
Reaction score
7
One question : How I can do formule where I am getting attributes from label to storage value ? Lets give it
t = {100,200,300,400,500}
getPlayerStorageValue (cid,miningtries)

I tried using loop
for i = 1,5 do
if getPlayerStorageValue (cid,miningtries) == t then SendAdvancedMessage

but this code is kinda bad. Any ideas ?
It should check if getPlayerStorageValue (cid,miningtries) == any label attribute
 
Lua:
local t = {100, 200, 300, 400, 500, 600}
local function getTriesToMiningLvl(lv)
    if not t[lv] then
        return 0
    end

    return t[lv]
end

local miningtries = XXXX
local mininglvl = YYYY

local lvl = math.max(1, getCreatureStorage(cid, mininglvl))
local triesNeeded = getTriesToMiningLvl(lvl)
if triesNeeded > 0 and getCreatureStorage(cid, miningtries) >= triesNeeded then
    doPlayerSetStorageValue(cid, mininglvl, lvl + 1)
    doPlayerSendCancel(cid, "You advanced to mining level " .. (lvl + 1) .. "!")
    return true
end
 
Thank you very much. I used trash lines and it worked out but thanks to your response I am able to step up with my LUA knowledge. Please close thread.
 
Back
Top