Jump to content

headshot


Gallagher

Recommended Posts

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

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

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