Advertisement
Guest User

Untitled

a guest
Apr 18th, 2019
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.22 KB | None | 0 0
  1. function onUse(cid, item, fromPosition, itemEx, toPosition)
  2.     doLogScript2(62, SCRIPT_TYPE_ACTION)
  3.  
  4.     doLogScript(184, SCRIPT_TYPE_ACTION)
  5.    
  6.     local item = Item(itemm.uid)
  7.     local storage = itemm.uid
  8.    
  9.     if player:getStorageValue(storage) > os.time() then
  10.         player:sendTextMessage(MESSAGE_INFO_DESCR, 'Surprise nest is empty.')
  11.         return true
  12.     end
  13.    
  14.     local player = Player(cid)
  15.     local surpriseNest = player:getStorageValue(4090)
  16.     local now = os.time()
  17.     local timePassed = now - surpriseNest
  18.  
  19.    
  20.    
  21.     if getPlayerLevel(cid) >= 150 then
  22.         if timePassed >=  1 * 2 * 60 then
  23.             player:setStorageValue(4090, now)
  24.             player:addItem(16102, 1)
  25.             player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have found surprise nest.")
  26.             player:getPosition():sendMagicEffect(CONST_ME_FIREWORK_YELLOW)
  27.             else
  28.             player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You are exhausted by opening the previous surprise nest, find another one.")
  29.             player:getPosition():sendMagicEffect(CONST_ME_POFF)
  30.         end
  31.     else
  32.         player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You need at least 150 level to participe in this event.")
  33.         player:getPosition():sendMagicEffect(CONST_ME_POFF)
  34.     end
  35.     player:setStorageValue(storage, os.time() + 1 * 60)
  36.     return true
  37. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement