gmstrikker
Well-Known Member
- Joined
- Jul 30, 2014
- Messages
- 458
- Solutions
- 1
- Reaction score
- 50
It's cod is from Itutorial, he say my code is so bad, and make it, but this code dont work, dont give me erros, dont give effect on water on use, dont do nothing!!!
Why?
Why?
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 = {
{1, 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)
if isInArray(fishable, itemEx.itemid) then
if (not getPlayerItemCount(cid, VIP_WORM) > 0 or (not doPlayerRemoveItem(cid, ITEM_WORM, 1))) then
doPlayerSendCancel(cid, "You must have worms to fish.")
return false
end
fishingSkill = getPlayerSkillLevel(cid, SKILL_FISH)
if math.random(1, 100) <= chance then
for i = 1, #skillLevels do
if fishingSkill >= skillLevels[i][1] and fishingSkill < skillLevels[i][2] then
ITEM = items[math.random(1, i)]
end
end
end
if (not ITEM) then
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