Jump to content

Headshot Dead Animation


Notorious^

Recommended Posts

Posted
addEvent "onPlayerHeadshot"

addEventHandler("onPlayerDamage", getRootElement(),
	function (attacker, weapon, bodypart, loss)
		if bodypart == 9 then
			local result = triggerEvent("onPlayerHeadshot", source, attacker, weapon, loss)
			if result == true then
				killPed(source, attacker, weapon, bodypart)
			end
		end
	end
)

Hello Guys

You know this is basic headshot script.but ı want add dead animation when he dying with headshot ? which can ı add some stuff ? can you help me ? 

 

Posted

You can use

setPedAnimation
setTimer

Call setPedAnimation to play animation instead of killPed, and then set the timer to kill the ped. This will kill the ped when animation is over. 

Posted
23 hours ago, Notorious^ said:

addEvent "onPlayerHeadshot"

addEventHandler("onPlayerDamage", getRootElement(),
	function (attacker, weapon, bodypart, loss)
		if bodypart == 9 then
			local result = triggerEvent("onPlayerHeadshot", source, attacker, weapon, loss)
			if result == true then
				killPed(source, attacker, weapon, bodypart)
			end
		end
	end
)

Hello Guys

You know this is basic headshot script.but ı want add dead animation when he dying with headshot ? which can ı add some stuff ? can you help me ? 

 

addEvent "onPlayerHeadshot"

addEventHandler("onPlayerDamage", getRootElement(),
	function (attacker, weapon, bodypart, loss)
		if bodypart == 9 then
			local result = triggerEvent("onPlayerHeadshot", source, attacker, weapon, loss)
			if result == true then
        setPedAnimation(source, "anim", "anim")
        	setTimer ( function()
		killPed(source, attacker, weapon, bodypart)
	end, 1000, 1 ) --here you can change the time when the player going to die.

        
			end
		end
	end
)

 

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...