Hi, I want my fishing script to Broadcast in my Fishing channel when a player catches a monster
This is my fishing script:
And when a player catches a monster, I get this error code:
I don't know what I need to do to change it?
This is my fishing script:
Code:
local config = {
waterIds = {493, 4608, 4609, 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 = {
[{200,100}] = {name = "Angry Water Elemental", chance = 262500, storage = 36000},
[{400,100}] = {name = "Ophion Slave", chance = 52500, storage = 36001},
[{600,100}] = {name = "Hydras", chance = 8750, storage = 36002},
[{1000,110}] = {name = "Hydrilica", chance = 4375, storage = 36003},
[{1500,110}] = {name = "Blood Crab", chance = 1225, storage = 36004},
[{2000,115}] = {name = "Mature Blood Crab", chance = 875, storage = 36005},
[{2000,115}] = {name = "Giant Squid", chance = 437.5, storage = 36006},
[{2500,120}] = {name = "Ophion", chance = 35, storage = 36007},
[{3000,130}] = {name = "Megladon", chance = 17.5, storage = 36008},
[{3000,130}] = {name = "Immature Sharkeater", chance = 8.75, storage = 36009},
[{4000,135}] = {name = "The Lurker", chance = 1.75, storage = 36010},
[{5000,140}] = {name = "Aquafilus", chance = 0.175, storage = 360011},
[{6000,145}] = {name = "Sharkeater", chance = 0.00175, storage = 36012}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if not isInArray(config.waterIds, itemEx.itemid) then
return false
end
if getTilePzInfo(getPlayerPosition(cid)) then
return doPlayerSendCancel(cid, "You can't use this in pz.")
end
if 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
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)
doPlayerSendChannelMessage(cid, getPlayerName(cid), "%s has caught a".. getCreatureName(target) ..", level ".. getPlayerLevel(cid) ..".", TALKTYPE_CHANNEL_W, 12)
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_LOSEENERGY)
end
end
And when a player catches a monster, I get this error code:
Code:
[25/02/2015 19:23:16] [Error - Action Interface]
[25/02/2015 19:23:16] data/actions/scripts/tools/upgfishing.lua:onUse
[25/02/2015 19:23:16] Description:
[25/02/2015 19:23:16] (luaGetCreatureName) Creature not found
[25/02/2015 19:23:16] [Error - Action Interface]
[25/02/2015 19:23:16] data/actions/scripts/tools/upgfishing.lua:onUse
[25/02/2015 19:23:16] Description:
[25/02/2015 19:23:16] data/actions/scripts/tools/upgfishing.lua:37: attempt to concatenate a boolean value
[25/02/2015 19:23:17] stack traceback:
[25/02/2015 19:23:17] data/actions/scripts/tools/upgfishing.lua:37: in function <data/actions/scripts/tools/upgfishing.lua:23>
I don't know what I need to do to change it?
Last edited: