• 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 Help Point system

nefinoo

Carnage.flv
Joined
Sep 11, 2010
Messages
549
Solutions
1
Reaction score
58
Location
Lo Mochis, Sinaloa
Code:
Lua Script Error: [Scripts Interface]
C:\Users\Nefi\OneDrive\Escritorio\forgottenserver-master\data\scripts\CUSTOMS NEFI\MonstersPoints.lua:callback
...rver-master\data\scripts\CUSTOMS NEFI\MonstersPoints.lua:16: attempt to compare number with nil
stack traceback:
        ...rver-master\data\scripts\CUSTOMS NEFI\MonstersPoints.lua:16: in function <...rver-master\data\scripts\CUSTOMS NEFI\MonstersPoints.lua:3>


Lua:
local CusMons = CreatureEvent("CusMons")

function CusMons.onKill(player, target)
   
local config = { -- Use missionStorage to link the monsters to each mission. It is set up this way so multiple missions can have the same monsters.
    [1] = {name = "Rat", amount = 1, missionStorage = 43000},
    [2] = {name = "Cave Rat", amount = 2, missionStorage = 43000},
    [3] = {name = "Troll", amount = 3, missionStorage = 43000}
}
        if target:isPlayer() or target:getMaster() then
            return true
        end
       
        for i = 1, #config do
            if target:getName() == config[i].name then
                if storage >= 0 and storage < maximo then
                    player:setStorageValue(config[i].missionStorage, player:getStorageValue(config[i].missionStorage) + config[i].amount)
                elseif storage == maximo then
                    player:sendTextMessage(MESSAGE_STATUS_WARNING, "Your monsters points are full, waste on the !store.")
                end
            end
        end
    return true
end

CusMons:register()
 
Solution
Lua:
if storage >= 0 and storage < maximo then
You haven't declared storage or maximo

example
Lua:
local storage = player:setStorageValue(config[i].missionStorage)
Lua:
if storage >= 0 and storage < maximo then
You haven't declared storage or maximo

example
Lua:
local storage = player:setStorageValue(config[i].missionStorage)
 
Solution
Back
Top