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

C++ Error with bless

nefinoo

Carnage.flv
Joined
Sep 11, 2010
Messages
428
Solutions
1
Reaction score
35
Location
Lo Mochis, Sinaloa
Lua:
local buybless = TalkAction("/bless")

function buybless.onSay(player, words, param)
     if player:hasBlessing(1) then
        player:sendTextMessage(MESSAGE_INFO_DESCR, "You are already blessed.")
        player:getPosition():sendMagicEffect(CONST_ME_POFF)
    else
        local playerBlessCost
        if player:getLevel() < 50 then
            -- under level 50 it's free
            playerBlessCost = 0
        else
            -- from level 50 cost 36k + 200 gold coins for each level
            -- limit to maximum 120k
            playerBlessCost = player:getLevel() * 100
        end

        if player:removeMoney(playerBlessCost) then
            for blessId = 1, 5 do
                player:addBlessing(blessId)
            end

            player:sendCancelMessage("You received all blessings for " .. playerBlessCost .. " gold coins.")
            player:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
        else
            player:sendTextMessage(MESSAGE_INFO_DESCR, "You do not have enough money. Bless on your level costs " .. playerBlessCost .. " gold coins.")
            player:getPosition():sendMagicEffect(CONST_ME_POFF)
        end
    end

  return true
end

buybless:separator(" ")
buybless:register()
blesserror.png
 

Evil Puncker

prolonged absenteeism
TFS Developer
Joined
May 30, 2009
Messages
7,962
Solutions
205
Reaction score
3,791
Solution

Xikini

I whore myself out for likes
Support Team
Joined
Nov 17, 2010
Messages
5,612
Solutions
395
Reaction score
3,731
Lua:
local buybless = TalkAction("/bless")

function buybless.onSay(player, words, param)
     if player:hasBlessing(1) then
        player:sendTextMessage(MESSAGE_INFO_DESCR, "You are already blessed.")
        player:getPosition():sendMagicEffect(CONST_ME_POFF)
    else
        local playerBlessCost
        if player:getLevel() < 50 then
            -- under level 50 it's free
            playerBlessCost = 0
        else
            -- from level 50 cost 36k + 200 gold coins for each level
            -- limit to maximum 120k
            playerBlessCost = player:getLevel() * 100
        end

        if player:removeMoney(playerBlessCost) then
            for blessId = 1, 5 do
                player:addBlessing(blessId)
            end

            player:sendCancelMessage("You received all blessings for " .. playerBlessCost .. " gold coins.")
            player:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
        else
            player:sendTextMessage(MESSAGE_INFO_DESCR, "You do not have enough money. Bless on your level costs " .. playerBlessCost .. " gold coins.")
            player:getPosition():sendMagicEffect(CONST_ME_POFF)
        end
    end

  return true
end

buybless:separator(" ")
buybless:register()
View attachment 62418
Update your tfs version, I guess?

I copy pasted it on tfs 1.4, and it worked no problem.

Untitled.pngUntitled.png
 

Xikini

I whore myself out for likes
Support Team
Joined
Nov 17, 2010
Messages
5,612
Solutions
395
Reaction score
3,731
How can I update my tfs leaving my own files already modified? for example I have set the monster level system
Follow Evil Puncker's link, make the changes, and recompile your source code.

--
If you're using a modified source code, you need to stay up-to-date with the original source code and install any of the bug fixes / upgrades manually.

🤷‍♀️
 
Top