Jump to content

Hitmark only Headshot


Recommended Posts

you will need to modify your script to detect when there’s a headshot hit it can be done using onClientPlayerDamage event

function hitmark(attacker, weapon, bodypart, loss)
  if (bodypart == 9) then -- 9 represents the head
    -- Show headshot hitmark
  end
end
addEventHandler("onClientPlayerDamage", localPlayer, hitmark)

 

Link to comment
----------------------------------------------------------------------
-------  Script:  ------------- Visit: --------------- Made in -------
------- 7rust-Dev ---------7rust.bplaced.de----------- GERMANY -------
----------------------------------------------------------------------

local screenX, screenY
local drawTimer
local isDrawing
local sound

function drawHitMarker()
	dxDrawImage(screenX-16, screenY-16, 32, 32, "hitmarker.png")
	
end

function fireFunc(weapon, ammo, ammoInClip, hitX, hitY, hitZ, hitElement)
	if hitElement then
			if getElementType(hitElement)=="player" or getElementType(hitElement)=="ped" or getElementType(hitElement)=="vehicle" then
		screenX, screenY = getScreenFromWorldPosition(hitX, hitY, hitZ)
		if not screenX then return end 
		if isDrawing then return end 
		isDrawing = true
		
		local sound = playSound("hitmarker-sound.wav")
		setSoundVolume( sound , 1)
	
	
		addEventHandler("onClientRender", root, drawHitMarker) 
		if drawTimer and isTimer(drawTimer) then
			killTimer(drawTimer)
		end
		
		
		drawTimer = setTimer(function() 
			isDrawing = false
			removeEventHandler("onClientRender", root, drawHitMarker) 
		end, 500, 1)
	end
	end
end--func
addEventHandler("onClientPlayerWeaponFire", localPlayer, fireFunc)

----------------------------------------------------------------------
-------  Script:  ------------- Visit: --------------- Made in -------
------- 7rust-Dev ---------7rust.bplaced.de----------- GERMANY -------
----------------------------------------------------------------------

function get_hit()
			fadeCamera(false,1,255,0,0)
			local hit_sound=playSound("hitmarker-sound.wav")
			setSoundVolume(hit_sound,0.5)
		function cam()
			fadeCamera(true,1)
		end
		setTimer(cam,150,1)
end


function hitmark(attacker, weapon, bodypart, loss)
  if (bodypart == 9) then -- 9 represents the head
    -- Show headshot hitmark
  end
end
addEventHandler("onClientPlayerDamage", localPlayer, hitmark)
----------------------------------------------------------------------
-------  Script:  ------------- Visit: --------------- Made in -------
------- 7rust-Dev ---------7rust.bplaced.de----------- GERMANY -------
----------------------------------------------------------------------

 

Edited by groove7
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...