Guest User

Untitled

a guest
Feb 18th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.38 KB | None | 0 0
  1. local monsters = {'thul', 'thul', 'thul'}
  2.  
  3. function onUse(cid, item, fromPosition, itemEx, toPosition)
  4. if not doPlayerRemoveItem(cid, 8309, 1) then
  5. return doPlayerSendCancel(cid, 'You need at least one nail to use this fishing rod.')
  6. end
  7.  
  8. if getTileInfo(getThingPosition(cid)).protection then
  9. return doPlayerSendCancel(cid, 'You cannot use this item while in a protection zone.')
  10. end
  11.  
  12. 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
  13. return doPlayerSendCancel(cid, 'You only can use this fishing rod in water.')
  14. end
  15.  
  16. local n = math.random(200)
  17. if n == 1 then
  18. doPlayerAddItem(cid, 7159, 1)
  19. doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'You have fished out a green perch!')
  20. doSendMagicEffect(toPosition, CONST_ME_WATERSPLASH)
  21. else
  22. n = math.random(100)
  23. if n == 1 then
  24. doPlayerAddItem(cid, 7158, 1)
  25. doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'You have fished out a rainbow trout!')
  26. doSendMagicEffect(toPosition, CONST_ME_WATERSPLASH)
  27. elseif n == 2 then
  28. n = math.random(2)
  29. if n == 1 then
  30. doCreatureAddHealth(cid, -getCreatureHealth(cid))
  31. doSendMagicEffect(toPosition, CONST_ME_WATERCREATURE)
  32. doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, 'You\'ve been killed by the mighty Cthulhu!')
  33. else
  34. doCreatureAddHealth(cid, -(getCreatureHealth(cid)) + 1)
  35. doCreatureAddMana(cid, -getCreatureMana(cid))
  36. doSendMagicEffect(toPosition, CONST_ME_WATERCREATURE)
  37. doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, 'You were almost killed by the mighty Cthulhu, but you saved yourself from being dragged into the water!')
  38. end
  39. else
  40. n = math.random(50)
  41. if n == 1 then
  42. doCreateMonster(monsters[math.random(#monsters)], getThingPosition(cid))
  43. doSendMagicEffect(toPosition, CONST_ME_WATERSPLASH)
  44. doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'You fished out a monster! It is attacking you in a rage!')
  45. end
  46. end
  47. end
  48.  
  49. n = math.random(10)
  50. if n == 1 then
  51. doRemoveItem(item.uid)
  52. doSendMagicEffect(toPosition, CONST_ME_LOSEENERGY)
  53. doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'You almost had it! Your fishing rod has broken.')
  54. end
  55.  
  56. doSendMagicEffect(toPosition, CONST_ME_LOSEENERGY)
  57. return true
  58. end
Add Comment
Please, Sign In to add comment