Advertisement
Guest User

Untitled

a guest
Sep 18th, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.70 KB | None | 0 0
  1. local config = {
  2. [6010] = {
  3. gemid = 5295,
  4. [2392] = {2, 7522},
  5. [5249] = {4, 7523},
  6. [1002] = {5, 10002},
  7. },
  8. [6011] = {
  9. gemid = 1234,
  10. [1000] = {3, 10001},
  11. [1001] = {4, 10002},
  12. [1002] = {5, 10002},
  13. },
  14. [6012] = {
  15. gemid = 1234,
  16. [1000] = {3, 10001},
  17. [1001] = {4, 10002},
  18. [1002] = {5, 10002},
  19. },
  20. [6013] = {
  21. gemid = 1234,
  22. [1000] = {3, 10001},
  23. [1001] = {4, 10002},
  24. [1002] = {5, 10002},
  25. }
  26. }
  27.  
  28. function onUse(cid, item, fromPosition, itemEx, toPosition)
  29.  
  30. if item.itemid == 1945 then
  31.  
  32. if config[item.actionid] then
  33. local stoisko = config[item.actionid]
  34. local leftPos = {x = fromPosition.x - 1, y = fromPosition.y, z = fromPosition.z, stackpos = 255}
  35. local rightPos = {x = fromPosition.x + 1, y = fromPosition.y, z = fromPosition.z, stackpos = 255}
  36. if stoisko[getThingFromPos(leftPos).itemid] then
  37. -----------item znajduje sie w configu
  38. local wpcnfg = stoisko[getThingFromPos(leftPos).itemid]
  39. local thing = getThingFromPos(rightPos)
  40. if thing then
  41.  
  42. if thing.itemid == stoisko.gemid then
  43.  
  44. -------------to jest gem
  45. if thing.type >= wpcnfg[1] then
  46. doRemoveItem(thing.uid, wpcnfg[1])
  47. doTransformItem(getThingFromPos(leftPos).uid, wpcnfg[2])
  48. doSendMagicEffect(leftPos, CONST_ME_EXPLOSIONAREA)
  49. doSendMagicEffect(rightPos, CONST_ME_POFF)
  50. doSendAnimatedText(fromPosition, "Done!", TEXTCOLOR_RED)
  51. else
  52. doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Not enough gems.")
  53. end
  54. end
  55. end
  56. else
  57. doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "This item can't be changed.")
  58. end
  59. end
  60.  
  61. end
  62.  
  63. return doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
  64. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement