• 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 -=[TFS]=- 0.4 8.60 Error Script

samuel157

/root
Joined
Mar 19, 2010
Messages
447
Solutions
3
Reaction score
49
Location
São Paulo, Brazil
GitHub
Samuel10M
Lua:
local config = {

   levelscrit = 100,  --- leveis que terão
   storagecrit = 48903 -- storage que será verificado

}

function onUse(cid, item, fromPosition, itemEx, toPosition)
    local criticalLevel = getPlayerStorageZero(cid, config.storagecrit)
    local thingPos = getThingPos(cid)
    if criticalLevel < config.levelscrit then
        if doRemoveItem(item.uid, 1) then
            doCreatureSetStorage(cid, config.storagecrit, criticalLevel + 1)
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "[CRITICAL] Você evoluiu para o nível [".. (criticalLevel + 1) .."/".. config.levelscrit .."] de critical.")
            doSendAnimatedText(thingPos, "+CRITICAL", 31)
            doSendMagicEffect(thingPos, 16)
        end
    else
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "[CRITICAL] Você já atingiu o nível máximo de critical [100/100].")
        doSendMagicEffect(thingPos, CONST_ME_POFF)
    end
    return true
end

Lua:
<event type="statschange" name="critical" event="script" value="critical.lua"/>


function onStatsChange(cid, attacker, type, combat, value, target)
    if (type == STATSCHANGE_HEALTHLOSS or type == STATSCHANGE_MANALOSS) and isPlayer(attacker) then
        if (getPlayerStorageValue(attacker, 48904)*1) >= math.random (0,1000) then
            dano = math.ceil(value*(0.5)) -- aqui o multiplicador de dano
            doTargetCombatHealth(attacker, cid, combat, -dano, -dano, 20) -- aqui é o valor que vai dar a mais de dano. no caso esta 20
            doSendAnimatedText(getCreaturePos(attacker), "Critical!", 100)
        end
    end
    return true
end

Lua:
[23/07/2023 05:41:14] [Error - Action Interface]
[23/07/2023 05:41:14] data/actions/scripts/atkboost.lua:onUse
[23/07/2023 05:41:14] Description:
[23/07/2023 05:41:14] data/actions/scripts/atkboost.lua:9: attempt to call global 'getPlayerStorageZero' (a nil value)
[23/07/2023 05:41:14] stack traceback:
[23/07/2023 05:41:14]     data/actions/scripts/atkboost.lua:9: in function <data/actions/scripts/atkboost.lua:8>
 
Change

Lua:
local criticalLevel = getPlayerStorageZero(cid, config.storagecrit)
To
Lua:
local criticalLevel = getPlayerStorageValue(cid, config.storagecrit)
 
Solution
Back
Top