• 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!

script fix plese

Lbtg

Advanced OT User
Joined
Nov 22, 2008
Messages
2,398
Reaction score
165
the script works normaly after killing monatsr teleport comes up , but the thing is that after 120 seconds teleport isint deleted and it stays 4ever , can someone fix it so it works perfectly ?

Code:
registerCreatureEvent(cid, "Snake God Essence")

local creaturename = getCreatureName(cid)
local in_pos = {x = 347, y = 1365, z = 7, stackpos=2}
local checkIID = getThingfromPos(in_pos)
local to_pos = {x = 283, y = 1427, z = 7, stackpos=1}
local time_to_pass = 120 -- in seconds
local tpID = 1387

if creaturename == 'Snake God Essence' then

teleport = doCreateTeleport(tpID, to_pos, in_pos)

doSendMagicEffect(in_pos, CONST_ME_TELEPORT)

doCreatureSay(cid, "You have 120 seconds to enter the teleport before it is closed.", TALKTYPE_ORANGE_1)
addEvent(removeTeleport, (1000*time_to_pass))


end
end

function removeTeleport()
if getThingfromPos({x = 347, y = 1365, z = 7, stackpos=1}).itemid == 1387 then
doRemoveItem(getThingfromPos({x = 347, y = 1365, z = 7, stackpos=1}).uid,1)
return TRUE
end
end
 
i dont understand

i change this line

if getThingfromPos({x = 347, y = 1365, z = 7, stackpos=1}
to

if getThingfromPos({x = 347, y = 1365, z = 7, getTileItemById=1}

like this ?
 
Replace your function with this:
Code:
function removeTeleport()
    if (getTileItemById({x = 347, y = 1365, z = 7}, 1387).uid > 0) then
        doRemoveItem(getTileItemById({x = 347, y = 1365, z = 7}, 1387).uid)
    end
    return true
end
 
Code:
addEvent(removeTeleport, 1000 * time_to_pass, {x = 347, y = 1365, z = 7})
 
Code:
local m = {
        ["Snake God Essence"] = {
            time = 10, -- Seconds
            to = { x = 283, y = 1427, z = 7 }, -- Where Teleport Goes
            tp = { x = 347, y = 1365, z = 7 } -- Where Teleport Creates
        }
    }

function onKill(cid, target)
    local monster = m[getCreatureName(target)]
        local function deleteTeleport()
            local teleport = getTileItemById(monster.tp, 1387)
            if(teleport.uid > 0) then
                doRemoveItem(teleport.uid)
                doSendMagicEffect(monster.tp, CONST_ME_POFF)
                doSendAnimatedText(monster.tp, "Closed", TEXTCOLOR_RED)
            end
            return true
        end
    if(isPlayer(target) == true) then
        return true
    elseif(not monster) then
        return true
    else
        doCreateTeleport(1387, monster.to, monster.tp)
        addEvent(deleteTeleport, monster.time * 12000)
        doSendMagicEffect(monster.tp, CONST_ME_ENERGYAREA)
        doCreatureSay(cid, "You have 120 seconds to enter the teleport!", TALKTYPE_ORANGE_1)
    end
    return true
end
end


try this.
 
If you use TFS 0.3.6 your server can crash after reloading creaturescripts or not reload it properly, so better restart your server to test creaturescripts.
 
tested doesnt even found the scripts

console say unknown event name snake god essence.

any ideas? :(
 
Since I don't know which distro you are using, I recommend using a different teleport id and make it decay after 120 seconds in items.xml, then just delete the removeTeleport function from your script.
 
Back
Top