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

Lua bless by lvl

Lbtg

Intermediate OT User
Joined
Nov 22, 2008
Messages
2,297
Reaction score
127
Hello so i got this script but it aint working correcly

Lua:
-- !blessing by artofwork
local bless = {1, 2, 3, 4, 5}
local cost = 1000
local maxlevel = 8

function onSay(cid, words, param)
local lvl = getPlayerLevel(cid)
local new_cost = (lvl * cost) / 1000
local target = getPlayerGUID(cid)


        for i = 1, table.maxn(bless) do
                if(getPlayerBlessing(cid, bless[i])) then
                        doPlayerSendCancel(cid, "You have already have been blessed.")
                        return TRUE
                end
        end
       
        if (getPlayerLevel(cid) >= maxlevel)  then
                if(doPlayerRemoveMoney(cid, new_cost) == TRUE) then
                        for i = 1, table.maxn(bless) do
                        doPlayerAddBlessing(cid, bless[i])
                        doPlayerSendTextMessage(cid,22,"You have been successfully blessed.!")
                end
                else
                doPlayerPopupFYI(cid, "You need "..new_cost.." to buy blessings.")
                end
       
        elseif(getPlayerLevel(cid) < maxlevel) then
                if(doPlayerRemoveMoney(cid, cost) == TRUE) then
                        for i = 1, table.maxn(bless) do
                        doPlayerAddBlessing(cid, bless[i])
                        end
                        doPlayerPopupFYI(cid, "You have successfully been blessed.")
                else
                        doPlayerPopupFYI(cid, "You need to have "..cost.."gp to buy blessings.")
                end
        end
        return FALSE
end

I want to set so 1000gold x level price for bless now its some mess, if i dont have enought money it says i dont have enought 54 to buy blessings , but the 54 is level ^^ and aswell money taken for bless isint correcly to..

can someone fix it up please?
Thanks in advance <3
 
issue might be within the math done when calculating the cost. "(lvl * cost) / 1000" ex: 54 * 1000 = 54000 / 1000 = 54 once again.
 
Solution
Code:
-- !blessing by artofwork
Hey, it's one of Codex's Scripts. :D
 
Back
Top