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

[Req] when player step in if have itemid,count doteleport

kimokimo

Kimo
Joined
Jan 25, 2011
Messages
821
Solutions
6
Reaction score
156
GitHub
karimadnan
as the title say when the player step on a tile if he have itemid,count get teleported to x,x,x if he dont then teleport to x,x,x
 
LUA:
function onStepIn(cid, item, pos, fromPos)
	if isPlayer(cid) then
		local p
		if getPlayerItemCount(cid, itemid) == 0 then
			p = {x=100, y=100, z=7} -- no item
		else
			p = {x=100, y=100, z=7}
		end
		doTeleportThing(cid, p)
		doSendMagicEffect(pos, CONST_ME_POFF)
		doSendMagicEffect(p, CONST_ME_TELEPORT)
	end
end
 
PHP:
function onStepIn(cid, item, pos, fromPos)
	if isPlayer(cid) then
		local p
		if doPlayerRemoveItem(cid, itemid) == 0 then
			p = {x=100, y=100, z=7} -- no item
		else
			p = {x=100, y=100, z=7}
		end
		doTeleportThing(cid, p)
		doSendMagicEffect(pos, CONST_ME_POFF)
		doSendMagicEffect(p, CONST_ME_TELEPORT)
	end
end
Does this work? sorry for double post
 
LUA:
function onStepIn(cid, item, pos, fromPos)
	if isPlayer(cid) then
		local items = {
					Amount = 1,
					Name = "Spike Sword",
					ID = 1337
				}
		local t = {
				pos = {z=1000, y=1000, z=7}, -- Position if have the items
				npos = {z=1000, y=1000, z=7} -- Position if dont have the items
			
			}
				
-- SCRIPT START
		if getPlayerItemCount(cid, items.ID) >= items.Amount then
			doPlayerRemoveItem(cid, items.ID, items.Amount)
			doTeleportThing(cid, t.pos)
	else
			doTeleportThing(cid, npos)
			doPlayerSendTextMessage(cid, 25, "Sorry, but you need ".. items.Amount .." ".. items.Name .." to use this portal.")
		end
		end
		return true
		end
 
LUA:
local itemid,count = 1025,1 -- first is itemid of item to be removed, second is count of the item.
function onStepIn(cid, item, pos, fromPos)
    if isPlayer(cid) then
        local p
        if doPlayerRemoveItem(cid, itemid, count) then
            p = {x=100, y=100, z=7} -- has item
        else
            p = {x=100, y=100, z=7} -- no item
        end
        doTeleportThing(cid, p)
        doSendMagicEffect(pos, CONST_ME_POFF)
        doSendMagicEffect(p, CONST_ME_TELEPORT)
    end
end

there you go
 
Back
Top