[RELEASE] First person shooting from all vehicles

First person shooting from all vehicles (cars, bikes, boats, etc)

Looking for a script to force players to use first person when shooting from all vehicles? Look no further! This is a great script for RP servers.

This was very helpful for us to stop players from driving around backwards unrealistically during gunfights since third person shooting lets you shoot in a 360 degree angle without obstruction and often times the vehicle will block any bullets from the rear

It is also helpful to make aiming a bit more difficult and realistic than it is in 3rd person when in a vehicle

Screenshot

weaponsonback

Features

  • Standalone
  • Works on all vehicles (cars, bikes, boats, etc)
  • Resets camera mode properly after forcing first person
  • Optimized
  • Easy Install

Installation

  • Purchase from here
  • Put the usa-firstPersonVehicleShooting folder into your server’s resources folder.
  • Add ensure usa-firstPersonVehicleShooting to your server’s server.cfg file.
  • Enjoy!

Let us know if you run into any issues or have any suggestions!

Code is accessible No
Subscription-based No
Lines (approximately) 47
Requirements None
Support Yes
5 Likes

Was made in 2018 for free. Why pay for it. what does yours do better ?

3 Likes

Also fix your post tags. Missing Paid tag

“Was made in 2018 for free. Why pay for it. what does yours do better ?”

Well

  1. my script is limited to vehicles only (not on foot)
  2. that script does not work for motorcycles whereas mine does

Those are a couple significant differences for you

So you mean like this

local shot = false
local check = false
local check2 = false
local count = 0

CreateThread(function()
while true do
SetBlackout(false)
Wait(1)
if IsPlayerFreeAiming(PlayerId()) then
if GetFollowPedCamViewMode() == 4 and check == false then
check = false
else
SetFollowVehicleCamViewMode(4)
check = true
end
else
if check == true then
SetFollowVehicleCamViewMode(1)
check = false
end
end
end
end)

CreateThread(function()
while true do
SetBlackout(false)
Wait(1)

    if IsPedShooting(PlayerPedId()) and shot == false and GetFollowPedCamViewMode() ~= 4 then
        check2 = true
        shot = true
        SetFollowVehicleCamViewMode(4)
    end

    if IsPedShooting(PlayerPedId()) and shot == true and GetFollowPedCamViewMode() == 4 then
        count = 0
    end

    if not IsPedShooting(PlayerPedId()) and shot == true then
        count = count + 1
    end

    if not IsPedShooting(PlayerPedId()) and shot == true then
        if not IsPedShooting(PlayerPedId()) and shot == true and count > 20 then
            if check2 == true then
                check2 = false
                shot = false
                SetFollowVehicleCamViewMode(1)
            end
        end
    end
end

end)

1 Like

No, but nice try lol

Maybe review what I said was different one more time and try your script again and let me know if it does what I said mine does (hint: it doesn’t)

And I would prefer you not belittle the release anymore and instead make your own :+1:

hmmm here you go

local Infos = {
	["InCar"] = {Value = false, LastTime = 0},
	["Player"] = {Handel = -1, HandelId = -1, LastTime = 0},
	["Cam"] = {LastCam = -1, CamChanged = false, LastTime = 0},
	["Aimed"] = {Value = false, LastTime = 0},
}
IsPlayerFreeAimed = function(PedHandel,PedId)
	if IsPlayerFreeAiming(PedId) or IsPedShooting(PedHandel) or IsAimCamActive() or IsAimCamThirdPersonActive() then
		return true
	else
		return false
	end
end
SetCam = function(CamId)
    Citizen.CreateThreadNow(function()
        SetFollowPedCamViewMode(CamId)
        SetFollowVehicleCamViewMode(CamId)
        for i = 0, 7 do
            SetCamViewModeForContext(i, CamId)
        end
    end)
