Disable Pistol Whiping

Hey I was wondering how to disable Pistol Whiping. So when I stand near a player and Shoot or Reload I don’t knock him over. Please help.

Place these lines of code in a loop:

https://github.com/inferno-collection/Weapons/blob/d8ee3d4197dc14c474d43f824d7e9870c3d38ca4/[inferno-collection]/inferno-weapons/client.lua#L379&L385

Pulled from one of my resources because I’m on mobile.

What you mean In a loop? Do I just coppy the whole thing and make a script?

Don’t copy the entire thing unless you want to use that resource; it does more than just disable pistol whip.

Place this code in a script:


Citizen.CreateThread(function()
	while true do
		Citizen.Wait(0)
 
			-- Disable Pistol whip
			DisableControlAction(0, 140, true)
			DisableControlAction(0, 141, true)
			DisableControlAction(0, 142, true)
			DisableControlAction(0, 263, true)
			DisableControlAction(0, 264, true)

	end
end)
1 Like

Thank you.

1 Like

Or instead of running useless stuff on clients & disabling controls, edit the meta files and remove AllowCloseQuarterKills from weapon flags

3 Likes

Interesting alternative, are you achieving this through streaming custom metas for every single weapon?

1 Like

Believe to do it entirely correctly you have to edit the general weapons.meta & any other more specific files (IE: weaponrevolver.meta) but I’ve made the change in just weapons.meta and it’s working. Also possible to do things like change tazer length, make the tazer actually not kill people, or remove damage from punching/melee weapons.

2 Likes

When I do that I cant even Punch Stab or do damage in front of players.

1 Like

Where are those Meta Files?

Not a bad idea to be honest, +1.

1 Like

If you’re sticking with doing it in code and not metas, you’ll need to add a check to see if the ped is armed.

Someone know where those weapon.meta files are? Searching whole day for it.

Use OpenIV to get the latest, then just add it to any resource and add:

files {
    'weapons.meta',
}
data_file 'WEAPONINFO_FILE_PATCH' 'weapons.meta'

To your manifest file

2 Likes

I’ll link this for additional reading, for anyone reading in the future wanting to take it further.

1 Like

Yeah but I cant the weapons.meta in OpenIV. I need to know exactly where.

\update\update.rpf\common\data\ai

1 Like

I removed now every 45 AllowCloseQuarterKills from weapons.meta what do I do now?

1 Like

What is a manifest file again? Sry im lost. Didn’t do this long time.

__resource.lua (or fxmanifest)

2 Likes