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

attempt to perform arithmetic on a boolean value

Natrov

New Member
Joined
Dec 14, 2013
Messages
72
Reaction score
2
Witam,
wskazałby mi ktoś gdzie w poniższym kodzie jest błąd?? :)

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    local tmp = math.random(1, 2)
    if(tmp == 1) then
        local percent = math.random(1, 8)
        local health = math.ceil(getCreatureMaxHealth(itemEx.uid) * percent / 100)
        setCreatureMaxHealth(itemEx.uid, getCreatureMaxHealth(itemEx.uid) + health)
        local mana = math.ceil(getCreatureMaxMana(itemEx.uid) * percent / 100)
        setCreatureMaxMana(itemEx.uid, getCreatureMaxMana(itemEx.uid) + mana)
        local formulaMagic = math.ceil(getPlayerRequiredMana(itemEx.uid, getPlayerMagLevel(itemEx.uid)) * (percent + 1) / 100)
        doPlayerAddSpentMana(itemEx.uid, formulaMagic, false)
        doPlayerSendTextMessage(itemEx.uid, MESSAGE_STATUS_CONSOLE_BLUE, "You gained +" .. percent .. "% health, mana and magic level.")
    elseif(tmp == 2) then
        local percent = math.random(1, 8)
        local formulaClub = math.floor(getPlayerRequiredSkillTries(itemEx.uid, SKILL_CLUB, getPlayerSkillLevel(itemEx.uid, SKILL_CLUB)) * (percent * 2) / 100)
        local formulaAxe = math.floor(getPlayerRequiredSkillTries(itemEx.uid, SKILL_AXE, getPlayerSkillLevel(itemEx.uid, SKILL_AXE)) * (percent * 2) / 100)
        local formulaSword = math.floor(getPlayerRequiredSkillTries(itemEx.uid, SKILL_SWORD, getPlayerSkillLevel(itemEx.uid, SKILL_SWORD)) * (percent * 2) / 100)
        doPlayerAddSkillTry(itemEx.uid, SKILL_CLUB, formulaClub, false)
        doPlayerAddSkillTry(itemEx.uid, SKILL_AXE, formulaAxe, false)
        doPlayerAddSkillTry(itemEx.uid, SKILL_SWORD, formulaSword, false)
        local formulaDistance = math.floor(getPlayerRequiredSkillTries(itemEx.uid, SKILL_DISTANCE, getPlayerSkillLevel(itemEx.uid, SKILL_DISTANCE)) * (percent * 2) / 100)
        doPlayerAddSkillTry(itemEx.uid, SKILL_DISTANCE, formulaDistance, false)
        local formulaShielding = math.floor(getPlayerRequiredSkillTries(itemEx.uid, SKILL_SHIELD, getPlayerSkillLevel(itemEx.uid, SKILL_SHIELD)) * (percent * 2) / 100)
        doPlayerAddSkillTry(itemEx.uid, SKILL_SHIELD, formulaShielding, false)
        doPlayerSendTextMessage(itemEx.uid, MESSAGE_STATUS_CONSOLE_BLUE, "You gained +" .. percent .. "% sword, axe, club, distance fighting and shielding.")
    end

    doSendMagicEffect(getThingPosition(itemEx.uid), CONST_ME_MAGIC_GREEN)
    doRemoveItem(item.uid)
    return true
end
Błąd:
Code:
[26/4/2014 13:43:52] [Error - Action Interface]
[26/4/2014 13:43:52] data/actions/scripts/flawless.lua:onUse
[26/4/2014 13:43:52] Description:
[26/4/2014 13:43:52] (luaGetPlayerSkillLevel) Player not found

[26/4/2014 13:43:52] [Error - Action Interface]
[26/4/2014 13:43:52] data/actions/scripts/flawless.lua:onUse
[26/4/2014 13:43:52] Description:
[26/4/2014 13:43:52] (luaGetPlayerRequiredSkillTries) Player not found

[26/4/2014 13:43:52] [Error - Action Interface]
[26/4/2014 13:43:52] data/actions/scripts/flawless.lua:onUse
[26/4/2014 13:43:52] Description:
[26/4/2014 13:43:52] data/actions/scripts/flawless.lua:14: attempt to perform arithmetic on a boolean value
[26/4/2014 13:43:52] stack traceback:
[26/4/2014 13:43:52]    data/actions/scripts/flawless.lua:14: in function <data/actions/scripts/flawless.lua:1>
 
Back
Top