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

Request script need items to open tp with lever

wafuboe

Member
Joined
Dec 24, 2010
Messages
881
Solutions
2
Reaction score
22
Hello i am requesting a script that if you have 10 X items you can activate the lever to create a teleport that will send you to a location. after 60 seconds the teleport will disappear thanks!!!!

TFS 1.3
 
Hello i am requesting a script that if you have 10 X items you can activate the lever to create a teleport that will send you to a location. after 60 seconds the teleport will disappear thanks!!!!

TFS 1.3

If you want to have the required item removed when you pull the lever just remove the -- on line 23.

I also replied to another one of your threads in request board a few days ago and I'm curious if it worked or not. Let me know.

Lua:
local config = {
    req_item = {2148, 10}, -- Required item and count
    portal_from = {x = 1000, y = 1000, z = 7}, -- Where portal will spawn
    portal_to = {x = 1000, y = 1000, z = 7}, -- Where portals destination is
    duration = 60 -- How long portal will exist in seconds
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if item.itemid == 1946 then
        return false
    end

    if player:getItemCount(config.req_item[1]) < config.req_item[2] then
        return player:sendCancelMessage("You do not have enough of the required item.")
    end

    local portal_uid = doCreateTeleport(1387, config.portal_to, config.portal_from)
    if not portal_uid then
        print("ERROR: Portal cannot be created on position.")
        return false
    end

    -- player:removeItem(config.req_item[1], config.req_item[2])
    item:transform(1946)

    addEvent(function()
        local portal, lever = Tile(config.portal_from):getItemById(1387), Item(item.uid)
        if portal and lever then
            portal:remove()
            lever:transform(1945)
        end
    end, config.duration * 1000)
    return true
end
 
If you want to have the required item removed when you pull the lever just remove the -- on line 23.

I also replied to another one of your threads in request board a few days ago and I'm curious if it worked or not. Let me know.

Lua:
local config = {
    req_item = {2148, 10}, -- Required item and count
    portal_from = {x = 1000, y = 1000, z = 7}, -- Where portal will spawn
    portal_to = {x = 1000, y = 1000, z = 7}, -- Where portals destination is
    duration = 60 -- How long portal will exist in seconds
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if item.itemid == 1946 then
        return false
    end

    if player:getItemCount(config.req_item[1]) < config.req_item[2] then
        return player:sendCancelMessage("You do not have enough of the required item.")
    end

    local portal_uid = doCreateTeleport(1387, config.portal_to, config.portal_from)
    if not portal_uid then
        print("ERROR: Portal cannot be created on position.")
        return false
    end

    -- player:removeItem(config.req_item[1], config.req_item[2])
    item:transform(1946)

    addEvent(function()
        local portal, lever = Tile(config.portal_from):getItemById(1387), Item(item.uid)
        if portal and lever then
            portal:remove()
            lever:transform(1945)
        end
    end, config.duration * 1000)
    return true
end
Hello my friend, i'm not the author but i'm using your code and i get this error, can u help me?

[19/03/2022 22:32:20] [Error - Action Interface]
[19/03/2022 22:32:20] data/actions/scripts/levers/genios1.lua:eek:nUse
[19/03/2022 22:32:20] Description:
[19/03/2022 22:32:20] data/actions/scripts/levers/genios1.lua:13: attempt to index local 'player' (a number value)
[19/03/2022 22:32:20] stack traceback:
[19/03/2022 22:32:20] data/actions/scripts/levers/genios1.lua:13: in function <data/actions/scripts/levers/genios1.lua:8>
 
Back
Top