andree
New Member
- Joined
- Feb 19, 2014
- Messages
- 70
- Reaction score
- 4
hey guys. teleports me in the designated position, after a moment teleports in the former position. the question is how to save the old storage position to be able to return there?
Code:
function back(cid, var)
local playerPosition = getCreaturePosition(cid)
doCreatureSetStorage(cid, 5421, '_' .. playerPosition.x .. '_' .. playerPosition.y .. '_' .. playerPosition.z)
local playerPosFromStorage = getCreatureStorage(cid, 5421):explode('_')
doTeleportThing(cid, {x = playerPosFromStorage[1], y = playerPosFromStorage[2], z = playerPosFromStorage[3]})
end
function onCastSpell(cid, var)
local target = getCreatureTarget(cid)
local pos = {x=910, y=897, z=7}
if target == isMonster or isPlayer then
doTeleportThing(cid, pos)
doTeleportThing(target, pos)
end
addEvent(back, 1000, cid)
end