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

Talkaction blessings

Mudrock

Member
Joined
Jan 25, 2017
Messages
102
Reaction score
19
Location
Minas Gerais - Brazil
Good morning everyone, I'm having a problem with this blessing talkaction that are not delivering the same, it can be bought infinitely and does not deliver anything.

PS: She charges the player's money normally.

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,8 do
                p:addBlessing(b)
            end
            p:getPosition():sendMagicEffect(50)
            p:sendTextMessage(19, "You have been blessed by the gods!")
        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
 
Good morning everyone, I'm having a problem with this blessing talkaction that are not delivering the same, it can be bought infinitely and does not deliver anything.

PS: She charges the player's money normally.

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,8 do
                p:addBlessing(b)
            end
            p:getPosition():sendMagicEffect(50)
            p:sendTextMessage(19, "You have been blessed by the gods!")
        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


Try
Lua:
for b = 1,5 do

If that works you don't have support for the 3 "last" blesssings.
 
Same thing, I basically need the script that sells all the new blessings and that they retire money from the bank if the player is not in the backpack

But you get this text? "You have been blessed by the gods!"?
If you do the blessings should be added, "1, 5" is the "normal" blessings.

There is nothing else that can cancel it, since it passed removeMoney.
Are you using TFS or OTX? This will work with TFS 100%
 
Good morning everyone, I'm having a problem with this blessing talkaction that are not delivering the same, it can be bought infinitely and does not deliver anything.

PS: She charges the player's money normally.

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,8 do
                p:addBlessing(b)
            end
            p:getPosition():sendMagicEffect(50)
            p:sendTextMessage(19, "You have been blessed by the gods!")
        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
try
Lua:
p:addBlessing(b, 1)
 
But you get this text? "You have been blessed by the gods!"?
If you do the blessings should be added, "1, 5" is the "normal" blessings.

There is nothing else that can cancel it, since it passed removeMoney.
Are you using TFS or OTX? This will work with TFS 100%
I use OTX, updated 11.46! He possesses all the new blessings of the world and I wanted them to work with them as well.
 
Back
Top