Advertisement
Guest User

Untitled

a guest
Aug 2nd, 2015
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local MyLocal = {}
  2. MyLocal.players = {}
  3. MyLocal.time = 30
  4. MyLocal.magicEffect = 124
  5.  
  6. local function stopMove(cid)
  7.     if isCreature(cid) then
  8.         MyLocal.players[cid] = nil
  9.         setPlayerStorageValue(cid, "playerCanMoveDirection", 0)
  10.         doCreatureSetNoMove(cid, false)
  11.         doPlayerAddExaust(cid, "earth", "track", earthExausted.track)  
  12.     end  
  13. end
  14.  
  15. local function MoveAutomatic(cid, speed)
  16.          if not isCreature(cid) then
  17.             stopMove(cid)
  18.             return false
  19.          end
  20.  
  21.          if MyLocal.players[cid] == nil then
  22.             return false
  23.          end
  24.  
  25.          local time = MyLocal.players[cid].timeEnd
  26.          local playerPos = getThingPos(cid)
  27.          local posToGo = getPositionByDirection(playerPos, getCreatureLookDir(cid), 1)
  28.  
  29.          if getPlayerCanWalk({player = cid, position = posToGo, createTile = true, checkPZ = true, checkHouse = true, checkWater = true}) and not exhaustion.check(cid, "airtrapped") then
  30.             doTeleportThing(cid, posToGo)
  31.             doSendMagicEffect(playerPos, MyLocal.magicEffect)
  32.             if time <= os.time() then
  33.                 stopMove(cid)
  34.             else
  35.                 addEvent(MoveAutomatic, speed, cid, speed)  
  36.             end
  37.         else
  38.             stopMove(cid)
  39.             return false
  40.         end
  41. end
  42.  
  43. local function formulaLevel(cid)
  44.     local level = getPlayerLevel(cid)*1.3
  45.     if level >= 200 then
  46.         return 200
  47.     else
  48.         return level
  49.     end
  50. end
  51.  
  52. function onCastSpell(cid, var)
  53.         if not isPlayer(cid) then
  54.             return false
  55.         end  
  56.  
  57.         if getSpellCancels(cid, "earth") == true then
  58.             return false
  59.         end
  60.  
  61.         if getPlayerExaust(cid, "earth", "track") == false then
  62.             return false
  63.         end
  64.  
  65.         if MyLocal.players[cid] == nil then
  66.             if getPlayerHasStun(cid) then
  67.                 doPlayerAddExaust(cid, "earth", "track", earthExausted.track)    
  68.                 return true
  69.             end
  70.             local newPos = getPositionByDirection(getThingPos(cid), getCreatureLookDir(cid))
  71.             if not getPlayerCanWalk({player = cid, position = newPos, createTile = true, checkPZ = true, checkHouse = true, checkWater = true}) then
  72.                 doPlayerSendCancelEf(cid, "It isn't possible use this fold here.")
  73.                 return false
  74.             end
  75.             MyLocal.players[cid] = {timeEnd = os.time()+MyLocal.time}
  76.             MoveAutomatic(cid, 300-formulaLevel(cid))
  77.             setCreatureNoMoveTime(cid, MyLocal.time*1000)
  78.             workAllCdAndAndPrevCd(cid, "earth", "track", MyLocal.time, 1)
  79.             setPlayerStorageValue(cid, "playerCanMoveDirection", os.time()+MyLocal.time)
  80.             return true
  81.          else
  82.             doPlayerSendCancelEf(cid, "You're already using this fold.")
  83.             return false
  84.          end
  85. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement