Advertisement
Guest User

Untitled

a guest
Apr 13th, 2020
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.70 KB | None | 0 0
  1. exhaustion =
  2. {
  3. check = function (cid, storage)
  4. return getPlayerStorageValue(cid, storage) >= os.time(t)
  5. end,
  6.  
  7. get = function (cid, storage)
  8. local exhaust = getPlayerStorageValue(cid, storage)
  9. if(exhaust > 0) then
  10. local left = exhaust - os.time(t)
  11. if(left >= 0) then
  12. return left
  13. end
  14. end
  15.  
  16. return false
  17. end,
  18.  
  19. set = function (cid, storage, time)
  20. setPlayerStorageValue(cid, storage, os.time(t) + time)
  21. end,
  22.  
  23. make = function (cid, storage, time)
  24. local exhaust = exhaustion.get(cid, storage)
  25. if(not exhaust) then
  26. exhaustion.set(cid, storage, time)
  27. return true
  28. end
  29.  
  30. return false
  31. end
  32. }
  33.  
  34. local newpos = {x=861, y=698, z=7}
  35. local time = 8--in second
  36.  
  37. function onUse(player, item, fromPosition, target, toPosition, isHotkey)
  38. local cid = player:getId()
  39.  
  40.  
  41. if exhaustion.check(cid, 1605) then
  42. return doPlayerSendCancel(cid, "Please Wait "..exhaustion.get(cid,1605).." seconds.") and doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
  43. end
  44.  
  45. if not player:isPzLocked() then
  46. doSendMagicEffect(getPlayerPosition(cid), 2)
  47. doTeleportThing(cid,newpos)
  48. doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
  49. doCreatureSay(cid, "TELEPORTED!!" ,TALKTYPE_ORANGE_1)
  50. exhaustion.set(cid, 1605, time)
  51.  
  52.  
  53.  
  54. else
  55. doPlayerSendTextMessage(cid,25,"You can't use the teleport scroll if you are PZ LOCKED!!")
  56. end
  57. return true
  58. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement