local config = {
timeToRemove = 120, -- seconds
message = "Take the teleporter or it will disappear",
teleportId = 9773,
brothers ={
["dominique"] = {pos={ x=1457, y=852, z=2, stackpos=1 },aid=13050, brother = "dominique"}, --{x = 1457, y = 825, z = 2}
["skylar"] = {pos={ x=1458, y=852, z=2, stackpos=1 },aid=13050, brother = "skylar"}, --{x = 1458, y = 825, z = 2}
brothersArea ={
fromPos = {x = 1457, y = 829, z = 2},
toPos = {x = 1457, y = 837, z = 2}} } } --{x = 1457, y = 837, z = 2}
}
local function removal(position)
doRemoveThing(getTileItemById(position, config.teleportId).uid, 1)
return TRUE
end
end
function onKill(cid, target, lastHit)
if(config.brothers[getCreatureName(target)]) then
local t = config.brothers[getCreatureName(target)]
local brother = getCreatureByName(t.brother)
if(isMonster(brother) == true) then
if(isInRange(getCreaturePosition(brother), config.brothers.brothersArea.fromPos, config.brothers.brothersArea.toPos) == true) then
return TRUE
end
else
local teleport = doCreateItem(config.teleportId, t.pos)
local position = t.pos
doItemSetAttribute(teleport, 13050, t.aid)
doCreatureSay(cid, config.message, TALKTYPE_ORANGE_1)
addEvent(removal, config.timeToRemove * 1000, position)
end
return TRUE
end