• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

[Script Request] Item remove + teleport

Epic

Banned User
Joined
Mar 30, 2009
Messages
1,142
Reaction score
1
Location
Barcelona (Spain)
Hello, i need a script that when I put itemID xxxx on the empty coal basin in X Y Z while standing in X Y Z tile and use a lever, teleports me to X Y Z. Check this image for that i mean:

questodg.jpg


Thanks! :D
 
You should just add
LUA:
local name = getItemName(itemId)
and
LUA:
doPlayerSendCancel(cid, "You need to put a ".. name .." on the coal basin and stay on the right position.")
 
You should just add
LUA:
local name = getItemName(itemId)
and
LUA:
doPlayerSendCancel(cid, "You need to put a ".. name .." on the coal basin and stay on the right position.")

i don't think so.

Put itemID xxxx on the Coal basin, Step in the tile, pull the lever, and if the itemID on the coal basin = xxxx, and i am in XYZ tile, the item dissapears and i get teleported to XYZ :D
 
LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local tpPos = {x = 100, y = 100, z = 7}
local pPos = {x = 200, y = 200, z = 7, stackpos = 253} -- dont touch the stackpos
local itemPos = {x = 201, y = 201, z = 7, stackpos = 1}
local getItem = getThingFromPos(itemPos)
local getPlayer = getThingFromPos(pPos)
local itemId = 2160

		if getPlayer.itemid > 0 then
			if getItem.itemid == itemId then
				doRemoveItem(getItem.uid, 1)
				doSendMagicEffect(getPlayer.uid, CONST_ME_POFF)
				doTeleportThing(getPlayer.uid, tpPos)
				doSendMagicEffect(tpPos, 37)
				
		else
				doPlayerSendCancel(cid, "You have to stay on the right position and put the "..getItemNameById(itemId).." on the coal basin")
				end
		end
			return TRUE
	end

This:)

You can set the action id on the lever in actions.xml
You should just add
LUA:
local name = getItemName(itemId)
and
LUA:
doPlayerSendCancel(cid, "You need to put a ".. name .." on the coal basin and stay on the right position.")


Really? He have just to put his itemId and the item name will show as you see I have a variable called itemId so getItemNameById(itemId <-- the variable)

I'm using byId :)
 
Last edited:
LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local tpPos = {x = 100, y = 100, z = 7}
local pPos = {x = 200, y = 200, z = 7, stackpos = 253} -- dont touch the stackpos
local itemPos = {x = 201, y = 201, z = 7, stackpos = 1}
local getItem = getThingFromPos(itemPos)
local getPlayer = getThingFromPos(pPos)
local itemId = 2160

		if getPlayer.itemid > 0 then
			if getItem.itemid == itemId then
				doRemoveItem(getItem.uid, 1)
				doSendMagicEffect(getPlayer.uid, CONST_ME_POFF)
				doTeleportThing(getPlayer.uid, tpPos)
				doSendMagicEffect(tpPos, 37)
				
		else
				doPlayerSendCancel(cid, "You have to stay on the right position and put the "..getItemNameById(itemId).." on the coal basin")
				end
		end
			return TRUE
	end

This:)

You can set the action id on the lever in actions.xml

Thanks mate, ++ rep for you! :D
 
i don't think so.

Put itemID xxxx on the Coal basin, Step in the tile, pull the lever, and if the itemID on the coal basin = xxxx, and i am in XYZ tile, the item dissapears and i get teleported to XYZ :D

Its the same thing...
"I do think so."
 
You should just add
LUA:
local name = getItemName(itemId)
and
LUA:
doPlayerSendCancel(cid, "You need to put a ".. name .." on the coal basin and stay on the right position.")

Ehm...

LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local tpPos = {x = 100, y = 100, z = 7}
local pPos = {x = 200, y = 200, z = 7, stackpos = 253} -- dont touch the stackpos
local itemPos = {x = 201, y = 201, z = 7, stackpos = 1}
local getItem = getThingFromPos(itemPos)
local getPlayer = getThingFromPos(pPos)
local itemId = 2160

		if getPlayer.itemid > 0 then
			if getItem.itemid == itemId then
				doRemoveItem(getItem.uid, 1)
				doSendMagicEffect(getPlayer.uid, CONST_ME_POFF)
				doTeleportThing(getPlayer.uid, tpPos)
				doSendMagicEffect(tpPos, 37)
				
		else
				doPlayerSendCancel(cid, "You have to stay on the right position and put the "..getItemNameById(itemId).." on the coal basin")
				end
		end
			return TRUE
	end

This:)

You can set the action id on the lever in actions.xml

Its the same thing...
"I do think so."

No? xD
 
Back
Top