hiwyn
Member
- Joined
- Aug 30, 2021
- Messages
- 78
- Reaction score
- 8
People are using macro/bots to fishing in my server and that's is because its boring as fuck...
To avoid it i would like to make fishing action automatic, i mean:
how to do this?
To avoid it i would like to make fishing action automatic, i mean:
- u click to fish
- it still fishing forever until u walk
how to do this?
Code:
local config = {
waters = {4614, 4615, 4616, 4617, 4618, 4619, 4620, 4621, 4622, 4623, 4624, 4625, 4665, 4666, 4820, 4821, 4822, 4823, 4824, 4825},
fishable = {4608, 4609, 4610, 4611, 4612, 4613, 7236},
spawning = {4614, 4615, 4616, 4617, 4618, 4619},
holes = {7236},
baitCount = 1,
chance = 10
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
local playerPosition = getCreaturePosition(cid)
if getTileInfo(playerPosition).protection then
doSendMagicEffect(playerPosition, CONST_ME_POFF)
doPlayerSendCancel(cid, "You can not fish from a protection zone.")
return true
end
if(isInArray(config.waters, itemEx.itemid)) then
if(isInArray(config.spawning, itemEx.itemid)) then
doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
end
doSendMagicEffect(toPosition, CONST_ME_LOSEENERGY)
return true
end
if(not isInArray(config.fishable, itemEx.itemid)) then
return false
end
if getPlayerLevel(cid) < 8 then
doSendMagicEffect(getPlayerPosition(cid), 2)
doPlayerPopupFYI(cid, 'You need at least level 8 to fish!')
return false
end
local position, tries, myfisning = getThingPosition(cid), 0, getPlayerSkill(cid, SKILL_FISHING)
config.allowFromPz = config.allowFromPz or not getTileInfo(position).protection
if(getPlayerItemCount(cid, ITEM_WORM) >= config.baitCount) then
tries = 1
if(math.random(100) <= config.chance) then
if(doPlayerRemoveItem(cid, ITEM_WORM, config.baitCount)) then
tries = 2
doPlayerAddItem(cid, 2667, 1)
end
end
elseif(getPlayerItemCount(cid, 10224) >= 1) then
tries = 1
if(math.random(100) <= config.chance) then
tries = 2
doPlayerAddItem(cid, 2667, 1)
end
end
if(tries > 1) then
doPlayerAddSkillTry(cid, SKILL_FISHING, tries)
if(not isInArray(config.holes, itemEx.itemid)) then
doTransformItem(itemEx.uid, itemEx.itemid + 6)
else
doTransformItem(itemEx.uid, itemEx.itemid + 1)
end
doDecayItem(itemEx.uid)
elseif(tries > 0) then
-- no skill on fail
-- doPlayerAddSkillTry(cid, SKILL_FISHING, 1)
end
doSendMagicEffect(toPosition, CONST_ME_LOSEENERGY)
return true
end