Hello, and welcome to the forum.
You mean if it has a block attached to it? You'll have to check the block next to it with cWorld:GetBlock() You'll have to check the meta to see if it's actually attached though.
function IsAttached(a_World, a_BlockX, a_BlockY, a_BlockZ, a_RequiredMeta)
local Block, Meta = a_World:GetBlockTypeMeta(a_BlockX, a_BlockY, a_BlockZ)
if ((Block == E_BLOCK_TORCH) or (Block == E_BLOCK_STONE_BUTTON)) then
-- return true if the meta is correct
end
return false
end
function OnPlayerLeftClick(a_Player, X, Y, Z)
local World = a_Player:GetWorld()
-- I used some random numbers as meta value
if (not IsAttached(World, X + 1, Y, Z, 5) and
not IsAttached(World, X - 1, Y, Z, 2) and
not IsAttached(World, X, Y, Z + 1, 1) and
not IsAttached(World, X, Y, Z - 1, 0)
) then
-- Block is not attached, bail out.
return false
end
-- Do whatever you want to do if there is a torch or button attached
end