local config = {
rate = 10, -- Speed at which the skill will progress
cooldown = 2, -- Time in seconds of character exhaustion
}
function onUse(cid, item, frompos, item2, topos)
local waterIds = { 493, 4608, 4609, 4610, 4611, 4612, 4613, 4614, 4615, 4616, 4617, 4618, 4619, 4620, 4621, 4622,
4623, 4624, 4625, 7236, 10499, 15401, 15402 }
local skill, amount, storage = getPlayerSkill(cid, 6), 1, 6873565011
local now = os.time()
local check = (now - getPlayerStorageValue(cid, storage))
if not isInArray(waterIds, item2.itemid) then
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You can only use the fishing rod in the water.")
return true
end
if check < 0 then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, "You are exhausted.")
return true
end
if ((math.random(1, 100000)) <= (skill * 500)) then
if skill > 50 then
amount = math.random(1, ((skill / 10) - 3))
end
doPlayerAddItem(cid, 2667, amount)
if amount > 7 then
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Congratulations, you've caught more than 7 fish!")
end
end
doSendMagicEffect(topos, CONST_ME_LOSEENERGY)
doPlayerAddSkillTry(cid, LEVEL_SKILL_FISHING, (1 * config.rate))
setPlayerStorageValue(cid, storage, (now + config.cooldown))
return true
end