Jump to content

how to detect when the player to aim in a cuboid?


Recommended Posts

try using this

function Cube(button, state, absX, absY, wx, wy, wz, element) 
    if getElementData(getLocalPlayer(), "exclusiveGUI") then 
        return 
    end 
    if element and getElementType( element ) == "object" and button == "right" and state == "down" and getElementModel(element) == "ELEMENTID" then 
        local x, y, z = getElementPosition(localPlayer) 
        
        if getDistanceBetweenPoints3D(x, y, z, wx, wy, wz) <= 3 then 
            if (wRightClick) then 
                hideregister() 
            end 
            
            showCursor(true) 
            ax = absX 
            ay = absY 
            register = element 
            showregister() 
        end 
    end 
end 
addEventHandler("onClientClick", getRootElement(), Cube, true) 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...