Advertisement
Guest User

Untitled

a guest
Jan 21st, 2020
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.46 KB | None | 0 0
  1. local storage = 171994 -- storage
  2. local item = 12696 -- id do item
  3. local time = 5 -- tempo em segundos que o item vai ficar na posição.
  4. local delay = 1 -- delay em minutos
  5. local stor = 171995 -- delay em minutos
  6.  
  7. local pos = {}
  8.  
  9. function lost(cid)
  10. if isPlayer(cid) then
  11. for index, pid in pairs(pos) do
  12. if index == getCreatureName(cid) then
  13. local t = getTileItemById(pos[index], item)
  14. if t.uid > 0 then
  15. doRemoveItem(t.uid)
  16. end
  17. end
  18. end
  19. doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "O selo foi perdido!")
  20. end
  21. end
  22.  
  23. function onCastSpell(cid, var)
  24. if getPlayerStorageValue(cid, stor) >= os.time() then
  25. local minutos = math.floor((getPlayerStorageValue(cid,config.stor) - os.time())/(60))
  26. return doPlayerSendCancel(cid, "Você deve esperar ".. (minutos <= 0 and getPlayerStorageValue(cid, stor) - os.time() or minutos) .." "..(minutos <= 0 and "segundos" or "minutos").." para usar esse item de novo.")
  27. end
  28.  
  29. if getPlayerStorageValue(cid, storage) - os.time() <= 0 then
  30. pos[getCreatureName(cid)] = getCreaturePosition(cid)
  31. setPlayerStorageValue(cid, storage, os.time()+time)
  32. doCreateItem(item, getCreaturePosition(cid))
  33. doSendMagicEffect(getCreaturePosition(cid), 3)
  34. addEvent(lost, time*1000, cid)
  35. elseif getPlayerStorageValue (cid, storage) - os.time() >= 1 then
  36. for index, pid in pairs(pos) do
  37. if index == getCreatureName(cid) then
  38. doTeleportThing(cid, pid)
  39. setPlayerStorageValue(cid, stor, os.time()+delay*60)
  40.  
  41. end
  42. end
  43. end
  44.  
  45. return true
  46. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement