Postado Junho 3, 2015 10 anos Galera, fui testar um script de minning system do WhiteWolf, dei uma pequena ajustada nele e me apareceu esse erro: attempt to call field: 'insert' (a nil value) o erro rola nessa parte do codigo: function getDrops(cid) for i= -1,getPlayerStorageValue(cid, config.storage) do if levels[i] then table.insert(Drops, levels[i]) end end return true end o script é o seguinte: terra = {8633} levels = { [-1] = 2146, ---- Small Sapphire [4] = 7759, --- Small Enchanted Sapphire [8] = 18418, --- Blue Crystal Splinter [12] = 18413, -- Blue Crystal Shard [17] = 2158, -- Blue Gem [22] = 12508, -- Magic Crystal [25] = 13195, -- Minor Blue Powder [35] = 13215, -- Medium Blue Powder [45] = 6551, -- Great Blue Powder [50] = 5905, -- Ultimate Blue Powder } local config = { storage = 19333, chance = 40, --- chance de achar um item ou não k = 2, --- constante de level.. quanto maior, mais fácil é upar. (a fórmula é level ao quadrado dividido pela constante) experience = 19334 } function onUse(cid, item, fromPosition, itemEx, toPosition) Drops = {} function getDrops(cid) for i= -1,getPlayerStorageValue(cid, config.storage) do if levels[i] then table.insert(Drops, levels[i]) end end return true end if isInArray(terra, itemEx.itemid) then getDrops(cid) setPlayerStorageValue(cid, config.experience, getPlayerStorageValue(cid, config.experience)+1) local experience = getPlayerStorageValue(cid, config.experience) if experience >= (8+(getPlayerStorageValue(cid, config.storage)^2))/config.k then setPlayerStorageValue(cid, config.storage, getPlayerStorageValue(cid, config.storage)+1) doPlayerSendTextMessage(cid, 27, "Congratulations, you have leveled! Your currect level is "..getPlayerStorageValue(cid, config.storage) ..".") if getPlayerStorageValue(cid, config.storage) == 50 then doPlayerSendTextMessage(cid, 20, "For reaching level "..getPlayerStorageValue(cid, config.storage) .." you have been awarded with Mining Helmet.") doPlayerAddItem(cid, 7497, 1, true) end end if config.chance >= math.random(1,100) then if #Drops >= 1 then local item = Drops[math.random(1,#Drops)] doPlayerSendTextMessage(cid, 27, "You have found a "..getItemNameById(item)..".") doPlayerAddItem(cid, item, 1, true) end doSendMagicEffect(toPosition, 3) else doSendMagicEffect(toPosition, 2) return true end elseif itemEx.itemid == item.itemid then doPlayerSendTextMessage(cid, 27, "You're currenctly level "..getPlayerStorageValue(cid, config.storage)..".") else return false end return true end
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.