Jump to content

Weapon Zoom


RekZ

Recommended Posts

Hello, a while ago i was trying to create a binocular script and i had to do something a bit similar. I couldn't find a way to do exactly what i wanted but it worked like that :

function sniperAutoZoom()
	local weapon = getPedWeapon(localPlayer)
	if weapon == 34 then
		setPedControlState(localPlayer, "zoom_out", true )
	else
		setPedControlState (localPlayer, "zoom_out", false )
	end
end

addEventHandler("onClientPlayerWeaponSwitch", localPlayer, sniperAutoZoom)

For some reason "zoom_in" actually zoom out, and "zoom_out" zoom in for me, maybe my controls are wrong idk.

This solution is not great cause the zoom is not instant and you can't zoom out if needed. You could maybe add a timer so it only zoom in for a little while and then allow players to zoom out if needed.

Link to comment
4 hours ago, Spakye said:

Ah my bad, sorry i dont know then. Maybe with flags as you said but none seems to match what you want ?

 i found something that i think i can use jajaja, thanks for help anyway

setCameraFieldOfView

 

  • Thanks 1
Link to comment
1 hour ago, Spakye said:

Im afraid it won't work, it says : Note: setCameraFieldOfView does not affect the FOV for the following camera modes: 1) Player aiming 2) Vehicle front bumper camera 3) Fixed camera.

I hope it will though!

The M4 FOV is 50, with this function adjust the fov to 50 when the player aim, I can manually adjust the fov to 50 so that it loads faster than the GTA Default FOV, it's a bad implementation but for what I'm looking for it works for me xd

Edited by RekZ
  • Haha 1
Link to comment
  • 1 month later...
On 25/04/2022 at 08:34, Spakye said:

Receio que não funcione, ele diz : Nota: setCameraFieldOfView não afeta o FOV para os seguintes modos de câmera: 1) Mira do jogador 2) Câmera do pára-choque dianteiro do veículo 3) Câmera fixa.

Espero que sim!

e ativar primeira pessoa pelo setWeaponProperty usando comando ? ativar e desativar ele com comando, tem como ?

Link to comment
On 4/24/2022 at 2:36 AM, RekZ said:

Hello, i'm looking for some way to fast the weapon zoom when i'm aiming.

Maybe i can edit the flags using ?

setWeaponProperty

 

I do not understand what you want to adjust, can you clarify that, a solution that you mean to enlarge the zoom of the weapon or a picture of the extended camera

Link to comment
20 hours ago, Mr.Hugin said:

Eu não entendi o que você quer ajustar, você pode esclarecer isso, uma solução que você pretende aumentar o zoom da arma ou uma foto da câmera estendida

I wanted to add a command to be able to activate and deactivate this script whenever the player wants, example: of /weapon and turn flag_aim_1st_person of /weapon again and turn off flag_aim_1st_person

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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