• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!

TP not dissapearing

Jackq

Member
Joined
Jul 12, 2013
Messages
19
Reaction score
5
Hey! I have a script that creates a tp on monsterkill and then deletes the tp after 60 sec, problem is that it works for all tps except 2,
Code:
local config = {
    message = "Go into the teleport in 60 seconds, else it will disappear.",
    timeToRemove = 60, -- seconds
    teleportId = 1387,
    bosses = { -- Monster Name, Teleport To Position, Teleport Position
        ["Eternal Oblivion"] = { { x = 1047, y = 346, z = 5, stackpos = 1 }, { x = 1129, y = 297, z = 11 }},
        ["Charizard"] = { { x = 703, y = 713, z = 7, stackpos = 1 }, { x = 636, y = 724, z = 7, stackpos = 1 }},
        ["Much Fire"] = { { x = 289, y = 930, z = 7, stackpos = 1 }, { x = 281, y = 929, z = 6, stackpos = 1 }},
        ["The Mad King"] = { { x = 1026, y = 973, z = 7, stackpos = 1 }, { x = 574, y = 1112, z = 7, stackpos = 1 }},
        ["The Grudge"] = { {x = 681, y = 1175, z = 4, stackpos = 1 }, {x = 713, y = 1150, z = 6, stackpos = 1 }}         
    }
}

local function removal(position)
    if getThingfromPos(position).itemid == config.teleportId then
        doRemoveItem(getThingfromPos(position).uid)
    end
    return TRUE
end

function onKill(cid, target, lastHit)
    for name, pos in pairs(config.bosses) do
        if name == getCreatureName(target) then
            teleport = doCreateTeleport(config.teleportId, pos[1], pos[2])
            if teleport == FALSE then
                print("Create teleport failed. Check ID, position1 and position2")
                return TRUE
            end
            doCreatureSay(cid, config.message, TALKTYPE_ORANGE_1)
            addEvent(removal, config.timeToRemove * 1000, pos[2])
        end
    end
    return TRUE
end
More specefic "The Mad King" & "Charizard"

Anyone knows what the problem might be? Or any speculations?
 
Last edited:
Last edited:
In the thread I read
-"And the addEvent line to this"-
"addEvent(removal, config.timeToRemove * 1000, pos[2])"
where should I paste this code?
change ur removal function to this one

Code:
local function removal(position)
     local thing = getTileItemById(position, config.teleportId).uid
     if thing > 0 then
           doRemoveItem(thing)
     end
     return true
end
and please try to search the error in the forum before posting
 
Back
Top