Minotaur Posted June 12, 2014 Posted June 12, 2014 Hey all! I want a so headshot script that if no armor the player die if the player have armor his health go to half only with sniper. with another weapons like m4 you can kill the player with 4 headshot with also armor. with deagle if player have armor go his armor down with 1 headshot, with another headshot go his health to 10%. anybody can help me? thx and sorry for english
manawydan Posted June 12, 2014 Posted June 12, 2014 you can use weapon property or onPlayerDamage event , chech the weapon getPedWeapon, check armor and health and use some math.
Minotaur Posted June 12, 2014 Author Posted June 12, 2014 can you help me a little bet ? i really noob for for example plz
Gengar Posted June 12, 2014 Posted June 12, 2014 https://wiki.multitheftauto.com/wiki/OnPlayerDamage https://wiki.multitheftauto.com/wiki/GetPedArmor
Johnny Killstone Posted June 12, 2014 Posted June 12, 2014 There is a resource named 'headshot' in the default resources too, I recommend you to use that, it's easy to modify as well in case you need that.
Minotaur Posted June 12, 2014 Author Posted June 12, 2014 i created this but not working function playerDamage_text ( attacker, weapon, bodypart, loss == 50 ) --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 end addEventHandler ( "onPlayerDamage", getRootElement (), playerDamage_text )
Moderators IIYAMA Posted June 13, 2014 Moderators Posted June 13, 2014 loss == 50 loss Those are parameters of the event, you can't change values of parameters inside the ( ). You have to do that after that. local playerDamage_text = function ( attacker, weapon, bodypart, loss ) if bodypart == 9 then local health = getElementHealth(source)+loss-- get the health of the past. local newHealth = health - 50--get the new health if newHealth > 0 then setElementHealth(source,newHealth) else killPed(source, attacker, weapon, bodypart) end outputChatBox ( "Headshot!", source, 255, 170, 0 ) end end addEventHandler ( "onPlayerDamage", root, playerDamage_text )
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