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

Auto Blessing problem

jareczekjsp

Member
Joined
Jan 30, 2023
Messages
188
Reaction score
9
GitHub
Jarek123
Hello guys I have Problem With Script :Auto blessing in [MODS] I use tfs 0.4 tibia 8.6

ERROR
[23:59:00] [Error - GlobalEvent Interface]
[23:59:00] function onTime(interval, lastExecution)
[23:59:00] db.executeQuery("UPDATE player_storage SET key = key - 1 WHERE value = 250;");
[23:59:00] return true
[23:59:00] end
[23:59:00] :eek:nTime
[23:59:00] Description:
[23:59:00] [string "LuaInterface::loadBuffer"]:2: attempt to call field 'executeQuery' (a nil value)
[23:59:00] stack traceback:
[23:59:00] [string "LuaInterface::loadBuffer"]:2: in function <[string "LuaInterface::loadBuffer"]:1>
[23:59:00] [Error - GlobalEvents::timer] Couldn't execute event: AutoBlessing

My Script is

Lua:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="Automatic Bless and Aol and Removing Talents" version="1.0" author="GarQet" contact="http://otland.net/members/garqet.30076/" enabled="yes">
    <description>
    </description>
    <action itemid="8983" event="script"><![CDATA[
    function onUse(cid, item, fromPosition, itemEx, toPosition)
        local config = {
            talents = 4595,
            talents_hp = 25091,
            talents_mp = 25092,
            talents_dmg = 25093
        }
        doCreatureSay(cid, "Your talents have been reseted!", 20)
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_HEARTS)
        local hp = getPlayerStorageValue(cid, config.talents_hp)
        local mp = getPlayerStorageValue(cid, config.talents_mp)
        local dmg = getPlayerStorageValue(cid, config.talents_dmg)
        local note = getPlayerStorageValue(cid, config.talents)
        local x = getPlayerLevel(cid)
        local z = {}
        for i = 1, 50 do
            if x >= 50000 then
                x = x - 50000
            else
                table.insert(z, i - 1)
            end
        end
        local dodaj = 0
        if(z[1] <= 9) then
            dodaj = 2 * z[1]
        else
            dodaj = (2 * 9) + (z[1] - 9)
        end
        setPlayerStorageValue(cid, config.talents_hp, 0)
        setPlayerStorageValue(cid, config.talents_mp, 0)
        setPlayerStorageValue(cid, config.talents_dmg, 0)
        setPlayerStorageValue(cid, config.talents, dodaj + 1)   
        doRemoveItem(item.uid, 1)
        return true
    end
    ]]></action>
    <action itemid="8977" event="script"><![CDATA[
    local function doPlayerAddAutoBless(cid, amount)
        if(isPlayer(cid)) then
            if(getPlayerStorageValue(cid, 250) == -1) then
                setPlayerStorageValue(cid, 250, 0)
            end
            setPlayerStorageValue(cid, 250, getPlayerStorageValue(cid, 250) + amount)
            if(getPlayerStorageValue(cid, 250) < -1) then
                setPlayerStorageValue(cid, 250, 0)
            end
        end
    end
    function onUse(cid, item, fromPosition, itemEx, toPosition)
        if(getPlayerLevel(cid) < 100) then
            doPlayerSendCancel(cid, "You level is too low, you need atleast min 150k level.")
            return true
        end
        doCreatureSay(cid, "Automatic Bless and Aol has been activated for 30 days!", 20)
        doSendMagicEffect(getCreaturePosition(cid), 49)
        doPlayerAddAutoBless(cid, 30)
        doPlayerAddItem(cid, 2173, 1)
        for i = 1, 5 do
            if(not getPlayerBlessing(cid, i)) then
                doPlayerAddBlessing(cid, i)
            end
        end
        doRemoveItem(item.uid, 1)
        return true
    end
    ]]></action>
    <event type="login" name="Bless_Aol" event="script"><![CDATA[
    local function getPlayerAutoBless(cid)
        if(isPlayer(cid)) then
            return getPlayerStorageValue(cid, 250)
        end
    end
    function onLogin(cid)
        if(getPlayerAutoBless(cid) >= 1) then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have ".. getPlayerAutoBless(cid) .." days of auto bless and aol equip.")
            doCreatureSay(cid, "Automatically blessed and amulet of loss equiped!", 20)
            if getPlayerSlotItem(cid, CONST_SLOT_NECKLACE).itemid ~= 2173 then
                doPlayerAddItem(cid, 2173, 1)
            end
            for i = 1, 5 do
                if(not getPlayerBlessing(cid, i)) then
                    doPlayerAddBlessing(cid, i)
                end
            end
            doSendMagicEffect(getCreaturePosition(cid), 49)
        end       
        return true
    end
    ]]></event>
    <globalevent name="AutoBlessing" time="23:59" event="script"><![CDATA[
    function onTime(interval, lastExecution)
        db.executeQuery("UPDATE `player_storage` SET `key` = `key` - 1 WHERE `value` = 250;");
        return true
    end
    ]]></globalevent>
</mod>
Can Help me ?please
Post automatically merged:

I change to db.query Now its now is no problem I wait and check console all the time;)
 
Last edited:
yees I change from
db.executeQuery("UPDATE player_storage SET key = key - 1 WHERE value = 250;");

to

db.query("UPDATE player_storage SET key = key - 1 WHERE value = 250;");

and for this moment dont have errors
 
Guys what is that? Can any one explain for me ?because I not understand this script

Lua:
    <action itemid="8983" event="script"><![CDATA[
    function onUse(cid, item, fromPosition, itemEx, toPosition)
        local config = {
            talents = 4595,
            talents_hp = 25091,
            talents_mp = 25092,
            talents_dmg = 25093
        }
        doCreatureSay(cid, "Your talents have been reseted!", 20)
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_HEARTS)
        local hp = getPlayerStorageValue(cid, config.talents_hp)
        local mp = getPlayerStorageValue(cid, config.talents_mp)
        local dmg = getPlayerStorageValue(cid, config.talents_dmg)
        local note = getPlayerStorageValue(cid, config.talents)
        local x = getPlayerLevel(cid)
        local z = {}
        for i = 1, 50 do
            if x >= 50000 then
                x = x - 50000
            else
                table.insert(z, i - 1)
            end
        end
        local dodaj = 0
        if(z[1] <= 9) then
            dodaj = 2 * z[1]
        else
            dodaj = (2 * 9) + (z[1] - 9)
        end
        setPlayerStorageValue(cid, config.talents_hp, 0)
        setPlayerStorageValue(cid, config.talents_mp, 0)
        setPlayerStorageValue(cid, config.talents_dmg, 0)
        setPlayerStorageValue(cid, config.talents, dodaj + 1)   
        doRemoveItem(item.uid, 1)
        return true
    end
 
Back
Top