Advertisement
Guest User

Untitled

a guest
Sep 24th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.10 KB | None | 0 0
  1. local aid_of_door = 1790 -- ActionID of all VIP Doors.
  2. local ITEMID_OF_VIPTOKEN = 6527
  3. local COUNT_OF_ITEM = 100
  4.  
  5. -- DO NOT EDIT BELOW THIS LINE
  6. function onUse(cid, item, fromPosition, itemEx, toPosition)
  7.     if(item.actionid == aid_of_door) then
  8.         local stor = getPlayerStorageValue(cid, item.uid)
  9.         if(stor < 1 or (stor+3600) <= os.time()) then
  10.             local ret = doPlayerRemoveItem(cid, ITEMID_OF_VIPTOKEN, COUNT_OF_ITEM)
  11.             if(ret) then
  12.                 setPlayerStorageValue(cid, item.uid, os.time())
  13.                 doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You now have one hour access to this spawn.")
  14.                 if(not doorEnter(cid, item, toPosition)) then return false end
  15.             else
  16.                 doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You need atleast 100 GAME TOKENS to enter this spawn.")
  17.             end
  18.         else
  19.             if(not doorEnter(cid, item, toPosition)) then return false end
  20.         end
  21.     end
  22.     return true
  23. end
  24.  
  25. function doorEnter(cid, item, toPosition)
  26.    
  27.     local mob = getTopCreature(toPosition); if(mob.uid > 0) then return false end
  28.     doTransformItem(item.uid, item.itemid + 1)
  29.     doTeleportThing(cid, toPosition)
  30.     return true
  31. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement