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

Need help about my bless.lua not work

FauN1337

New Member
Joined
Apr 28, 2019
Messages
8
Reaction score
3
Location
Turkey
bless are not work but you did unlimited bless always when you use !bless command in-game can someone help please?

Code:
local config = {
    blessStorage = 12345, -- The storage value you will use to store a players blessings
    blessCost = 50000 -- The price of blessings
}
function onSay(cid, words, param)
    if(getCreatureStorage(cid, config.blessStorage) <= 0) then
        if(doPlayerRemoveMoney(cid, config.blessCost)) then
            doCreatureSetStorage(cid, config.blessStorage, 1)
            doCreatureSay(cid, "You are now blessed by the Five Gods!", 19)
            doSendMagicEffect(getPlayerPosition(cid), 49)
        else
            doPlayerSendCancel(cid, "You need ".. config.blessCost .."gp to buy blessings.")
        end
    else
        doPlayerSendCancel(cid, "You are already blessed.")
    end
    return true
end
 
Last edited:
Try this one, in the past I used this

It's not necessary to have storage ID but if you want we can try to add this

Code:
local bless = {1, 2, 3, 4, 5}
local cost = 50000
function onSay(cid, words, param)
for i = 1, table.maxn(bless) do
if(getPlayerBlessing(cid, bless[i])) then
doPlayerSendCancel(cid, "Voce ja tem todas as bless.")
return TRUE
end
end

if(doPlayerRemoveMoney(cid, cost) == TRUE) then
for i = 1, table.maxn(bless) do
doPlayerAddBlessing(cid, bless[i])
end
doCreatureSay(cid, "You are now blessed!" ,19)
doSendMagicEffect(getPlayerPosition(cid), 49)
else
doPlayerSendCancel(cid, "You need 50k to buy blessings.")
end
return TRUE
end
 
Try this one, in the past I used this

It's not necessary to have storage ID but if you want we can try to add this

Code:
local bless = {1, 2, 3, 4, 5}
local cost = 50000
function onSay(cid, words, param)
for i = 1, table.maxn(bless) do
if(getPlayerBlessing(cid, bless[i])) then
doPlayerSendCancel(cid, "Voce ja tem todas as bless.")
return TRUE
end
end

if(doPlayerRemoveMoney(cid, cost) == TRUE) then
for i = 1, table.maxn(bless) do
doPlayerAddBlessing(cid, bless[i])
end
doCreatureSay(cid, "You are now blessed!" ,19)
doSendMagicEffect(getPlayerPosition(cid), 49)
else
doPlayerSendCancel(cid, "You need 50k to buy blessings.")
end
return TRUE
end
This bless script always confused me.
What if there is a way to get 1-2 bless from another source?
The player is still paying the full price.

Here's an untested, revised version.
Lua:
local cost = 10000 -- per bless

function onSay(cid, words, param)
    local text, text2, count = "", "", 0
    for i = 1, 5 do
        if getPlayerBlessing(cid, i) == false then
            if getPlayerMoney(cid) >= cost then
                doPlayerRemoveMoney(cid, cost)
                doPlayerAddBlessing(cid, i)
                if text ~= "" then
                    text = text .. ", "
                end
                text = text .. "" .. i .. ""
                count = count + 1
            else
                if text2 ~= "" then
                    text2 = text2 .. ", "
                end
                text2 = text2 .. "" .. i .. ""
            end
        end
    end
    if text == "" and text2 == "" then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You are fully blessed.")
        return true
    end
    if text ~= "" then
        text = "Blessings " .. text .. " were purchased for a total of " .. (count * cost) .. " gold."
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, text)
    end
    if text2 ~= "" then
        text2 = "Blessings " .. text2 .. " were unable to be purchased due to insufficient gold."
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, text)
    end
    return true
end
 
Back
Top