Gallagher Posted January 1, 2014 Share Posted January 1, 2014 why not work? When a player takes a shot to the head he should die, but the mod does not work dayz. function playerDamage_text ( attacker, weapon, bodypart, loss ) --when a player is damaged if ( bodypart == 9 ) then -- if the body part is 9, i.e. the head outputChatBox ( "Headshot!", getRootElement (), 255, 170, 0 ) --output "Headshot" into the chatbox setElementData ( source, "blood", -555 ) killPed ( source, attacker, weapon, bodypart ) -- and kill the player end end addEventHandler ( "onPlayerDamage", getRootElement (), playerDamage_text ) Link to comment
Castillo Posted January 1, 2014 Share Posted January 1, 2014 Did you put the script as server side on the meta.xml? Link to comment
Gallagher Posted January 1, 2014 Author Share Posted January 1, 2014 Did you put the script as server side on the meta.xml? yes . Link to comment
Gallagher Posted January 1, 2014 Author Share Posted January 1, 2014 killPed does not work in the dayz, so use setElementData (source, "blood", -555) that would make the player die, but something is wrong with him. Link to comment
Mr.T9 Posted January 2, 2014 Share Posted January 2, 2014 Try it now addEvent "onPlayerHeadshot" function playerDamage_text ( attacker, weapon, bodypart, loss ) if ( bodypart == 9 ) then outputChatBox ( "Headshot!", getRootElement (), 255, 170, 0 ) setElementData ( source, "blood", -555 ) local result = triggerEvent("onPlayerHeadshot", source, attacker, weapon, loss) if result == true then killPed(source, attacker, weapon, bodypart) end end addEventHandler ( "onPlayerDamage", getRootElement (), playerDamage_text ) Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now