end
Citizen.CreateThread(function()
	while true do
		Citizen.Wait(0)
		local Now = GetGameTimer()
		if Infos["Player"].Handel == -1 or Infos["Player"].LastTime + 1000 < Now then
			Infos["Player"].Handel = PlayerPedId()
			Infos["Player"].HandelId = PlayerId()
			Infos["Player"].LastTime = Now
		end
		if Infos["Cam"].LastTime + 100 < Now then
			if not Infos["Cam"].CamChanged then
				Infos["Cam"].LastCam = GetFollowVehicleCamViewMode()
			end
			Infos["Cam"].LastTime = Now
		end
		if Infos["InCar"].LastTime + 100 < Now then
			Infos["InCar"].Value = IsPedInAnyVehicle(Infos["Player"].Handel, false)
			Infos["InCar"].LastTime = Now
		end
		if Infos["InCar"].Value then
			-- if Infos["Aimed"].LastTime + 50 < Now then
			-- 	Infos["Aimed"].Value = IsPedArmed(Infos["Player"].Handel, 4) and IsPlayerFreeAimed(Infos["Player"].Hande, Infos["Player"].HandelId)
			-- 	Infos["Aimed"].LastTime = Now
			-- end
			-- if Infos["Aimed"].Value then -- somehow this get bug and dont show well
			if IsControlJustPressed(0,68) then
                SetCam(4)
				Infos["Cam"].CamChanged = true
			elseif not Infos["Aimed"].Value and Infos["Cam"].CamChanged then
                SetCam(Infos["Cam"].LastCam)
				Infos["Cam"].CamChanged = false
			end
		elseif not Infos["InCar"] and Infos["Cam"].CamChanged then
            SetCam(Infos["Cam"].LastCam)
			Infos["Cam"].CamChanged = false
		end
	end
end)
3 Likes

Its not belittle. Its something thats already on the forums for free. And that codes work just as your paid release does.

now this on vehicle optimized clean and all that you mention in there also will return in pervious cam

It doesn’t mate, I’m not going to argue further but I literally just tried your code and can tell you positively that it does not work the same lol

Your code doesn’t even run due to errors :put_litter_in_its_place: (respectfully)

Also, make your own release broski

edited i just place logic in like 2 or 3 min didnt tested but now edited and working on all vehicle just need read SetCamViewModeForContext native for set cam in anything like foot car bike boat
btw

its not something to be one post btw just some little code i just wonder why this need be as paid thing

1 Like

btw credits goes to nelsondarosa for tell about SetCamViewModeForContext

Please fill out template that you deleted when making the post.

1 Like

hey, thanks for tagging me. I already made a script that does this, it also makes the player keep the third person animations while on FP on foot. You can download, modify and use the way you want. Check it out. Leave a star on the repository so more people can reach it.

Feel free to ask me anything if theres any doubts.

Edit: I have not tested the script for 2 years now, and I cant now, you may have to modify it.

1 Like

I’ve been using this code and it works great. However you can currently exploit it if you hold right click while pulling a gun out while in a vehicle. It stays in third person until you release right click and press again.

Any chance of patching this?

That exploit does not exist in the paid script FYI

I recommend trying that :smile:

you still trying to sell this script bro ? …

Good luck <3

1 Like

hey bro, to fix this exploit, at the bottom of the code (if IsControlJustPressed(0,68) then)
change IsControlJustPressed to IsControlPressed
remove (Just) from it and it will work

I just tested it, and it works for me

1 Like
-------------------------------------------
---------- Force FPS when shoting ---------
-------------------------------------------

CreateThread(function()
    while true do
        sleep = 1000
        local _, weapon = GetCurrentPedWeapon(PlayerPedId())
        local unarmed = `WEAPON_UNARMED`
        if weapon == unarmed then
            sleep = 1000
        else
            local ped = PlayerPedId()
            local veh = GetVehiclePedIsIn(ped, false)
            local vehentity = GetEntityModel(veh)
            local onfoot = IsPedOnFoot(ped)
            local incar = IsThisModelACar(vehentity)
            local onbike = IsThisModelABike(vehentity)
            sleep = 1
            -- if onfoot then
            --     if IsPlayerFreeAiming(PlayerId()) then
            --         SetFollowPedCamViewMode(4)
            --     else
            --         SetFollowPedCamViewMode(0)
            --     end
            -- end
            if incar then
                if IsPlayerFreeAiming(PlayerId()) then
                    SetFollowVehicleCamViewMode(4)
                else
                    SetFollowVehicleCamViewMode(0)
                end
            end
            if onbike then
                if IsPlayerFreeAiming(PlayerId()) then
                    SetCamViewModeForContext(2, 4)
                else
                    SetCamViewModeForContext(2, 0)
                end
            end
        end
        Wait(sleep)
    end
end)

have fun everyone <3 @dreckigeralbaner