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

Solved How to check what item is on specific position?

Guxi

Developer
Joined
Mar 17, 2012
Messages
128
Reaction score
12
Location
Croatia
How can i know what item is on top of this ( 1000, 1000, 7)


For example, if someone puts plate armor on that pos, and if i run my lua script, it should return TRUE.


( this is emergency)
thanks in advance!
 
LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)

local item = 2160
local pos = {x = 979, y = 1461, z = 4}	

if getTileItemById(pos, item).uid > 0 then
??
??
end
return true
end

Something like this? xD
 
LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
 
local item = 2160
local pos = {x = 979, y = 1461, z = 4}	
 
if getTileItemById(pos, item).uid > 0 then
??
??
end
return true
end

LUA:
local pos = {x = 979, y = 1461, z = 4}
<-- This "pos" is the position where it gonna check the "item"

LUA:
local item = 2160
<-- What "item" it should check

LUA:
if getTileItemById(pos, item).uid > 0 then
<-- This one check if the item is there

- - - Updated - - -

Or you can use like this:

LUA:
local config = {
	item = 2160,
	toget = 8930,
}

function onUse(cid, item, fromPosition, itemEx, toPosition)

local pos = {x = 1052, y = 1473, z = 6}

if getTileItemById(pos, config.item).uid > 0  then
if doRemoveItem(getTileItemById(pos, config.item).uid,1)  then
if item.itemid == 1945 then
					doTransformItem(item.uid, 1946)
				elseif item.itemid == 1946 then
					doTransformItem(item.uid, 1945)
				end

				doPlayerAddItem(cid, config.toget)
				return true
end
end  
   	doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, "You dont have put the right items on the table!")
   	return true
end
 
Last edited:
Back
Top