• 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] Create teleport with lever

baralala

New Member
Joined
Jan 15, 2009
Messages
120
Reaction score
1
Location
Argentina
Hello i need some help with this...

I need to create a teleport with one lever and it must disapear after x seconds.

I try to do it but i when i try to remove the teleport it give me errors.

Or maybe if someone have the script for this part of poi and want to share it, it will be great





Thank
 
Code:
function onUse(cid, item, frompos, item2, topos)

-- lugar al ke te manda
local pos1 = {x=1386, y=1259, z=13}
-- lugar en ke se crea
local pos2 = {x=1384, y=1259, z=13, stackpos=1}
-- tiempo para que desaparezca
local time = 20

local function removal(position)
	if getThingfromPos(pos2).itemid == 1387 then
		doRemoveItem(getThingfromPos(pos2).uid)
		doTransformItem(item.uid,item.itemid-1)
	end
return TRUE
end

if item.uid == 10259 and item.itemid == 1945 then
	doCreateTeleport(1387, pos1, pos2)
	doTransformItem(item.uid,item.itemid+1)
	addEvent(removal, time * 1000, pos2)
else
	doPlayerSendCancel(cid,"Sorry not possible.")
end
return TRUE
end
 
Code:
[06/07/2009 21:51:55] Lua Script Error: [Action Interface] 
[06/07/2009 21:51:55] data/actions/scripts/Baralalas/Poi/tpconpalanca.lua nUse

[06/07/2009 21:51:55] attempt to index a nil value
[06/07/2009 21:51:55] stack traceback:
[06/07/2009 21:51:55] 	[C]: in function 'getTileItemById'
[06/07/2009 21:51:55] 	data/actions/scripts/Baralalas/Poi/tpconpalanca.lua:9: in function <data/actions/scripts/Baralalas/Poi/tpconpalanca.lua:8>

I try to solve by myself and this is my code
but
this only make the teleport efect

Code:
local config = {
        newPos = {x=1371, y=1349, z=15}, -- New player position
        TeleportPos = {x=1384, y=1295, z=13}, -- Teleport position
        LeverPos = {x=1389, y=1296, z=13}, -- Lever position
        timeToRemove = 10, -- Seconds
	TeleportPosStack = {x=1384, y=1295, z=13, stackpos = 1}
}

function onUse(cid, item, frompos, item2, topos)
local teleport = getTileItemById(config.TeleportPos, 1387)
        if item.itemid == 1945 then
                doCreateTeleport(1387, config.TeleportPosStack, config.newPos)
                doSendMagicEffect(config.TeleportPos, CONST_ME_TELEPORT)
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "The teleport has been created.")
                addEvent(doRemoveTeleport, config.timeToRemove * 1000, cid)
                
        elseif item.itemid == 1946 then
            doPlayerSendCancel(cid,"The lever has already been pulled.")
        return 1
        end
end

function doRemoveTeleport(cid)
local teleport = getTileItemById(config.TeleportPos, 1387)
local Lever = getTileItemById(config.LeverPos, 1946)
    if teleport.uid > 0 then
        doRemoveItem(teleport.uid)
        doSendMagicEffect(config.TeleportPos, CONST_ME_POFF)
        doTransformItem(Lever.uid, 1945)
    end
end
 
Last edited:
*Not tested*

Lever UniqueId = 16001

Lua:
local newportal = 0
local config = {
        newPos = {x=95, y=117, z=7}, -- New player position
        teleportPos = {x=100, y=100, z=7}, -- Teleport position
        LeverPos = {x=100, y=105, z=7}, -- Lever position
        timeToRemove = 5 -- Seconds
}

function onUse(cid, item, frompos, item2, topos)
local teleport = getThingfromPos(teleportPos)
        if(item.uid == 16001) then
		if(item.itemid == 1945 and getgate.itemid ~= 1387) then 
                    doCreateTeleport(1387, config.teleportPos, config.newPos)
                    doSendMagicEffect(config.teleportPos, CONST_ME_TELEPORT)
                    doCreatureSay(cid, "The teleport has been created!", TALKTYPE_ORANGE_1)
                    newportal = addEvent(doRemoveTeleport, config.timeToRemove * 1000, cid)
                else
                    doCreatureSay(cid, "The lever has already been pulled!", TALKTYPE_ORANGE_1)
                end					
	else 
            doPlayerSendCancel(cid,"Sorry, not possible.")
	end
    return TRUE
end

function doRemoveTeleport(cid)
local teleport = getThingfromPos(config.teleportPos)
local Lever = getThingfromPos(config.LeverPos)
    doRemoveItem(teleport.uid, 1)
    doSendMagicEffect(config.teleportPos, CONST_ME_POFF)
    doTransformItem(Lever.uid, 1945)
    newportal = 0
end

greetings :p
 
Requesting infinite aol

I need to know how to make a infinite aol

If u know how to make replie fast i would be happy if u know how to do it =p
 
Kuben script dont work

Code:
[07/07/2009 23:38:41] Lua Script Error: [Action Interface] 
[07/07/2009 23:38:41] data/actions/scripts/Baralalas/Poi/tpconpalanca.lua nUse

[07/07/2009 23:38:41] attempt to index a nil value
[07/07/2009 23:38:41] stack traceback:
[07/07/2009 23:38:41] 	[C]: in function 'getThingfromPos'
[07/07/2009 23:38:41] 	data/actions/scripts/Baralalas/Poi/tpconpalanca.lua:10: in function <data/actions/scripts/Baralalas/Poi/tpconpalanca.lua:9>

Code:
local newportal = 0
local config = {
        newPos = {x=1371, y=1349, z=15}, -- New player position
        teleportPos = {x=1384, y=1295, z=13}, -- Teleport position
        LeverPos = {x=1389, y=1296, z=13}, -- Lever position
        timeToRemove = 5 -- Seconds
}

function onUse(cid, item, frompos, item2, topos)
local teleport = getThingfromPos(teleportPos)
        if(item.uid == 10259) then
                if(item.itemid == 1945 and getgate.itemid ~= 1387) then
                    doCreateTeleport(1387, config.teleportPos, config.newPos)
                    doSendMagicEffect(config.teleportPos, CONST_ME_TELEPORT)
                    doCreatureSay(cid, "The teleport has been created!", TALKTYPE_ORANGE_1)
                    newportal = addEvent(doRemoveTeleport, config.timeToRemove * 1000, cid)
                else
                    doCreatureSay(cid, "The lever has already been pulled!", TALKTYPE_ORANGE_1)
                end                                    
        else
            doPlayerSendCancel(cid,"Sorry, not possible.")
        end
    return TRUE
end

function doRemoveTeleport(cid)
local teleport = getThingfromPos(config.teleportPos)
local Lever = getThingfromPos(config.LeverPos)
    doRemoveItem(teleport.uid, 1)
    doSendMagicEffect(config.teleportPos, CONST_ME_POFF)
    doTransformItem(Lever.uid, 1945)
    newportal = 0
end
 
Back
Top