Please I need some help with a fishing script! the error is that at the time of fishing the monster if it is called but the text broadcast does not appear help me please! here I leave the script
local config = {
waterIds = {493, 4608, 4609, 4664, 4610, 4611, 4612, 4613, 4614, 4615, 4616, 4617, 4618, 4619, 4620, 4621, 4622, 4623, 4624, 4625},
rateSkill = 0.25,
allowFromPz = false,
useWorms = false
}
local v = {
[{10,100}] = {name = "water Elemental", chance = 300000, storage = 36000},
[{200,105}] = {name = "hydros", chance = 160000, storage = 36001},
[{500,110}] = {name = "tyria", chance = 120000, storage = 36002},
[{100,110}] = {name = "doctor octagonapus", chance = 100000, storage = 36003},
[{200,115}] = {name = "kingler", chance = 25600, storage = 36004},
[{1000,120}] = {name = "triton", chance = 12800, storage = 36005},
[{1000,120}] = {name = "nessi", chance = 12800, storage = 36006},
[{2000,120}] = {name = "jaws", chance = 6400, storage = 36007},
[{3000,125}] = {name = "aegaeus", chance = 5200, storage = 36008},
[{3000,130}] = {name = "aekre", chance = 3600, storage = 36009},
[{4000,135}] = {name = "kraken", chance = 1800, storage = 36010},
[{5000,140}] = {name = "blastoise", chance = 1200, storage = 36011},
[{6000,150}] = {name = "lady adshara", chance = 800, storage = 36012},
[{7000,175}] = {name = "leviathan", chance = 560, storage = 36013}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if not isInArray(config.waterIds, itemEx.itemid) then
return false
end
if (config.allowFromPz or not getTileInfo(getThingPos(cid)).protection) and itemEx.itemid ~= 493 and math.random((100 + (getPlayerSkill(cid, SKILL_FISHING) / 60))) < getPlayerSkill(cid, SKILL_FISHING) and (not config.useWorms or (getPlayerItemCount(cid, ITEM_WORM) > 0 and doPlayerRemoveItem(cid, ITEM_WORM, 1))) then
local bsMessage = "%s have caught %s"
for i, k in pairs(v) do
if getPlayerLevel(cid) >= i[1] and getPlayerSkillLevel(cid, SKILL_FISHING) >= i[2] then
local c = math.random(200000000)
if c <= k.chance then
doSummonCreature(k.name, getThingPos(cid))
setPlayerStorageValue(cid, k.storage, getPlayerStorageValue(cid, k.storage) +1)
end
end
if k.broadcast then
doBroadcastMessage(bsMessage:format(getCreatureName(cid), k.name))
break
end
end
end
if doPlayerAddSkillTry(cid, SKILL_FISHING, 1) then
return doSendMagicEffect(toPosition, CONST_ME_WATERSPLASH)
end
end
local config = {
waterIds = {493, 4608, 4609, 4664, 4610, 4611, 4612, 4613, 4614, 4615, 4616, 4617, 4618, 4619, 4620, 4621, 4622, 4623, 4624, 4625},
rateSkill = 0.25,
allowFromPz = false,
useWorms = false
}
local v = {
[{10,100}] = {name = "water Elemental", chance = 300000, storage = 36000},
[{200,105}] = {name = "hydros", chance = 160000, storage = 36001},
[{500,110}] = {name = "tyria", chance = 120000, storage = 36002},
[{100,110}] = {name = "doctor octagonapus", chance = 100000, storage = 36003},
[{200,115}] = {name = "kingler", chance = 25600, storage = 36004},
[{1000,120}] = {name = "triton", chance = 12800, storage = 36005},
[{1000,120}] = {name = "nessi", chance = 12800, storage = 36006},
[{2000,120}] = {name = "jaws", chance = 6400, storage = 36007},
[{3000,125}] = {name = "aegaeus", chance = 5200, storage = 36008},
[{3000,130}] = {name = "aekre", chance = 3600, storage = 36009},
[{4000,135}] = {name = "kraken", chance = 1800, storage = 36010},
[{5000,140}] = {name = "blastoise", chance = 1200, storage = 36011},
[{6000,150}] = {name = "lady adshara", chance = 800, storage = 36012},
[{7000,175}] = {name = "leviathan", chance = 560, storage = 36013}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if not isInArray(config.waterIds, itemEx.itemid) then
return false
end
if (config.allowFromPz or not getTileInfo(getThingPos(cid)).protection) and itemEx.itemid ~= 493 and math.random((100 + (getPlayerSkill(cid, SKILL_FISHING) / 60))) < getPlayerSkill(cid, SKILL_FISHING) and (not config.useWorms or (getPlayerItemCount(cid, ITEM_WORM) > 0 and doPlayerRemoveItem(cid, ITEM_WORM, 1))) then
local bsMessage = "%s have caught %s"
for i, k in pairs(v) do
if getPlayerLevel(cid) >= i[1] and getPlayerSkillLevel(cid, SKILL_FISHING) >= i[2] then
local c = math.random(200000000)
if c <= k.chance then
doSummonCreature(k.name, getThingPos(cid))
setPlayerStorageValue(cid, k.storage, getPlayerStorageValue(cid, k.storage) +1)
end
end
if k.broadcast then
doBroadcastMessage(bsMessage:format(getCreatureName(cid), k.name))
break
end
end
end
if doPlayerAddSkillTry(cid, SKILL_FISHING, 1) then
return doSendMagicEffect(toPosition, CONST_ME_WATERSPLASH)
end
end