JDB
OtLand Veteran
- Joined
- Jun 1, 2009
- Messages
- 4,145
- Solutions
- 2
- Reaction score
- 115
The Forgotten Server 0.3.5
data/actions/actions.xml
Unique ID must be edited and inputed through the mapeditor.
data/actions/scripts/script.lua
The Forgotten Server 0.2.5
data/actions/actions.xml
PHP:
<action uniqueid="1000" script="create_tele.lua" />
data/actions/scripts/script.lua
Lua:
local config =
{
newPos = {x=100, y=100, z=7}, -- New player position
teleportPos = {x=100, y=100, z=7}, -- Teleport position
LeverPos = {x=100, y=100, z=7}, -- Lever position
timeToRemove = 10 -- Seconds
}
function onUse(cid, item, fromPos, item2, toPos)
local teleport = getTileItemById(config.teleportPos, 1387)
local playerPos = getCreaturePosition(cid)
if item.itemid == 1945 then
doCreateTeleport(1387, config.newPos, config.teleportPos)
doSendMagicEffect(config.teleportPos, CONST_ME_TELEPORT)
doSendMagicEffect(playerPos, CONST_ME_GIFT_WRAPS)
doCreatureSay(cid, "The teleport has been created!", TALKTYPE_ORANGE_1)
addEvent(doRemoveTeleport, config.timeToRemove * 1000)
elseif item.itemid == 1946 then
doPlayerSendCancel(cid, "The teleport has already been created.")
return TRUE
end
end
function doRemoveTeleport()
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
The Forgotten Server 0.2.5
Lua:
local config =
{
newPos = {x=100, y=100, z=7}, -- New player position
teleportPos = {x=100, y=100, z=7}, -- Teleport position
LeverPos = {x=100, y=100, z=7}, -- Lever position
timeToRemove = 10 -- Seconds
}
function onUse(cid, item, fromPos, item2, toPos)
local teleport = getThingfromPos(config.teleportPos, 1387)
local playerPos = getPlayerPosition(cid)
if item.itemid == 1945 then
doCreateTeleport(1387, config.newPos, config.teleportPos)
doSendMagicEffect(config.teleportPos, CONST_ME_TELEPORT)
doSendMagicEffect(playerPos, CONST_ME_GIFT_WRAPS)
doCreatureSay(cid, "The teleport has been created!", TALKTYPE_ORANGE_1)
addEvent(doRemoveTeleport, config.timeToRemove * 1000)
elseif item.itemid == 1946 then
doPlayerSendCancel(cid, "The teleport has already been created.")
return TRUE
end
end
function doRemoveTeleport()
local teleport = getThingfromPos(config.teleportPos, 1387)
local Lever = getThingfromPos(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: