knightscript Posted January 18, 2016 Share Posted January 18, 2016 Hello, what i want to do is to be able to stand 1 headshot. what functions should i use? Thank you Link to comment
Addlibs Posted January 18, 2016 Share Posted January 18, 2016 You can use the standard 'headshot' resource within MTA. Otherwise, use killPed in conjunction with onPlayerDamage on the specific body-part ID (that is, 9, for the head). Link to comment
knightscript Posted January 18, 2016 Author Share Posted January 18, 2016 I´m currently using the mta resource, but what I don´t know how to do is to check which users can survive 1 headshot, lets say I saw a zombie resource that does the following: CLIENT SIDE: helmetzombies = {13,22,23,24} function zombiedamaged ( attacker, weapon, bodypart ) if getElementType ( source ) == "ped" then if (getElementData (source, "zombie") == true) then if ( bodypart == 9 ) then helmeted = "no" local zskin = getElementModel ( source ) for k, skin in pairs( helmetzombies ) do if skin == zskin then helmeted = "yes" end end if helmeted == "no" then triggerServerEvent ("headboom", source, source, attacker, weapon, bodypart ) end end end end end addEventHandler ( "onClientPedDamage", getRootElement(), zombiedamaged ) SERVER SIDE: addEvent( "headboom", true ) function Zheadhit ( ped,attacker, weapon, bodypart) if (getElementData (ped, "zombie") == true) then killPed ( ped, attacker, weapon, bodypart ) setPedHeadless ( ped, true ) end end addEventHandler( "headboom", getRootElement(), Zheadhit ) Maybe there is a way to adapt this code to check for users? 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