Permamently
New Member
- Joined
- Jul 23, 2015
- Messages
- 34
- Reaction score
- 3
Hello I'm using this script for teleport players in area 1x1 then teleport them back:
And I want to do that by other spell caster can back faster than teleported enemys.
I mean for example: Player using this teleportation spell "exori mas teleport" then if he want back faster he write for example: "exori mas teleport back"
*Normally he stay there with enemys for 5 seconds if it's imporant.
Code:
local function doTeleportBack(cid, tid, pPos, pos)
if isPlayer(cid) then
doTeleportThing(cid, pos, false)
end
if isPlayer(tid) then
doTeleportThing(tid, pPos, false)
end
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
doSendMagicEffect(pPos, CONST_ME_POFF)
return true
end
function onCastSpell(cid, var)
local teleports = {{ x=1100, y=44, z=7 }, { x=87, y=466, z=7 }}
local area1 = teleports[math.random(1,#teleports)]
local pos = getCreaturePosition(cid)
for i, tid in ipairs(getSpectators(getCreaturePosition(cid), 1, 1, false)) do
if(isPlayer(tid) and getPlayerAccess(tid) <= 1) then
local pPos = getCreaturePosition(tid)
if pPos.x == pos.x and pPos.y == pos.y + 1 and pPos.z == pos.z then
doTeleportThing(tid, { x=area1.x, y=area1.y + 1, z=area1.z }, false)
elseif pPos.x == pos.x and pPos.y == pos.y - 1 and pPos.z == pos.z then
doTeleportThing(tid, { x=area1.x, y=area1.y - 1, z=area1.z }, false)
elseif pPos.x == pos.x + 1 and pPos.y == pos.y and pPos.z == pos.z then
doTeleportThing(tid, { x=area1.x + 1, y=area1.y, z=area1.z }, false)
elseif pPos.x == pos.x -1 and pPos.y == pos.y and pPos.z == pos.z then
doTeleportThing(tid, { x=area1.x - 1, y=area1.y, z=area1.z }, false)
elseif pPos.x == pos.x + 1 and pPos.y == pos.y + 1 and pPos.z == pos.z then
doTeleportThing(tid, { x=area1.x + 1, y=area1.y + 1, z=area1.z }, false)
elseif pPos.x == pos.x - 1 and pPos.y == pos.y - 1 and pPos.z == pos.z then
doTeleportThing(tid, { x=area1.x - 1, y=area1.y - 1, z=area1.z }, false)
elseif pPos.x == pos.x - 1 and pPos.y == pos.y + 1 and pPos.z == pos.z then
doTeleportThing(tid, { x=area1.x - 1, y=area1.y + 1, z=area1.z }, false)
elseif pPos.x == pos.x + 1 and pPos.y == pos.y - 1 and pPos.z == pos.z then
doTeleportThing(tid, { x=area1.x + 1, y=area1.y - 1, z=area1.z }, false)
end
doTeleportThing(cid, area1, false)
addEvent(doTeleportBack, 5 * 1000, cid, tid, pPos, pos)
end
end
return true
end
I mean for example: Player using this teleportation spell "exori mas teleport" then if he want back faster he write for example: "exori mas teleport back"
*Normally he stay there with enemys for 5 seconds if it's imporant.