Hi to all.
I want modify this script, because when someone is trying to kill someone he use tp and back to temple without die.
I want to change that when you got battle, you can't use tp.
I tried a lot of conditions but not working...
I want modify this script, because when someone is trying to kill someone he use tp and back to temple without die.
Code:
savePos = {}
local function sendEffects(pos, eff, pid)
if savePos[pid] then
local player = Player(pid)
if isPlayer(player) then
pos:sendMagicEffect(eff, player)
addEvent(sendEffects, 400, pos, eff, pid)
end
end
end
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
local pid = player:getId()
if not player:isPzLocked() then
if not savePos[pid] then
savePos[pid] = {player:getPosition()}
player:teleportTo(player:getTown():getTemplePosition())
local pos = player:getPosition()
local randpos = Position(pos.x+math.random(2), pos.y+math.random(2), pos.z)
savePos[pid] = {savePos[pid][1], randpos}
local cache = savePos[pid]
sendEffects(cache[2], 12, pid)
sendEffects(cache[1], 35, pid)
local item = Item(Tile(randpos):getGround().uid)
item:setActionId(3006)
addEvent(function()
if item:getActionId(3006) then
item:removeAttribute('aid')
savePos[pid] = nil
end
end, 30000)
else
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'You must enter your teleport first before you use this again.')
end
else
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'You may not use this while you are in battle.')
end
return true
end
I want to change that when you got battle, you can't use tp.
Code:
if not player:isPzLocked() then
I tried a lot of conditions but not working...