local towns = {1, 2, 4, 7, 12} --towns id
function onPrepareDeath(cid, lastHitKiller, mostDamageKiller)
if isPlayer(cid) == TRUE then
local oldPosition = getCreaturePosition(cid)
doTeleportThing(cid, getTownTemplePosition(towns[math.random(#towns)]))
doCreatureAddHealth(cid, getCreatureMaxHealth(cid), TRUE)
doSendMagicEffect(getCreaturePosition(cid), 37)
doSendMagicEffect(oldPosition, 2)
doRemoveConditions(cid)
return FALSE
end
return TRUE
end