CyberShaman21
New Member
- Joined
- Dec 9, 2017
- Messages
- 52
- Reaction score
- 4
hi
i want to make item for random teleport. After 5 seconds back to old position(where start teleport)
i have this code
but i have errors
i want to make item for random teleport. After 5 seconds back to old position(where start teleport)
i have this code
Code:
local random_positions = {
["A1"] = {x = 29990, y = 30125, z = 7},
["A2"] = {x = 29990, y = 30133, z = 7},
["A3"] = {x = 29990, y = 30141, z = 7},
}
local timeback = 5
local old = getPlayerMasterPos(cid)
function back()
doTeleportThing(cid, old)
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
if getCreatureCondition(cid, CONDITION_INFIGHT) then
doPlayerSendCancel(cid, 'You can\'t teleport while in fight.')
else
doRemoveItem(item.uid)
doTeleportThing(cid, random_positions[math.random(#random_positions)])
doSendMagicEffect(old, CONST_ME_TELEPORT)
doSendMagicEffect(new, CONST_ME_TELEPORT)
doCreatureSay(cid, 'You have teleported.', TALKTYPE_ORANGE_1, false, cid)
addEvent(back, timeback * 1000)
end
return true
end
but i have errors
Last edited: