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

Lua Error "attempt to compare string with number"

ligus

New Member
Joined
Apr 26, 2010
Messages
253
Reaction score
0
Hello, I have this creaturescript from Killing In The Name Of Quest:

Code:
function onKill(cid, target, lastHit)
    local started = getPlayerStartedTasks(cid)
    if isPlayer(target) or isSummon(target) then return true end
    if started and #started > 0 then
        for _, id in ipairs(started) do
            if isInArray(tasks[id].creatures, getCreatureName(target):lower()) then
                if getCreatureStorage(cid, KILLSSTORAGE_BASE + id) < 0 then
                    doCreatureSetStorage(cid, KILLSSTORAGE_BASE + id, 0)
                end
                if getCreatureStorage(cid, KILLSSTORAGE_BASE + id) < tasks[id].killsRequired then
                    doCreatureSetStorage(cid, KILLSSTORAGE_BASE + id, getCreatureStorage(cid, KILLSSTORAGE_BASE + id) + 1)
                    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, getCreatureStorage(cid, KILLSSTORAGE_BASE + id) .. "/" .. tasks[id].killsRequired .. " " .. tasks[id].raceName .. " already killed.")
                end
            end
        end
    end
    return true
end

and a lot of errors:

Code:
[4:10:46.947] [Error - CreatureScript Interface]
data/creaturescripts/scripts/killinginthenameof.lua:onKill
Description:
data/creaturescripts/scripts/killinginthenameof.lua:8: attempt to compare string with number
stack traceback:
data/creaturescripts/scripts/killinginthenameof.lua:8: in function <data/creaturescripts/scripts/killinginthenameof.lua:1>

Does anyone know whats that? I don't understand why script wants to compare string with number o_O, does anyone know how to fix it or maybe do something like this: if string then return false?
 
I didn't read the script, but the some old tfs releases (0.3, 0.4) had this problem in sources when you do math operations.
 
A lot of errors in other script...
[Error - CreatureScript Interface]
Code:
data/creaturescripts/scripts/dire.lua:onDirection
Description:
data/creaturescripts/scripts/dire.lua:27: attempt to compare string with number
stack traceback:
data/creaturescripts/scripts/dire.lua:27: in function <data/creaturescripts/scripts/dire.lua:16>
line 16:
Code:
function onDirection(cid, old, current)


line 27:
Code:
if(getPlayerStorageValue(cid, 19455) < 0) then


Next time, problem with checking storage value. Not always but often o_O
Why?
 
Back
Top