J.Dre
Unity Games
Hello again! I am releasing another script. It is quite nice and can be very useful to some.
Please leave comments, feedback, and most of all, some reputation!
Update Log:
- [#01] - Updated Config
You can now use town names, or a specific destination.
data/actions/actions.xml
Code:
<action itemid="7735" event="script" value="script.lua"/>
Lua:
local config, tps, others = {
level = 50, -- level to use
seconds = 10, -- how long it lasts
createInPZ = false, -- true/false
oneTeleport = true, -- true/false
destination = 'Thais' -- town name or other position.
}, {}, {430} -- {430} = items that you can add to block TP from creating (e.g. {430, 2160})
local function remove(pos, guid)
if config.oneTeleport then
for i = 1, #tps do
if tps[i] == guid then
table.remove(tps, i)
break
end
end
end
local item = getTileItemById(pos, 1387).uid
return item > 0 and doRemoveItem(item) and doSendMagicEffect(pos, CONST_ME_POFF)
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
local thing = getTopCreature(toPosition)
if getPlayerLevel(cid) >= config.level then
local guid = getPlayerGUID(cid)
if not config.oneTeleport or not isInArray(tps, guid) then
toPosition.stackpos = 0
if not isPlayer(thing.uid) and not isMonster(thing.uid) and not isNpc(thing.uid) and not isCreature(thing.uid) and not isInArray({0, 65535}, toPosition.x) and not isInArray(others, itemEx.itemid) and (config.createInPZ or not getTileInfo(toPosition).protection) and not hasItemProperty(getTileThingByPos(toPosition).uid, CONST_PROP_MOVABLE) and not hasItemProperty(getTileThingByPos(toPosition).uid, CONST_PROP_BLOCKSOLID) and queryTileAddThing(cid, toPosition) == RETURNVALUE_NOERROR and getTileItemByType(toPosition, ITEM_TYPE_TELEPORT).uid == 0 then
if not hasCondition(cid, CONDITION_INFIGHT) then
doCreateTeleport(1387, type(config.destination) == 'table' and config.destination or getTownTemplePosition(getTownId(config.destination)), toPosition)
if config.oneTeleport then
table.insert(tps, guid)
end
addEvent(remove, config.seconds * 1000, toPosition, guid)
doCreatureSay(cid, "Teleport created!", TALKTYPE_MONSTER, nil, nil, toPosition)
doSendMagicEffect(toPosition, CONST_ME_GROUNDSHAKER)
else
doCreatureSay(cid, "You cannot create a teleport while in battle.", TALKTYPE_MONSTER)
doSendMagicEffect(toPosition, CONST_ME_POFF)
end
else
doCreatureSay(cid, "You cannot create a teleport here.", TALKTYPE_MONSTER)
doSendMagicEffect(toPosition, CONST_ME_POFF)
end
else
doCreatureSay(cid, "You already have an active teleport.", TALKTYPE_MONSTER)
doSendMagicEffect(toPosition, CONST_ME_POFF)
end
else
doCreatureSay(cid, "You must be at least level (" .. config.level .. ") to use this.", TALKTYPE_MONSTER)
doSendMagicEffect(toPosition, CONST_ME_POFF)
end
return true
end
This is a 'create teleport' script, coded by J.Dre (updates and new features). However, originally released by Cykotitan (newfag version).
Last edited: