Stopping damage of Railgun

I am trying to make a electrical car harpoon ( from 2 fast and 2 furious ).

I want to stop railguns damage.

SetPlayerWeaponDamageModifier is not working sometimes… sometimes it does.

Current code for disabling railguns damage:

Citizen.CreateThread(function()
	local isHarpoon = false
	while true do
		Citizen.Wait(0)

    	local ped = GetPlayerPed(-1)
		local pid = PlayerId()
		
		local currentWeaponHash = GetSelectedPedWeapon(ped)

		if currentWeaponHash == GetHashKey('WEAPON_RAILGUN') then
			isHarpoon = true
			SetPlayerWeaponDamageModifier(ped,0)
		else
			SetPlayerWeaponDamageModifier(ped,1)
			isHarpoon = false
		end
	end
end

You would probably be better off upload a modified weapon.meta

1 Like

Yep,
weapon.meta is much easier and there is a chance that script wont work if its in the middle of the tick

1 Like