Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local monsters = {'thul', 'thul', 'thul'}
- function onUse(cid, item, fromPosition, itemEx, toPosition)
- if not doPlayerRemoveItem(cid, 8309, 1) then
- return doPlayerSendCancel(cid, 'You need at least one nail to use this fishing rod.')
- end
- if getTileInfo(getThingPosition(cid)).protection then
- return doPlayerSendCancel(cid, 'You cannot use this item while in a protection zone.')
- end
- if not isInArray({4614, 4665, 4615, 4616, 4617, 4612, 4163, 4612, 4611, 4608, 4664, 4610, 4618, 4619, 4613, 4620, 4621, 4622, 4623, 4624, 4625, 4665, 4666, 4820, 4821, 4822, 4823, 4824, 4825}, itemEx.itemid) then
- return doPlayerSendCancel(cid, 'You only can use this fishing rod in water.')
- end
- local n = math.random(200)
- if n == 1 then
- doPlayerAddItem(cid, 7159, 1)
- doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'You have fished out a green perch!')
- doSendMagicEffect(toPosition, CONST_ME_WATERSPLASH)
- else
- n = math.random(100)
- if n == 1 then
- doPlayerAddItem(cid, 7158, 1)
- doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'You have fished out a rainbow trout!')
- doSendMagicEffect(toPosition, CONST_ME_WATERSPLASH)
- elseif n == 2 then
- n = math.random(2)
- if n == 1 then
- doCreatureAddHealth(cid, -getCreatureHealth(cid))
- doSendMagicEffect(toPosition, CONST_ME_WATERCREATURE)
- doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, 'You\'ve been killed by the mighty Cthulhu!')
- else
- doCreatureAddHealth(cid, -(getCreatureHealth(cid)) + 1)
- doCreatureAddMana(cid, -getCreatureMana(cid))
- doSendMagicEffect(toPosition, CONST_ME_WATERCREATURE)
- doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, 'You were almost killed by the mighty Cthulhu, but you saved yourself from being dragged into the water!')
- end
- else
- n = math.random(50)
- if n == 1 then
- doCreateMonster(monsters[math.random(#monsters)], getThingPosition(cid))
- doSendMagicEffect(toPosition, CONST_ME_WATERSPLASH)
- doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'You fished out a monster! It is attacking you in a rage!')
- end
- end
- end
- n = math.random(10)
- if n == 1 then
- doRemoveItem(item.uid)
- doSendMagicEffect(toPosition, CONST_ME_LOSEENERGY)
- doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'You almost had it! Your fishing rod has broken.')
- end
- doSendMagicEffect(toPosition, CONST_ME_LOSEENERGY)
- return true
- end
Add Comment
Please, Sign In to add comment