ramzi Posted January 21, 2014 Posted January 21, 2014 Hi guys,i have a little problem in my headshot script,i don't want it with all weapons. i just want it with sniper only.here is the lua: 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 )
Tete omar Posted January 21, 2014 Posted January 21, 2014 Try this: addEvent "onPlayerHeadshot" addEventHandler("onPlayerDamage", getRootElement(), function (attacker, weapon, bodypart, loss) if ( bodypart == 9 ) and ( weapon == 34 ) then local result = triggerEvent("onPlayerHeadshot", source, attacker, weapon, loss) if ( result ) then killPed(source, attacker, weapon, bodypart) end end end )
MTA Team 0xCiBeR Posted January 21, 2014 MTA Team Posted January 21, 2014 addEvent("onPlayerHeadshot",true) addEventHandler("onPlayerDamage", getRootElement(), function (attacker, weapon, bodypart, loss) if bodypart == 9 and weapon == 34 then local result = triggerEvent("onPlayerHeadshot", source, attacker, weapon, loss) if result == true then killPed(source, attacker, weapon, bodypart) end end end ) Anyway you are not showing us the "onPlayerHeadshot" function. That could also be a problem.
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