If you want to get the target in the center of the screen, you can use getCameraMatrix. It returns the camera position and lookat position, which is a unit vector from the camera position, so you can easily multiply it to get a point further out.
Made the following so you can see if thats what you need.
local scrW, scrH = guiGetScreenSize()
local maxTargetDistance = 100
addEventHandler("onClientPreRender", root,
function()
local cx, cy, cz, lx, ly, lz = getCameraMatrix()
local px = cx + (lx - cx) * maxTargetDistance
local py = cy + (ly - cy) * maxTargetDistance
local pz = cz + (lz - cz) * maxTargetDistance
local hit, hx, hy, hz, hitElement = processLineOfSight(cx, cy, cz, px, py, pz, true, true, true, true, true, false, false, false, localPlayer)
dxDrawRectangle(scrW/2 - 5, scrH/2 - 5, 10, 10)
if hit then
dxDrawLine3D(hx, hy, hz + 1, hx, hy, hz)
end
end)