skydangerous

Untitled

Nov 2nd, 2011
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.38 KB | None | 0 0
  1. local sky = {
  2.         pos = {{x = 1009,y = 1025,z=7},{x = 1009,y = 1026,z=7},{x = 1009,y = 1027,z=7},{x = 1009,y = 1028,z=7}},
  3.         level = {100,200,300,400},
  4.         fight = true,
  5.         days = 2
  6. }
  7. function onUse(cid, item, frompos, item2, topos)
  8. level = getPlayerLevel(cid)
  9.  if (sky.fight == true) and (getCreatureCondition(cid, CONDITION_INFIGHT) == TRUE) then
  10.                 doPlayerSendTextMessage(cid,22,"Você Precisa estar sem battle para usar o item.")      
  11.                 return FALSE
  12.         end
  13.         if (level <= sky.level[1] ) and (item.itemid == 2177) and (getPlayerStorageValue(cid, 7000) <= 0) then
  14.                 doTeleportThing(cid,sky.pos[1])
  15.                 doSendMagicEffect(getPlayerPosition(cid), 10)
  16.                 doPlayerSendTextMessage(cid,22,"Voce foi teleportado para um lugar secreto.")    
  17.                 setPlayerStorageValue(cid, 7000, os.time()+sky.days*3600*24)
  18.         elseif (level <= sky.level[2]) and (item.itemid == 2177) and (getPlayerStorageValue(cid, 7000) <= 0) then
  19.                 doTeleportThing(cid,sky.pos[2])
  20.                 doSendMagicEffect(getPlayerPosition(cid), 10)
  21.                 doPlayerSendTextMessage(cid,22,"Voce foi teleportado para um lugar secreto.")
  22.                 setPlayerStorageValue(cid, 7000, os.time()+sky.days*3600*24)
  23.         elseif (level <= sky.level[3]) and (item.itemid == 2177) and (getPlayerStorageValue(cid, 7000) <= 0)then
  24.                 doTeleportThing(cid,sky.pos[3])
  25.                 doSendMagicEffect(getPlayerPosition(cid), 10)
  26.                 doPlayerSendTextMessage(cid,22,"Voce foi teleportado para um lugar secreto.")
  27.                 setPlayerStorageValue(cid, 7000, os.time()+sky.days*3600*24)
  28.          elseif (level >= sky.level[4]) and (item.itemid == 2177) and (getPlayerStorageValue(cid, 7000) <= 0)then
  29.                 doTeleportThing(cid,sky.pos[3])
  30.                 doSendMagicEffect(getPlayerPosition(cid), 10)
  31.                 doPlayerSendTextMessage(cid,22,"Voce foi teleportado para um lugar secreto.")
  32.                 setPlayerStorageValue(cid, 7000, os.time()+sky.days*3600*24)
  33.        
  34.         hora = math.floor((getPlayerStorageValue(cid, 7000) - os.time())/(3600))
  35.         minuto = math.floor((getPlayerStorageValue(cid, 7000) - os.time())/(60))
  36.        
  37.         if hora >= 1 then          
  38.         doPlayerSendCancel(cid, "Voce nao pode usar o item so daqui "..(minuto < 0 and 0 or minuto).." minuto")
  39.         else
  40.         doPlayerSendTextMessage(cid, 25, "Nao tem level suficiente ou seu level e maior")
  41.         end
  42. end
  43.         end
  44.  
Advertisement
Add Comment
Please, Sign In to add comment