• 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!

/Action [Teleport with item

CvB

ots.tibia-stat.org
Joined
Jun 14, 2007
Messages
60
Reaction score
2
Location
WrocLove
I search script to teleport.
Fuctions
If you have an item teleport you to one room and remove this item
If you haven't this item teleport you to secound room
Its all
Weiting for help
[sorry for my english]
 
Last edited:
PHP:
local CONFIG =
{
    firstroom = {x=1000, y=1000, z=7},
    secondroom = {x=1000, y=1000, z=7},
    mineitem = 0000

}

function onUse(cid, item, frompos, item2, topos)
	if item.itemid == CONFIG.mineitem then
                doTeleportThing(cid, CONFIG.firstroom)
		doRemoveItem(CONFIG.mineitem ,1)
	else
                doTeleportThing(cid, CONFIG.secondroom)
	end
	return TRUE
        end

not tested.
 
Last edited:
local config =
{
firstroom = {x=1000, y=1000, z=7},
secondroom = {x=1000, y=1000, z=7},
mineitem = 0000

}

function onuse(cid, item, frompos, item2, topos)
if config.mineitem == then
doteleportthing(cid, config.firstroom)
doremoveitem(config.mineitem ,1)
else
doteleportthing(cid, config.secondroom)
end
return true
end
== then?
 
Great but wath i must ad to moveEvent ?

<movevent event="StepIn" actionid="aid" script="namescript.lua" />

something like that ?
for rent
and in mapeditor in teleport ad this aid ?
 
Last edited:
Try this

Code:
function onStepIn(cid, item, fromPosition, itemEx, toPosition) 

local positions = {
	ifHaveItem = {x=1, y=1, z=7},
	ifNotHaveItem = {x=5, y=5, z=7}
}

local item = xxxx

if item.uid = xxxx then
if getPlayerItemCount(cid, item) >= 1 then
	
	doTeleportThing(cid, positions.ifHaveItem)
	doRemoveItem(cid, item, 1)
else
	doTeleportThing(cid, positions.ifNoHaveItem)

	end
end
end

add in movements.xml

Code:
<movevent event="StepIn" actionid="xxxx" script="scriptname.lua" />
 
easy:
PHP:
function onStepIn(cid, item, fromPosition, itemEx, toPosition) 

local cfg = { -- config
    6541, -- ID of required item
	{x=1, y=1, z=7}, -- position where teleport player when have the item.
	{x=5, y=5, z=7} -- if haven't item teleport position
}

	if doPlayerRemoveItem(cid, cfg[1], 1) == TRUE then
		doTeleportThing(cid, cfg[2])
	else
		doTeleportThing(cid, cfg[3])
	end
end
: )
 
Back
Top