Making the door entity non-usable
#1
Trying to get the door to be non-usable if you are trying to open another player's door if you aren't on their 'buddy' list. atm I'm just using the following code:

Code:
PrivatePlayerData = {
    54,
    64,
    61,
    71,
    193,
    194,
    195,
    196,
    197,
}

function OnPlayerUsingBlock(Player, BlockX, BlockY, BlockZ, BlockFace, CursorX, CursorY, CursorZ, BlockType, BlockMeta)
    for k,v in pairs(PrivatePlayerData) do
        if (v == BlockType) then
            Player:SendMessageWarning("BlockType :: " .. BlockType)
            return true
        end
    end
end


It works fine with chests, the furnace and reads the ID's of the doors. but still opens them. Any help would be appreciated! Smile
Reply
Thanks given by:
#2
Could you try the OnPlayerRightClick hook instead of the OnPlayerUsingBlock hook?
Reply
Thanks given by:
#3
OnPlayerRightClick sadly doesn't work, tried it at first. Its missing BlockType variable, so it just gives me a nil value instead
Reply
Thanks given by:
#4
Use this:
function OnPlayerRightClick(Player, BlockX, BlockY, BlockZ, BlockFace, CursorX, CursorY, CursorZ)
	if (BlockFace == BLOCK_FACE_NONE) then
		return false
	end
	local BlockType = Player:GetWorld():GetBlock(BlockX, BlockY, BlockZ)
	local BlockMeta = Player:GetWorld():GetBlockMeta(BlockX, BlockY, BlockZ)
	-- Your code
end

Reply
Thanks given by: JonnyBoy0719
#5
oh wow, why didn't i think of that.Tongue

Cheers @NiLSPACE !Big Grin
Reply
Thanks given by:
#6
No problem Smile
Reply
Thanks given by:




Users browsing this thread: 2 Guest(s)