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

Remove Item

smstR

offline, bye
Joined
Nov 2, 2007
Messages
95
Reaction score
0
Hello,

i need a script, which removes X item if you walk through X teleporter.


Thanks for attention.
All the best,
smstR
 
Try this one (NOT TESTED!):
Code:
TFS/Data/Movevents/scripts/tp.lua
PHP:
local n = {position = {x = 1000, y = 1000, z = 7}, effect = 10}
function onStepIn(cid, item, position, fromPosition)
    if isPlayer(cid) == TRUE then
        doPlayerRemoveItem(cid, 1234, 1)
        doTeleportThing(cid, n.position, true)
        doSendMagicEffect(n.position, n.effect)
    else
        doPlayerSendCancel(cid, "You need to have item.")
    end
    return true
end
Code:
<movevent event="StepIn" actionid="59906" script="tp.lua" />
And in RME add teleport with aid 59906 and it should have no coordinates.
 
LUA:
local c = {
		tpt = {x = 1000, y = 1000, z = 7}, -- position where tp tp player
		tpItem = 00000 -- here item id numer
	}
function onStepIn(cid, item, position, fromPosition)
	if(not isPlayer(cid) then return false end
	
	if doPlayerRemoveItem(cid, tpItem, 1) then
		doTeleportThing(cid, c.tpt, false)
		doSendMagicEffect(c.tpt, CONST_ME_TELEPORT)
	else
		addEvent(doTeleportThing, 1, cid, fromPosition)
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You need to have...")
	end
	return true
end
XML:
<movevent event="StepIn" actionid="YOUR ACTION ID NR" script="tp.lua" />
 
LUA:
local c = {
		tpt = {x = 1000, y = 1000, z = 7}, -- position where tp tp player
		tpItem = 00000 -- here item id numer
	}
function onStepIn(cid, item, position, fromPosition)
	if(not isPlayer(cid) then return false end
	
	if doPlayerRemoveItem(cid, tpItem, 1) then
		doTeleportThing(cid, c.tpt, false)
		doSendMagicEffect(c.tpt, CONST_ME_TELEPORT)
	else
		addEvent(doTeleportThing, 1, cid, fromPosition)
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You need to have...")
	end
	return true
end
XML:
<movevent event="StepIn" actionid="YOUR ACTION ID NR" script="tp.lua" />

Tested this aswell, and didn't work /:
 
sorry, typo.. here:

LUA:
local c = {
		tpt = {x=861, y=93, z=8}, -- position where tp tp player
		tpItem = 2491 -- here item id numer
	}
function onStepIn(cid, item, position, fromPosition)
	if(not isPlayer(cid)) then return false end
 
	if doPlayerRemoveItem(cid, c.tpItem, 1) then
		doTeleportThing(cid, c.tpt, false)
		doSendMagicEffect(c.tpt, CONST_ME_TELEPORT)
	else
		addEvent(doTeleportThing, 1, cid, fromPosition)
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You need to have...")
	end
	return true
end
tested
 
Last edited:
sorry, typo.. here:

LUA:
local c = {
		tpt = {x=861, y=93, z=8}, -- position where tp tp player
		tpItem = 2491 -- here item id numer
	}
function onStepIn(cid, item, position, fromPosition)
	if(not isPlayer(cid)) then return false end
 
	if doPlayerRemoveItem(cid, c.tpItem, 1) then
		doTeleportThing(cid, c.tpt, false)
		doSendMagicEffect(c.tpt, CONST_ME_TELEPORT)
	else
		addEvent(doTeleportThing, 1, cid, fromPosition)
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You need to have...")
	end
	return true
end
tested

Why it is not working for me?, I've tried putting a destination to the teleport, using the script, and the teleport just lead you to the place of the coords, but if I remove the cords of the tlp at the mapeditor, and use the script the teleport just doesn't work D:
 
@up
actionid you gave on the map? and in action.xml?

@knight
fory you:
LUA:
local c = {
		{x=1111, y=1111, z=11},
		{x=1111, y=1111, z=11},
		{x=1111, y=1111, z=11},
		{x=1111, y=1111, z=11},
		{x=1111, y=1111, z=11}
}

function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
	if(not isPlayer(cid)) then return true end

	for i = 1, 4 in ipairs(c) do
		local czaha = getThingFromPos(i)
		if czaha.itemid ~= YOURITEMID then
			return doPlayerSendCancel(cid, "All items must be on the correct positions.")
		end
	end
	doSendMagicEffect(getThingPosition(cid), CONST_ME_POFF)
	doTeleportThing(cid, c[5])
	doSendMagicEffect(getThingPosition(cid), CONST_ME_TELEPORT)
	return true
end
 
Last edited:
@up
actionid you gave on the map? and in action.xml?

actionid of the teleport: 59906, and in scripts the same, 59906, btw, I just added the moveevent script, at moveevents.xml, and the .lua file at moveevent's scripts D:

Edit:
Btw, when I put the cords to the teleport at RME, it just lead me to the cords that I put at remeres, using the script, nothing happens, just lead me to the cords, and if I remove the cords at RME, it does not happen anything, I can walk over the teleport, and nothing happens.
 
Last edited:
LUA:
<movevent event="StepIn" actionid="59906" script="tptp.lua" />
LUA:
local c = {
		tpt = {x=1746, y=1855, z=7}, -- position where tp tp player
		tpItem = xxxxx -- here item id numer
	}
function onStepIn(cid, item, position, fromPosition)
	if(not isPlayer(cid)) then return false end
 
	if doPlayerRemoveItem(cid, c.tpItem, 1) then
		doTeleportThing(cid, c.tpt, false)
		doSendMagicEffect(c.tpt, CONST_ME_TELEPORT)
	else
		addEvent(doTeleportThing, 1, cid, fromPosition)
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You need to have bla, blah, blah")
	end
	return true
end

Here they are.
 
Back
Top