I’ve been looking for a script or a way to force First Person on players when they are doing a drive-by as the driver but couldn’t find anything.
So I spent the last hour trying different methods and functions and I finally got it to work.
As I believe there is no publicly released script that can achieve this purpose, I wanted to share my code with the community
- I also made it so when the player stops doing the drive-by it’ll switch him back to the view cam that he had before.
So, for this to work, put this code on the client side
------------------------------------------------------
--------- Forced First Person On Driveby -----------
------------------------------------------------------
local recentViewMode = 0
local changedViewMode = false
Citizen.CreateThread(function()
while true do
Citizen.Wait(10)
local ped = PlayerPedId()
if IsPedInAnyVehicle(ped) then
local veh = GetVehiclePedIsIn(ped, false)
if GetPedInVehicleSeat(veh, -1) == ped and IsPedDoingDriveby(ped) then
if GetFollowVehicleCamViewMode() ~= 4 then
recentViewMode = GetFollowVehicleCamViewMode()
local context = GetCamActiveViewModeContext()
SetCamViewModeForContext(context, 4)
changedViewMode = true
end
end
if changedViewMode and not IsPedDoingDriveby(ped) then
local context = GetCamActiveViewModeContext()
SetCamViewModeForContext(context, recentViewMode)
changedViewMode = false
end
end
end
end)
4 Likes
there now way u can make it to where the hang out the window and do drive bys like in GTA SA
I don’t think that’s possible with GTA natives but maybe someone can create a custom animation that should make that possible