Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local MyLocal = {}
- MyLocal.players = {}
- MyLocal.time = 30
- MyLocal.magicEffect = 124
- local function stopMove(cid)
- if isCreature(cid) then
- MyLocal.players[cid] = nil
- setPlayerStorageValue(cid, "playerCanMoveDirection", 0)
- if not exhaustion.check(cid, "airtrapped") then
- doCreatureSetNoMove(cid, false)
- end
- doPlayerAddExaust(cid, "earth", "track", earthExausted.track)
- end
- end
- local function MoveAutomatic(cid, speed)
- if not isCreature(cid) then
- stopMove(cid)
- return false
- end
- if MyLocal.players[cid] == nil then
- return false
- end
- local time = MyLocal.players[cid].timeEnd
- local playerPos = getThingPos(cid)
- local posToGo = getPositionByDirection(playerPos, getCreatureLookDir(cid), 1)
- if getPlayerCanWalk({player = cid, position = posToGo, createTile = true, checkPZ = true, checkHouse = true, checkWater = true}) and not exhaustion.check(cid, "airtrapped") then
- doTeleportThing(cid, posToGo)
- doSendMagicEffect(playerPos, MyLocal.magicEffect)
- if time <= os.time() then
- stopMove(cid)
- else
- addEvent(MoveAutomatic, speed, cid, speed)
- end
- else
- stopMove(cid)
- return false
- end
- end
- local function formulaLevel(cid)
- local level = getPlayerLevel(cid)*1.3
- if level >= 200 then
- return 200
- else
- return level
- end
- end
- function onCastSpell(cid, var)
- if not isPlayer(cid) then
- return false
- end
- if getSpellCancels(cid, "earth") == true then
- return false
- end
- if getPlayerExaust(cid, "earth", "track") == false then
- return false
- end
- if MyLocal.players[cid] == nil then
- if getPlayerHasStun(cid) then
- doPlayerAddExaust(cid, "earth", "track", earthExausted.track)
- return true
- end
- local newPos = getPositionByDirection(getThingPos(cid), getCreatureLookDir(cid))
- if not getPlayerCanWalk({player = cid, position = newPos, createTile = true, checkPZ = true, checkHouse = true, checkWater = true}) then
- doPlayerSendCancelEf(cid, "It isn't possible use this fold here.")
- return false
- end
- MyLocal.players[cid] = {timeEnd = os.time()+MyLocal.time}
- MoveAutomatic(cid, 300-formulaLevel(cid))
- setCreatureNoMoveTime(cid, MyLocal.time*1000)
- workAllCdAndAndPrevCd(cid, "earth", "track", MyLocal.time, 1)
- setPlayerStorageValue(cid, "playerCanMoveDirection", os.time()+MyLocal.time)
- return true
- else
- doPlayerSendCancelEf(cid, "You're already using this fold.")
- return false
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement