• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Bless, Ingot

Etzi

New Member
Joined
May 19, 2014
Messages
28
Reaction score
1
(TFS 0.3.6 8.60) When i try bless with 1 ingot in the backpack it won't let me buy bless

In my changegold.lua

Code:
    [ITEM_GOLD_INGOT] = {
        from = ITEM_CRYSTAL_COIN, effect = TEXTCOLOR_YELLOW

And this is in my items.xml

Code:
    <item id="9971" article="a" name="gold ingot">
        <attribute key="weight" value="10" />
        <attribute key="worth" value="1000000" />

I hope someone can help me :)

 
Are you using same id for achieve the action?. As i said, you did not show any script which gives bless.
 
Blessings.lua

Code:
function onSay(cid, words, param, channel)
        print(getCreatureName(cid) .. ": " .. getPlayerMoney(cid))
        if getPlayerBlessing(cid, 5) == FALSE then
                if getPlayerMoney(cid) >= 150000 then
                        for i = 1,5 do
                                doPlayerAddBlessing(cid, i)
                        end
                        doSendMagicEffect(getCreaturePosition(cid), 39)
                        doPlayerRemoveMoney(cid, 150000)
                        doPlayerSendTextMessage(cid, 22, "You have been blessed by the gods!")
                else
                        doPlayerSendCancel(cid, "You don't have enough money.")
                        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
                end
        else
                doPlayerSendCancel(cid, "You have already been blessed.")
                doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
        end
return true
end


Actions changegold.lua

Code:
local ITEM_GOLD_INGOT = 9971
local coins = {
    [ITEM_GOLD_COIN] = {
        to = ITEM_PLATINUM_COIN, effect = TEXTCOLOR_YELLOW
    },
    [ITEM_PLATINUM_COIN] = {
        from = ITEM_GOLD_COIN, to = ITEM_CRYSTAL_COIN, effect = TEXTCOLOR_LIGHTBLUE
    },
    [ITEM_CRYSTAL_COIN] = {
        from = ITEM_PLATINUM_COIN, to = ITEM_GOLD_INGOT, effect = TEXTCOLOR_TEAL
    },
    [ITEM_GOLD_INGOT] = {
        from = ITEM_CRYSTAL_COIN, effect = TEXTCOLOR_YELLOW
    }
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if(getPlayerFlagValue(cid, PLAYERFLAG_CANNOTPICKUPITEM)) then
        return false
    end

    local coin = coins[item.itemid]
    if(not coin) then
        return false
    end

    if(coin.to and item.type == ITEMCOUNT_MAX) then
        doChangeTypeItem(item.uid, item.type - item.type)
        doPlayerAddItem(cid, coin.to, 1)
        doSendAnimatedText(fromPosition, "$$$", coins[coin.to].effect)
    elseif(coin.from) then
        doChangeTypeItem(item.uid, item.type - 1)
        doPlayerAddItem(cid, coin.from, ITEMCOUNT_MAX)
        doSendAnimatedText(fromPosition, "$$$", coins[coin.from].effect)
    end
    return true
end
 
If you cant get it to work use this:

Code:
if getPlayerItemCount(cid, gold_ingot) == 1 then
         if doPlayerRemoveMoney(cid, 50000) then
                   for i = 1,5 do
                         doPlayerAddBlessing(cid, i)
                     end
                    doPlayerSendTextMessage(cid, 22, "You have been blessed by the gods!")
         else
             doPlayerAddItem(cid, gold_ingot, 1)
             doPlayerSendTextMessage(cid, 22, "You do not have enough gold!")
        end
elseif getPlayerItemCount(cid, gold_ingot) >= 2 then
         if getPlayerMoney(cid) >= 50000 then
                doPlayerRemoveItem(cid, gold_ingot, 1)
                doPlayerRemoveMoney(cid, 50000)
                     for i = 1,5 do
                         doPlayerAddBlessing(cid, i)
                     end
                  doPlayerSendTextMessage(cid, 22, "You have been blessed by the gods!")
        else
             doPlayerRemoveItem(cid, gold_ingot, 2)
             doPlayerAddMoney(cid, 50000)
        end
elseif getPlayerItemCount(cid, gold_ingot) < 1 then
    if doPlayerRemoveMoney(cid, 150000) then
            for i = 1,5 do
                doPlayerAddBlessing(cid, i)
            end
         doPlayerSendTextMessage(cid, 22, "You have been blessed by the gods!")
    else
        doPlayerSendTextMessage(cid, 22, "You do not have enough gold!")
    end
end
 
I seen an error in my code before.... heres this one.

Code:
function onSay(cid, words, param channel)
if getPlayerItemCount(cid, gold_ingot) == 1 then
         if doPlayerRemoveMoney(cid, 50000) then
             doPlayerRemoveItem(cid, gold_ingot, 1)
                   for i = 1,5 do
                         doPlayerAddBlessing(cid, i)
                     end
                    doPlayerSendTextMessage(cid, 22, "You have been blessed by the gods!")
         else
             doPlayerAddItem(cid, gold_ingot, 1)
             doPlayerSendTextMessage(cid, 22, "You do not have enough gold!")
        end
elseif getPlayerItemCount(cid, gold_ingot) >= 2 then
         if getPlayerMoney(cid) >= 50000 then
                doPlayerRemoveItem(cid, gold_ingot, 1)
                doPlayerRemoveMoney(cid, 50000)
                     for i = 1,5 do
                         doPlayerAddBlessing(cid, i)
                     end
                  doPlayerSendTextMessage(cid, 22, "You have been blessed by the gods!")
        else
             doPlayerRemoveItem(cid, gold_ingot, 2)
             doPlayerAddMoney(cid, 50000)
        end
elseif getPlayerItemCount(cid, gold_ingot) < 1 then
    if doPlayerRemoveMoney(cid, 150000) then
            for i = 1,5 do
                doPlayerAddBlessing(cid, i)
            end
         doPlayerSendTextMessage(cid, 22, "You have been blessed by the gods!")
    else
        doPlayerSendTextMessage(cid, 22, "You do not have enough gold!")
    end
end
return true
end
 
Code:
local gold_ingot = 1111 --Type the item id of gold ingot here

function onSay(cid, words, param channel)
if getPlayerItemCount(cid, gold_ingot) == 1 then
         if doPlayerRemoveMoney(cid, 50000) then
             doPlayerRemoveItem(cid, gold_ingot, 1)
                   for i = 1,5 do
                         doPlayerAddBlessing(cid, i)
                     end
                    doPlayerSendTextMessage(cid, 22, "You have been blessed by the gods!")
         else
             doPlayerAddItem(cid, gold_ingot, 1)
             doPlayerSendTextMessage(cid, 22, "You do not have enough gold!")
        end
elseif getPlayerItemCount(cid, gold_ingot) >= 2 then
         if getPlayerMoney(cid) >= 50000 then
                doPlayerRemoveItem(cid, gold_ingot, 1)
                doPlayerRemoveMoney(cid, 50000)
                     for i = 1,5 do
                         doPlayerAddBlessing(cid, i)
                     end
                  doPlayerSendTextMessage(cid, 22, "You have been blessed by the gods!")
        else
             doPlayerRemoveItem(cid, gold_ingot, 2)
             doPlayerAddMoney(cid, 50000)
                      for i = 1,5 do
                doPlayerAddBlessing(cid, i)
            end
         doPlayerSendTextMessage(cid, 22, "You have been blessed by the gods!")
        end
elseif getPlayerItemCount(cid, gold_ingot) < 1 then
    if doPlayerRemoveMoney(cid, 150000) then
            for i = 1,5 do
                doPlayerAddBlessing(cid, i)
            end
         doPlayerSendTextMessage(cid, 22, "You have been blessed by the gods!")
    else
        doPlayerSendTextMessage(cid, 22, "You do not have enough gold!")
    end
end
return true
end


in case your a real noobie at this.... make sure you use this one and type the itemid of gold ingot
 
Last edited:
Blessings.lua
Code:
function onStepIn(cid, item, position, fromPosition)

     local money_required  = 150000

     local player_gold  = getPlayerItemCount(cid,2148)
     local player_plat  = getPlayerItemCount(cid,2152)*100
     local player_crys  = getPlayerItemCount(cid,2160)*10000
     local player_ingt  = getPlayerItemCount(cid,9971)*1000000
     local player_money  = player_gold + player_plat + player_crys + player_ingt
     local addon = getPlayerItemById(cid, true, 9004)
     print(getCreatureName(cid) .. ": " .. getPlayerMoney(cid))
     if getPlayerBlessing(cid, 5) == FALSE then
         if player_money >= money_required then
             for i = 1,5 do
                 doPlayerAddBlessing(cid, i)
             end
             doSendMagicEffect(getCreaturePosition(cid), 39)
             if getPlayerItemCount(cid,9971) >= 1 then
                 doPlayerRemoveItem(cid, 9971, 1)
                 doPlayerAddMoney(cid, 1000000-money_required)
             else
                 doPlayerRemoveMoney(cid, money_required)
             end
             doPlayerSendTextMessage(cid, 22, "You have been blessed by the gods!")
         else
             doPlayerSendCancel(cid, "You don't have enough money.")
             doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
         end
     else
         doPlayerSendCancel(cid, "You have already been blessed.")
         doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
     end
     return true
end
Something to note, in your original script.. it's broken..
Code:
if player_money >= 34000 then
Code:
doPlayerRemoveMoney(cid, 150000)
Both of these should be the same value.. I fixed it in the script above.
 
Last edited by a moderator:
Back
Top