Jump to content

sistema de headshot com setagem de vida


Recommended Posts

basicamente, eu estou tentando, fazer com que quando acerta um headshot com qualquer arma ele seta 30 de vida no player para que funcione com o sistema do samu assim n matando o player e sim derrubando ele, mas não sei oq estou fzd de errado.

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

 

Edited by SrKingFox
Link to post

 

function onDamage(_, _, bodypart)
	if bodypart == 9 then
  		setElementHealth(source, 29)
  	end
end
addEventHandler("onPlayerDamage", root, onDamage)

 

Link to post

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