elnelson
Lunaria World Dev
Hello, otlanders i have this script and its working good, but i got a message on console and i'd love to fix.
script:
and this is the error in console:
im using tfs 0.4 rev 3777
script:
Lua:
local outfit = {{[1]= {lookType = 223 , lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0, lookAddons = 0},
[2]={lookType = 222 , lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0, lookAddons = 0}},
TEMPO = 5000}
local waterIDs = {493, 4608, 4609, 4610, 4611, 4612, 4613, 4614, 4615, 4616, 4617, 4618, 4619, 4620, 4621, 4622, 4623, 4624, 4625,4665,4664,4666}
local config = {
{level = {10,19}, fishes = {2667}, maxFish = 1, chance = 50}, -- {level = {Do level, Até o level}, fishes = {id dos peixes que podem vir}, maxFish = quantidade máxima de peixes que podem vir, chance = chance em %
{level = {20,29}, fishes = {2667, 2669, 2148}, maxFish = 1, chance = 60},
{level = {30,39}, fishes = {2667, 2669}, maxFish = 2, chance = 70},
{level = {40,49}, fishes = {2667, 2669, 2668}, maxFish = 3, chance = 80},
{level = {50,59}, fishes = {2667, 2669, 2668}, maxFish = 4, chance = 80},
{level = {60,69}, fishes = {2667, 2669, 2668, 2670}, maxFish = 5, chance = 80},
{level = {70,79}, fishes = {2667, 2669, 2668, 2670}, maxFish = 6, chance = 80},
{level = {80,math.huge}, fishes = {2667, 2669, 2668, 2670, 2152, 2157}, maxFish = 8, chance = 90},
soul = 0
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
local worms = math.random(1, 3)
if getPlayerStorageValue(cid, 381921) < os.time() then
if isInArray(waterIDs, itemEx.itemid) then
if getPlayerItemCount(cid, 3976) >= worms then
doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE, " [Status]: Fishing...")
doPlayerRemoveItem(cid, 3976, worms)
doSendMagicEffect(toPosition, 1)
local times = {3900, 4100, 4300, 4500, 4700, 4900, 5000}
for i = 1, #times do
addEvent(doSendMagicEffect, times[i], toPosition, 1)
end
addEvent(function()
local random = math.random(1, 100)
for _, fishing in pairs(config) do
if random <= fishing.chance then
if getPlayerSkillLevel(cid, 6) >= fishing.level[1] and getPlayerSkillLevel(cid, 6) <= fishing.level[2] then
doPlayerAddItem(cid, fishing.fishes[math.random(1, #fishing.fishes)], math.random(1, fishing.maxFish))
doPlayerAddSkillTry(cid, 6, 6)
doSendMagicEffect(toPosition, 53)
doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE, " [Status]: Fishing succesful.")
break
end
else
doSendMagicEffect(toPosition, 25)
doPlayerAddSkillTry(cid, 6, 1)
doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE, " [Status]: Fishing failed.")
end
end
end, 5000)
doPlayerSetStorageValue(cid, 381921, os.time() + 5)
mayNotMove(cid,true)
addEvent(mayNotMove, outfit.TEMPO, cid, false)
else
doPlayerSendCancel(cid, "You need more worms.")
end
else
doPlayerSendCancel(cid, "You can't fish here")
end
else
doPlayerSendCancel(cid, "You're already fishing!")
end
return true
end
and this is the error in console:
Code:
[17:20:28.996] [Error - Action Interface]
[17:20:28.999] In a timer event called from:
[17:20:29.002] data/actions/scripts/craft/fishing.lua:onUse
[17:20:29.004] Description:
[17:20:29.006] data/actions/scripts/craft/fishing.lua:35: attempt to index local 'fishing' (a number value)
[17:20:29.008] stack traceback:
[17:20:29.013] data/actions/scripts/craft/fishing.lua:35: in function <data/actions/scripts/craft/fishing.lua:32>
im using tfs 0.4 rev 3777