Jump to content

Skip getLocalPlayer() using processLineOfSight()


Swimer

Recommended Posts

I have a small code that aims to find a car or a player, but the ray starts moving from the camera and crashes into my player, how do I cancel the collision with MY character?

 

if not isPedInVehicle(localPlayer) then
                local hit, x, y, z, elementHit = processLineOfSight ( ppx, py, pz, tx, ty, tz )
                if hit then
                    if elementHit then
                        local sX, sY = getScreenFromWorldPosition( getElementPosition(elementHit) )
                        -- dxDrawText("G", sX, sY, sX, sY, tocolor(255, 255, 255), 1, "default")
                        dxDrawImage(sX-16*px, sY-16*px, 32*px, 32*px, "assets/icons/PlayerInteract.png")
                        if not (target == elementHit) then
                            target = elementHit
                        end
                    else
                        if target then
                            target = nil
                        end
                    end
                else
                    if target then
                        target = nil
                    end
                end
            end

 

Link to comment
3 minutes ago, Burak5312 said:

I'm not sure but you can try this

if(elementHit ~= localPlayer) then

end

I need to get an object that is in front of the camera, but since GTA is a third-person game, the player’s neck or head is almost always in front of the camera, so I need ray to skip my player and continue moving on.

Link to comment
  • Tut locked this topic
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

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