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

Task System TFS 0.4 - Dziwny błąd

rafi47

New Member
Joined
May 1, 2013
Messages
8
Reaction score
0
Mam pewien problem z task system

Lua:
[5/12/2020 19:9:20] [Error - CreatureScript Interface]
[5/12/2020 19:9:20] data/creaturescripts/scripts/killinginthenameof3.lua:onKill
[5/12/2020 19:9:20] Description:
[5/12/2020 19:9:20] data/creaturescripts/scripts/killinginthenameof3.lua:36: attempt to compare string with number
[5/12/2020 19:9:20] stack traceback:
[5/12/2020 19:9:20]     data/creaturescripts/scripts/killinginthenameof3.lua:36: in function <data/creaturescripts/scripts/killinginthenameof3.lua:23>


Potwór nie umiera nawet gdy posiada 0HP oraz wywala ten błąd co wyżej.

Code:
local questCreatures =
{
    ["demonic dragon"] = {questStarted = 1560, questStorage = 65050, creatureStorage = 15063, killsRequired = 1500, raceName = "Demonic Dragon"},
  
    ["minishabaal"] = {questStarted = 1561, questStorage = 65051, creatureStorage = 15064, killsRequired = 1500, raceName = "Minishabaal"},

    ["sea king"] = {questStarted = 1562, questStorage = 65052, creatureStorage = 15065, killsRequired = 1500, raceName = "Sea King"},

    ["ghastly dragon"] = {questStarted = 1563, questStorage = 65053, creatureStorage = 15066, killsRequired = 1500, raceName = "Ghastly Dragon"},

    ["azerus"] = {questStarted = 1564, questStorage = 65054, creatureStorage = 15067, killsRequired = 1500, raceName = "Azerus"},

    ["ots king"] = {questStarted = 1565, questStorage = 65055, creatureStorage = 15068, killsRequired = 1500, raceName = "OTS King"},

    ["evil demon"] = {questStarted = 1566, questStorage = 65056, creatureStorage = 15069, killsRequired = 1500, raceName = "Evil Demon"},

    ["sashami"] = {questStarted = 1567, questStorage = 65057, creatureStorage = 15070, killsRequired = 1500, raceName = "Sashami"}

}

local msgType = MESSAGE_STATUS_CONSOLE_ORANGE

function onKill(cid, target, lastHit)

local creature = questCreatures[getCreatureName(target):lower()]

    if creature then
        if isPlayer(target) or isSummon(target) then return true end

        if getCreatureStorage(cid, creature.questStarted) > 0 then
            if getCreatureStorage(cid, creature.questStorage) < creature.killsRequired then
                if getCreatureStorage(cid, creature.questStorage) < 0 then
                    doCreatureSetStorage(cid, creature.questStorage, 0)
                end

                if getCreatureStorage(cid, creature.creatureStorage) < 0 then
                    doCreatureSetStorage(cid, creature.creatureStorage, 0)
                end
                doCreatureSetStorage(cid, creature.questStorage, getCreatureStorage(cid, creature.questStorage) + 1)
                doCreatureSetStorage(cid, creature.creatureStorage, getCreatureStorage(cid, creature.creatureStorage) + 1)
                doPlayerSendTextMessage(cid, msgType, getCreatureStorage(cid, creature.creatureStorage) .. " " .. getCreatureName(target) .. " defeated. Total [" .. getCreatureStorage(cid, creature.questStorage) .. "/" .. creature.killsRequired .. "] " .. creature.raceName .. ".")
            end
        end
    end
    return true
end


Czy to możliwe że przez to że mam 2 task systemy tak się dzieje? bo mam na komendę i u npc.
 
Last edited:
Czy to możliwe że przez to że mam 2 task systemy tak się dzieje? bo mam na komendę i u npc.
Nie, problemem u ciebie jest "corrupted storage"

Ja byś sobie wypisywał printem jakie jest storage, to pewnie wyjdą znaczki, w bazie danych sobie sprawdź jak to się zapisało.

Chyba, że jakiś twój skrypt zmienia te storage na jakiś text.

Problemem jest getCreatureStorage/getPlayerStorageValue.

Pokaż jak wyglądają u ciebie ta funkcja w luascript.cpp

Jeżeli nie masz dostępu, to możesz kombinować sobie w samym LUA, i podwójnie storage zapisywać.

Jeżeli jedno jest corrupted to bierze z drugiego. I nadpisuje pierwsze.

Sprawdzaj sobie warunkiem if toNumber(storage) jeżeli wyjdzie false to znaczy, że aktualnie zapisane jest jako string, więc jeżeli nigdzie nie zmieniasz tego na text to oznacza, że te storage jest corrupted.
 
Back
Top