gmstrikker
Well-Known Member
- Joined
- Jul 30, 2014
- Messages
- 458
- Solutions
- 1
- Reaction score
- 50
It's my fishing system, fishs change if u have more lvl's but it's dont work so fine
Look, when i use fishing rod on water, dont have effect on water and dont give me fishs...
Look the logs and script guys
console when i use fishing rod (first only remove worms, latter no remove and dont do nothign, latter back to remove worms, but dont do effect on water and dont give fishs)
fishing.lua
Look, when i use fishing rod on water, dont have effect on water and dont give me fishs...
Look the logs and script guys
console when i use fishing rod (first only remove worms, latter no remove and dont do nothign, latter back to remove worms, but dont do effect on water and dont give fishs)
fishing.lua
Code:
local items = {
[1] = {item = 2670, desc = "itemname"},
[2] = {item = 2667, desc = "itemname"},
[3] = {item = 7159, desc = "itemname"},
[4] = {item = 7158, desc = "itemname"},
[5] = {item = 2669, desc = "itemname"},
[6] = {item = 7963, desc = "itemname"}
}
local skillLevels = {
{20, 40}, -- 1
{40, 60}, -- 2
{60, 80}, -- 3
{80, 100}, -- 4
{100, 130}, -- 5
{130, 255} -- 6
}
local chance = 30 --30% Chance to get item
local fishingSkill = 0
local fishable = {4614, 4615, 4616, 4617, 4618, 4619, 4620, 4621, 4622, 4623, 4624, 4625, 4665, 4666, 4820, 4821, 4822, 4823, 4824, 4825}
local VIP_WORM = 10224
function onUse(cid, item, fromPosition, itemEx, toPosition)
print(itemEx.itemid)
if isInArray(fishable, itemEx.itemid) then
print("fishing rod works")
local hasVipItem = getPlayerItemCount(cid, VIP_WORM) >= 1 and true or false
local hasWorms = getPlayerItemCount(cid, ITEM_WORM) >= 1 and true or false
if (hasVipItem or hasWorms) then
print("you have the required item to fish")
if(hasWorms) then
doPlayerRemoveItem(cid, ITEM_WORM, 1)
print("and they are regular worms")
end
else
print("you don't have the required item to fish")
doPlayerSendCancel(cid, "You must have worms to fish.")
return false
end
fishingSkill = getPlayerSkillLevel(cid, SKILL_FISH)
print("fishing skill "..fishingSkill)
if math.random(1, 100) <= chance then
for i = 1, #skillLevels do
if fishingSkill >= skillLevels[i][1] and fishingSkill < skillLevels[i][2] then
print("min "..skillLevels[i][1].." max "..skillLevels[i][2] )
ITEM = items[math.random(1, i)]
print("ITEM "..ITEM)
end
end
end
if (not ITEM) then
print("no item")
return true
end
doPlayerAddItem(cid, ITEM.item, 1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have caught a "..ITEM.desc..".")
doSendMagicEffect(toPosition, 1)
end
return true
end