Instead action script pls make it spell script! utevo teleport and where he look at the teleport will create! but he cant create it on people or stairs or wall or a hole.
Teleport where it take you edit it to = the players town id! if other players walk in the tp they get tp to the same town that guy created it! example he's from carlin he create it he walk in it, he come back to carlin if somebody from thais walk in he come to carlin!
Teleport where it take you edit it to = the players town id! if other players walk in the tp they get tp to the same town that guy created it! example he's from carlin he create it he walk in it, he come back to carlin if somebody from thais walk in he come to carlin!
Code:
local cfg = {
time = 30, -- Time the teleport is open.
exhausted = 300, -- Time you are exhausted.
storage = 1337, -- Storage used for "exhaust."
to = { x = 1500, y = 1500, z = 7 } -- Where the teleport takes you.
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if(getPlayerStorageValue(cid, cfg.storage) > os.time()) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You must wait another " .. getPlayerStorageValue(cid, cfg.storage) - os.time() .. ' second' .. ((getPlayerStorageValue(cid, cfg.storage) - os.time()) == 1 and "" or "s") .. " to create another teleport.")
elseif(getTilePzInfo(getCreaturePosition(cid)) == true) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You cannot create a teleport in a protection zone.")
elseif(getCreatureCondition(cid, CONDITION_INFIGHT) == true) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You may not create a teleport while fighting.")
elseif(hasProperty(getThingFromPos(toPosition).uid, CONST_PROP_BLOCKSOLID) == true) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You cannot create a teleport here.")
else
local function deleteTeleport()
local teleport = getTileItemById(toPosition, 1387).uid
if(teleport > 0) then
doRemoveItem(teleport)
doSendMagicEffect(toPosition, CONST_ME_POFF)
doSendAnimatedText(toPosition, "Closed", TEXTCOLOR_RED)
end
return true
end
for x = 1, cfg.time do
local n = cfg.time - x
addEvent(doSendAnimatedText, x * 1000, toPosition, n > 0 and tostring(n), TEXTCOLOR_WHITE)
end
doCreateTeleport(1387, cfg.to, toPosition)
doSendMagicEffect(toPosition, CONST_ME_ENERGYAREA)
addEvent(deleteTeleport, cfg.time * 1000)
setPlayerStorageValue(cid, cfg.storage, os.time() + cfg.exhausted)
end
return true
end
Last edited: