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

TFS 1.X+ Lua Script Error [C]: in function 'debugPrint'

MaR0

Banned User
Joined
Apr 16, 2018
Messages
272
Solutions
3
Reaction score
29
I am a novice in TFS 1.2 10.98 but do not know what the error is? It works well in my TFS 0.4 here is the error code at console :-
Code:
Lua Script Error: [Action Interface]
data/actions/scripts/exp.lua:onUse
LuaScriptInterface::luaDebugPrint(). Deprecated function.
stack traceback:
        [C]: in function 'debugPrint'
        data/lib/compat/compat.lua:418: in function 'doSendAnimatedText'
        data/actions/scripts/exp.lua:6: in function <data/actions/scripts/exp.lua:1>
HERE'S my script
Code:
<action itemid="5957" script="exp.lua" />
LUA:
function onUse(cid, item, frompos, item2, topos)
if item.itemid == 5957 then
if getPlayerLevel(cid)  <= 50 then
getPlayerStorageValue(cid, 11551)
doSendAnimatedText(getPlayerPosition(cid), "Free Exp wiii!", TEXTCOLOR_RED)
doPlayerAddExp(cid, 80000000000)
setPlayerStorageValue(cid, 11551, 1)
doRemoveItem(item.uid, 1)
else
doPlayerSendTextMessage(cid, 4, "Stop cheating, you are too high to use it...")
doRemoveItem(item.uid, 1)
end
else
end
return 1
end
 
Solution
You are using TFS 1.x, make use of the OOP in LUA.
Code:
local config = {
    maxLevel = 50,
    expGain = 80000000000,
    storage = 11551
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if player:getLevel() >= config.maxLevel then
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Stop cheating, you are too high to use it...")
        return true
    end

    if player:getStorageValue(config.storage) == 1 then
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You have already used this item once.")
        return true
    end

    player:addExperience(config.expGain, true)
    player:setStorageValue(config.storage, 1)
    player:say("Free Exp wiii!", TALKTYPE_MONSTER_SAY)...
You are using TFS 1.x, make use of the OOP in LUA.
Code:
local config = {
    maxLevel = 50,
    expGain = 80000000000,
    storage = 11551
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if player:getLevel() >= config.maxLevel then
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Stop cheating, you are too high to use it...")
        return true
    end

    if player:getStorageValue(config.storage) == 1 then
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You have already used this item once.")
        return true
    end

    player:addExperience(config.expGain, true)
    player:setStorageValue(config.storage, 1)
    player:say("Free Exp wiii!", TALKTYPE_MONSTER_SAY)
    item:remove(1)
    return true
end
 
Solution
You are using TFS 1.x, make use of the OOP in LUA.
Code:
local config = {
    maxLevel = 50,
    expGain = 80000000000,
    storage = 11551
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if player:getLevel() >= config.maxLevel then
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Stop cheating, you are too high to use it...")
        return true
    end

    if player:getStorageValue(config.storage) == 1 then
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You have already used this item once.")
        return true
    end

    player:addExperience(config.expGain, true)
    player:setStorageValue(config.storage, 1)
    player:say("Free Exp wiii!", TALKTYPE_MONSTER_SAY)
    item:remove(1)
    return true
end
Oh i have learned from your statement it's really good thanks in advance sir :) appreciated
Regards,
 
Back
Top