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

Lua yalahar gates

niladar

Xampera RL Project
Joined
Jan 9, 2009
Messages
154
Reaction score
0
Location
Sweden
Code:
local gates = {}
gates[11536] = {fromPos = {x=631,y=667,z=5,stackpos=1}, toPos = {x=634,y=668,z=5}, tp_x = nil, tp_y = 669, itemid = 9485}

function onUse(cid, item)
	local gate = gates[item.uid]
	if(gate) then
		local gateTileItem = getThingFromPos(gate.fromPos).itemid
		if(gateTileItem == gate.itemid) then
			for x = gate.fromPos.x, gate.toPos.x do
				for y = gate.fromPos.y, gate.toPos.y do
					local gateItemUID = getTileItemById({x=x,y=y,z=gate.fromPos.z}, gate.itemid).uid
					if(gateItemUID > 0) then
						doRemoveItem(gateItemUID)
					end
				end
			end
		else
			for x = gate.fromPos.x, gate.toPos.x do
				for y = gate.fromPos.y, gate.toPos.y do
					local gateCreature = getTopCreature({x=x,y=y,z=gate.fromPos.z}).uid
					if(gateCreature > 0) then
						local creaturePos = getThingPosition(gateCreature)
						if(gate.tp_x) then
							creaturePos.x = gate.tp_x
						end
						if(gate.tp_y) then
							creaturePos.y = gate.tp_y
						end
						doTeleportThing(gateCreature, {x=creaturePos.x, y=creaturePos.y, z=creaturePos.z}, true)
					end
					doTileAddItemEx({x=x,y=y,z=gate.fromPos.z}, doCreateItemEx(gate.itemid))
				end
			end
		end
	end
	return true
end
what is wrong with that script? when i click on the mechanism all people who stand on that line ---> get teleportet and the gates removes..
 
Back
Top