Is ti possible to disable the autoaiming for the player who's playing with a controller

where should i put this code? Could you make a release real quick?

2 Likes

put it in a client.lua file

Citizen.CreateThread(function()
	while true do
		Citizen.Wait(0)
		if currentWeaponHash ~= -1569615261 then
        	SetPlayerLockon(PlayerId(), false)
        else
        	SetPlayerLockon(PlayerId(), true)
		end
	end
end)

works best thx for sharing this native with me

1 Like

Keep in mind that doing so breaks this native:

IsPlayerFreeAiming
1 Like

Where do I find this

1 Like

I am still having the issue of not being able to melee attack. We can’t focus on locals or each other for melee attacks. Are there any solutions?

2 Likes

How so?

I’ve had issues w/ core-evidence. When aiming my flash light I couldn’t see shell casings anymore or destroy evidence. The dev who created core-evidence had to make it so shell casings would show whenever I’m holding a flashlight instead of aiming it. IsPlayerFreeAiming has definitely be affected

1 Like

wont lock on melee attacks now

1 Like

Is this done in any script? like police job or qb-weapon?

This is the code you want. Make sure to add it to a client.lua and you should be good.

Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
SetPlayerTargetingMode(2)
end
end)

1 Like

I think u actually want to use SetPlayerTargetingMode(3), not 2

see: SetPlayerTargetingMode - FiveM Natives @ Cfx.re Docs

What I have set works for me so I don’t.

where?

where did you put this?

I’m going to assume anywhere you have free space.

as long as it’s not inside a function or method you will be fine.

client sided. so any client.lua. If on qbcore, i suggest the ignore.lua at the bottom

Anyone know if this still works?