• 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 with talkaction !bless

Maddude

New Member
Joined
Feb 7, 2008
Messages
34
Reaction score
2
So im having a problem with this talkaction, it isnt applying the blessing to the character, but takes the money and does the effect any ideas ? using this from OTServBR-Global github.
Lua:
 function onSay(cid, words, param)
if getPlayerBlessing(cid,8) then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have already been blessed")
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MORTAREA)
else
if doPlayerRemoveMoney(cid, 50000) == TRUE then
    do doPlayerAddBlessing(cid,1,2,3,4,5,6,7,8)
end
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have received blessings!")
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_ENERGYAREA)
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You need 50,000 gp in backpack for blessings.")
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_ICEAREA)
end
end
end
 
try
Lua:
function onSay(cid, words, param)
    if getPlayerBlessing(cid, 8) then
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have already been blessed")
        doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MORTAREA)
    else
        if doPlayerRemoveMoney(cid, 50000) then
            for i = 1, 8 do
                doPlayerAddBlessing(cid, i)
            end
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have received blessings!")
            doSendMagicEffect(getPlayerPosition(cid), CONST_ME_ENERGYAREA)
        else
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You need 50,000 gp in backpack for blessings.")
            doSendMagicEffect(getPlayerPosition(cid), CONST_ME_ICEAREA)
        end
    end
    return true
end
 
Try this:


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)) then
            p:sendCancelMessage("You have already been blessed by the gods.")
            return false
        end
        if(p:removeMoneyNpc(cost)) then
            for b = 1,6 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

And in the next, it's best to create an issue in the repository.
 
Try this:


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)) then
            p:sendCancelMessage("You have already been blessed by the gods.")
            return false
        end
        if(p:removeMoneyNpc(cost)) then
            for b = 1,6 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

And in the next, it's best to create an issue in the repository.
Yeah still doesnt work its like the functions dont exist but they do its weird :S
 
Lua:
function onSay(cid)

    local player = Player(cid)
    local totalBlessPrice = getBlessingsCost(player:getLevel()) * 5 * 0.7

    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, 8 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
end

Credits too [TFS 1.3] Comando: !bless (https://tibiaking.com/forums/topic/87244-tfs-13-comando-bless/?ct=1562015591)
 
Back
Top