Hi, I have an issue with a script i tried to create on monster lava fishing. I am using the same item Id as water fishing because I have seen this done on other servers and worked.
Fishing Script:
I don't know why it isn't doing anything.. It just keeps saying 'You cannot use this object'.
Fishing Script:
Code:
local config = {
lavaIds = {598, 600, 601},
rateSkill = 0.5,
allowFromPz = false,
useWorms = false
}
local t = {
targetId = 0,
SpeakClasses = TALKTYPE_CHANNEL_W,
message = '',
channel = 12
}
local v = {
[{500,115}] = {name = "Blazing Soul", chance = 80000, storage = 36014}
}
function reallyLongReturn(cid, config)
return 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)))
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
t.targetId = getPlayerGUID(cid)
if not isInArray(config.lavaIds, itemEx.itemid) then
return false
end
if getTilePzInfo(getPlayerPosition(cid)) then
doPlayerSendCancel(cid, "You can't fish inside a protection zone.")
return false
end
if itemEx.itemid ~= 598 and reallyLongReturn(cid, config) 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
t.message = getPlayerName(cid).." has caught a ".. k.name .." lava fishing. Level ".. getPlayerLevel(cid) .."."
doSummonCreature(k.name, getThingPos(cid))
doSendMagicEffect(getThingPos(cid), 4)
setPlayerStorageValue(cid, k.storage, getPlayerStorageValue(cid, k.storage) +1)
for _, pid in ipairs(getPlayersOnline()) do
doPlayerSendChannelMessage(pid, t.targetId, t.message, t.SpeakClasses, t.channel)
end
end
end
if k.broadcast then
doBroadcastMessage(bsMessage:format(getCreatureName(cid), k.name))
break
end
end
end
doPlayerAddSkillTry(cid, SKILL_FISHING, 1)
doSendMagicEffect(toPosition, CONST_ME_LOSEENERGY)
end
I don't know why it isn't doing anything.. It just keeps saying 'You cannot use this object'.