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

OTX problem bless.

Dvax

New Member
Joined
Jul 23, 2016
Messages
51
Solutions
1
Reaction score
3
Hello I use OTX tomorrow have problem with blessings, all script " !bless " not work but i find working script this script:
Code:
function getCost(level)
    if level <= 30 then
        return 2000*5
    elseif level >= 120 then
        return 10000*5
    else
        return ((level - 20) * 200 * 5)
    end
end
function onSay(cid, words, param)
    local p = Player(cid)
    local cost = getCost(getPlayerLevel(cid))
    if(not(isPlayerPzLocked(cid))) then
        if(p:hasBlessing(1) and p:hasBlessing(2) and p:hasBlessing(3) and p:hasBlessing(4) and p:hasBlessing(5) and p:hasBlessing(6) and p:hasBlessing(7) and p:hasBlessing(8)) then
            p:sendCancelMessage("You have already been blessed by the gods.")
            return false
        end
        if(p:removeMoneyNpc(cost)) then
            for b = 1,5 do
                p:addBlessing(b, 1)
            end
            p:getPosition():sendMagicEffect(50)
            p:sendTextMessage(19, "Nowy system blessow! kupuj ile chcesz!")
        else
            p:sendCancelMessage("You need "..cost.." gold coins to buy all blessings.")
        end
    else
        p:sendCancelMessage("You can't buy bless, when you are in a battle.")
    end
return false
end

Now player can buy bless " !bless " all working but ppl can still buy and stack blessing.
How can I block it
 
Lua:
local blessings = {1, 2, 3, 4, 5, 6, 7, 8}

function getCost(level)
    if level <= 30 then
        return 2000 * 5
    elseif level >= 120 then
        return 10000 * 5
    else
        return ((level - 20) * 200 * 5)
    end
end

function onSay(player, words, param)
    if player:isPzLocked() then
        player:sendCancelMessage("You can't buy bless, when you are in a battle.")
        return false
    end

    if player:hasBlessing(#blessings) then
        player:sendCancelMessage("You have already been blessed by the gods.")
        return false
    end

    if player:removeMoneyNpc(cost) then
        for b = 1, 8 do
            player:addBlessing(b, 1)
        end
        player:getPosition():sendMagicEffect(CONST_ME_HOLYAREA)
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Nowy system blessow! kupuj ile chcesz!")
    else
        player:sendCancelMessage("You need "..cost.." gold coins to buy all blessings.")
    end
    return false
end
 
Last edited:
Lua:
local blessings = {1, 2, 3, 4, 5, 6, 7, 8}

function getCost(level)
    if level <= 30 then
        return 2000 * 5
    elseif level >= 120 then
        return 10000 * 5
    else
        return ((level - 20) * 200 * 5)
    end
end

function onSay(player, words, param)
    if player:isPzLocked() then
        p:sendCancelMessage("You can't buy bless, when you are in a battle.")
        return false
    end

    if player:hasBlessing(#blessings) then
        player:sendCancelMessage("You have already been blessed by the gods.")
        return false
    end

    if player:removeMoneyNpc(cost) then
        for b = 1, 8 do
            player:addBlessing(b, 1)
        end
        player:getPosition():sendMagicEffect(CONST_ME_HOLYAREA)
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Nowy system blessow! kupuj ile chcesz!")
    else
        player:sendCancelMessage("You need "..cost.." gold coins to buy all blessings.")
    end
    return false
end

Now command !bless not work
 
Again not work but i find now scirpt and working but give only 5 bless.
Code:
function onSay(cid)
 
    local player = Player(cid)
    local totalBlessPrice = getBlessingsCost(player:getLevel()) * 5 * 0.7
    if(not(isPlayerPzLocked(cid))) then
    if player:getBlessings() == 5 then
                player:sendCancelMessage("You already have been blessed!", cid)
            elseif player:removeMoney(totalBlessPrice) then
                player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have been blessed by all of eight gods!")
                for b = 1, 5 do
                    player:addBlessing(b, 1)
                end
                player:getPosition():sendMagicEffect(CONST_ME_HOLYAREA)
            
            else
                player:sendCancelMessage("You don't have enough money. You need " .. totalBlessPrice .. " to buy bless.", cid)
            end
    else
        player:sendCancelMessage("You can't buy bless while you are in a battle.")
    end
end
 
Try again, sorry, my error !

Lua:
local blessings = {1, 2, 3, 4, 5, 6, 7, 8}
function getCost(level)
    if level <= 30 then
        return 2000 * 5
    elseif level >= 120 then
        return 10000 * 5
    else
        return ((level - 20) * 200 * 5)
    end
end
function onSay(player, words, param)
    if player:isPzLocked() then
        player:sendCancelMessage("You can't buy bless, when you are in a battle.")
        return false
    end
   if player:hasBlessing(#blessings) then
       player:sendCancelMessage("You have already been blessed by the gods.")
       return false
   end
   
    local cost = getCost(player:getLevel())
    if player:removeMoney(cost) then
        for b = 1, 8 do
            player:addBlessing(b, 1)
        end
        player:getPosition():sendMagicEffect(CONST_ME_HOLYAREA)
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Nowy system blessow! kupuj ile chcesz!")
    else
        player:sendCancelMessage("You need "..cost.." gold coins to buy all blessings.")
    end
    return false
end
 
Back
Top