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

Teleport to x y z when u have item

Xedoxo

New Member
Joined
Oct 24, 2010
Messages
60
Reaction score
3
Looking for a script that would run on the principle:
itemid need to use the teleport to x y z - tp and after losing the itemid
This command can be
 
Lua:
function onStepIn(cid, item, pos)

	local thing = 1337 -- ID of item
	local destination = {x=1000, y=1000, z=7} -- Where to be teleported
	
	if isPlayer(cid) == true then
		if getPlayerItemCount(cid, thing) >= 1 then
			doTeleportThing(cid, destination)
			doPlayerRemoveItem(cid, thing, 1)
		else
			doPlayerSendTextMessage(cid, 22, "You need the item in order to teleport.")
		end
	else
		return false
	end

	return true
end

Or shorter version

Lua:
function onStepIn(cid, item, pos)
	if isPlayer(cid) ~= true and getPlayerItemCount(cid, 1222) < 1 then
		doPlayerSendTextMessage(cid, 22, "You need the item in order to teleport.")
	else
		doTeleportThing(cid, {x=1000, y=1000, z=7})
		doPlayerRemoveItem(cid, 1222, 1)
	end
end
 
Last edited:
Not sure of what you mean...

Use item: (onUse)

Lua:
function onUse(cid, item, topos, frompos)

	local t = 1223 -- ID of item to use
	local p = {x=1000, y=1000, z=7) -- Where to be teleported 

	if item.itemid == t then
		if isPzLocked(cid) == false then
			doTeleportThing(cid, p)
			doRemoveItem(item.uid, t) -- or doPlayerRemoveItem(cid, t, 1) ?
		else
			doPlayerSendTextMessage(cid, 22, "You must be inside protection zone.")
		end
		return false
	end
	
	return true
end

XML:
<action itemid="ITEM ID" script="teleport.lua"/>

Talkaction:

Lua:
function onSay(cid, item, param)
	if isPzLocked(cid) == false then
		if getPlayerItemCount(cid, 1222) >= 1 then
			doTeleportThing(cid, {x=1000, y=1000, z=7})
			doPlayerRemoveItem(cid, 1222, 1)
		else
			doPlayerSendTextMessage(cid, 22, "You need the item in order to teleport.")
		end
	else
		doPlayerSendTextMessage(cid, 22, "You must be inside protection zone.")
	end
	
	return true
end

XML:
<talkaction words="!teleport" script="teleport.lua"/>
 
Last edited:
Back
Top