[Free]nb-freecam | Free moving camera and teleport to the camera point at

Lines (approximately) 200+
Requirements nb-keyevent
Github Link
Performance 0.02~0.03ms/0.0ms

exports

exports['nb-freecam']:TriggerFreeCamera() --true or false or nil, nil = auto

commands (admin)

/freecam

keys

W,S,A,D,LSHIFT

Preview

5 Likes

this is just noclip …

2 Likes

I guess you are right. It is for my other resource , with free-aim camera and used it for grabing something .Teleport to the near ground after that.

but is ran at .03ish every noclip is like 0.10+ if not 0.15+

2 Likes

Can you make a script like an instant teleport , like most drift server has it where if you press a certain key it will set the teleport point and when you press it again it will quickly teleport you to that point

1 Like

Do you mean the ‘Save/Load’ teleport script?

yea , i think that

local SavedPosition = nil
RegisterCommand('saveposition', function()
     SavedPosition  = GetEntityCoords(PlayerPedId())
end, false)
RegisterCommand('loadposition', function()
if SavedPosition then 
      StartPlayerTeleport(PlayerId(), SavedPosition.x, SavedPosition.y, SavedPosition.z, 0.0, false, true, true)

      while IsPlayerTeleportActive() do
        Citizen.Wait(0)
      end
end
end, false)

RegisterKeyMapping('saveposition', 'Save Position', 'keyboard', 'F4')
RegisterKeyMapping('loadposition', 'Load Position', 'keyboard', 'F5')
1 Like

man im in love with you!

2 Likes

Also, there is a snippet in this script to get a coords from camera point at.But it would fail to get coords sometimes.

local sin = math.sin
local cos = math.cos
local torad = math.pi / 180
function GetCoordsFromGamePlayCameraPointAtSynced(ingoredEntity) 
    local action = 0
    local distance = 300
    local coordsVector =  GetFinalRenderedCamCoord() ;
    local rotationVectorUnrad = GetFinalRenderedCamRot(2);
    local rotationVector = rotationVectorUnrad * torad
    local directionVector =  vector3(-sin(rotationVector.z) * cos(rotationVector.x), (cos(rotationVector.z) * cos(rotationVector.x)), sin(rotationVector.x));
    local destination =  coordsVector + directionVector * distance ;
    local playerPed = PlayerPedId()
    local destination_temp = coordsVector + directionVector * 1 ;
    local getentitytype = function(entity)
       local type = GetEntityType(entity)
       local result = "solid"
       if type == 0 then 
          result = "solid"
       elseif type == 1 then 
          result = "ped"
       elseif type == 2 then 
          result = "vehicle"
       elseif type == 3 then 
          result = "object"
       end 
       return result
    end 
    
    local shapeTestId = StartExpensiveSynchronousShapeTestLosProbe(destination_temp, destination, 511, ingoredEntity or playerPed, 1)
    local shapeTestResult , hit , endCoords , surfaceNormal , entityHit = GetShapeTestResult(shapeTestId)
    return hit and endCoords
end 

I have a snippet collection in Github: simple_snippets

Can you make it so it only works in a car driver seat?

local SavedPosition = nil
RegisterCommand('saveposition', function()
    local playerPed = PlayerPedId()
    local playerVehicle = GetVehiclePedIsIn(playerPed)
    if GetPedInVehicleSeat(playerVehicle, -1) then
        SavedPosition  = GetEntityCoords(playerPed)
    else
        print("You have to be in a car as a driver.")
    end
end, false)
RegisterCommand('loadposition', function()
    local playerPed = PlayerPedId()
    local playerVehicle = GetVehiclePedIsIn(playerPed)
    if GetPedInVehicleSeat(playerVehicle, -1) then
        if SavedPosition then 
            StartPlayerTeleport(PlayerId(), SavedPosition.x, SavedPosition.y, SavedPosition.z, 0.0, false, true, true)

            while IsPlayerTeleportActive() do
                Citizen.Wait(0)
            end
        end
    else
        print("You have to be in a car as a driver.")
    end
end, false)

RegisterKeyMapping('saveposition', 'Save Position', 'keyboard', 'F4')
RegisterKeyMapping('loadposition', 'Load Position', 'keyboard', 'F5')
1 Like

This does not seems to be working , it works even if you are a passenger or out side the car

i wrote you in dm to no disturb here