https://community.multitheftauto.com/index.php?p=resources&s=details&id=652
I did a lot of research, but I didn't find much information, there was a study similar to this in the community, can you check it, maybe there is some code that will work for you
ray = {}
addEventHandler("onClientPlayerWeaponFire", getRootElement(), function( _, tAmmo, cAmmo, hX, hY, hZ, hElement, sX, sY, sZ)
local muzzleX, muzzleY, muzzleZ = getPedWeaponMuzzlePosition(source)
local targetX, targetY, targetZ = getPedTargetEnd(source)
local collisionX, collisionY, collisionZ = getPedTargetCollision(source)
if(collisionX) then
table.insert(ray, {muzzleX, muzzleY, muzzleZ, collisionX, collisionY, collisionZ})
else
table.insert(ray, {muzzleX, muzzleY, muzzleZ, targetX, targetY, targetZ})
end
end)
function drawRays()
for i, v in ipairs( ray ) do
dxDrawLine3D( v[ 1 ], v[ 2 ], v[ 3 ], v[ 4 ], v[ 5 ], v[ 6 ], tocolor( 255, 0, 0, 100 ), 2 )
end
end
addEventHandler( "onClientRender", root, drawRays )
bro can you test it i tested it works