Hey, so i’m at present engaged on storage merchandise ,
what i want is when i goal the entity storage field it present me the info on which is at present goal
and never different one close to.

I’ll allow you to a video it is going to clarify rather a lot higher what i imply

as you’ll be able to see on the preview video it present me solely rely with distance of the participant – storage place and never the goal the place the participant is going through.

That is what i’m utilizing as raycast for the goal distance on entity :

native perform RotationToDirection(rotation)
    native adjustedRotation = 
    { 
        x = (math.pi / 180) * rotation.x, 
        y = (math.pi / 180) * rotation.y, 
        z = (math.pi / 180) * rotation.z 
    }

    native path = 
    {
        x = -math.sin(adjustedRotation.z) * math.abs(math.cos(adjustedRotation.x)), 
        y = math.cos(adjustedRotation.z) * math.abs(math.cos(adjustedRotation.x)), 
        z = math.sin(adjustedRotation.x)
    }
    return path
finish

native perform RayCastGamePlayCamera(v, okay, distance)
    native cameraRotation = GetGameplayCamRot()
    native cameraCoord = GetGameplayCamCoord()
    native path = RotationToDirection(cameraRotation)
    native tempEntity = nil
    native vacation spot = 
    { 
        x = cameraCoord.x + path.x * distance, 
        y = cameraCoord.y + path.y * distance, 
        z = cameraCoord.z + path.z * distance 
    }

    

    native a, b, c, d, e = GetShapeTestResult(StartShapeTestRay(cameraCoord.x, cameraCoord.y, cameraCoord.z, vacation spot.x, vacation spot.y, vacation spot.z, -1, -1, 1))

    DrawLine(cameraCoord.x, cameraCoord.y, cameraCoord.z, path.x, path.y,path.z, 255, 255, 255, 255)

    if (b and IsEntityAnObject(e)) then 

        DrawText3DMarker(Storage[k].pos.x, Storage[k].pos.y, Storage[k].pos.z, okay)

        DrawMarker(0, Storage[k].pos.x, Storage[k].pos.y, Storage[k].pos.z, 0, 0, 0, 0, 0, 0, 0.3, 0.3, 0.3, 255, 255, 255, 200, 0, 0, 0, 0)

        if (IsControlJustReleased(0, 38) or IsControlJustReleased(0, 214)) then --> E
            print(Storage[k].id_unique)
        finish
    finish
    return b,c,e,okay
finish

Citizen.CreateThread(perform()
	whereas (true) do
        TimerOpti = 0
        --OnMenuCoffreVeh()
        --OnMenuPlayerInventaire()

        native plyCoords = GetEntityCoords(GetPlayerPed(-1), false)
    
       
        for okay, v in pairs(Storage) do 
            native dist = getDistance(plyCoords, v.pos)
            if (dist <= 3.0) then 
                RayCastGamePlayCamera(v, okay, dist)
                break
            finish
        finish
        
        if RageUI.Seen(mainMenuStorage) == true then 
            TimerOpti = 0
            DisableControlAction(0, 140, true) --> DESACTIVER LA TOUCHE POUR PUNCH
            DisableControlAction(0, 172, true) --DESACTIVE CONTROLL HAUT  
        finish

        Citizen.Wait(TimerOpti)
    finish
finish)

If some one can redirect me in the fitting approach will probably be tremendous cool else it’s okay thanks anyway in your time.



Looking for paid scripts? Click here