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
[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>
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
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
[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>
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