iQsaMi~Mg.HaMoTa_oK! Posted July 4, 2016 Share Posted July 4, 2016 Hello guys i'm trying to make a script for MTA that will increase my health everytime i kill someone but problem is i need the right codes for the mod so could you guys please help me find out what the codes are? Link to comment
Bean666 Posted July 4, 2016 Share Posted July 4, 2016 not tested but try function kill (killer, weapon, bodypart, loss) if (killer) then setElementHealth(killer, getElementHealth(killer) + 10) end end addEventHandler ( "onPlayerWasted", getRootElement(), kill) Link to comment
LabiVila Posted July 4, 2016 Share Posted July 4, 2016 function increaseHP (_, enemy) if (enemy) then setElementHealth (enemy, getElementHealth (enemy) + 10) outputChatBox ("Your HP has been increased because you killed "..getPlayerName (source).."#ffffff.", enemy, 255, 255, 255, true) end end addEventHandler ("onPlayerWasted", getRootElement(), increaseHP) Link to comment
iQsaMi~Mg.HaMoTa_oK! Posted July 4, 2016 Author Share Posted July 4, 2016 function increaseHP (_, enemy) if (enemy) then setElementHealth (enemy, getElementHealth (enemy) + 10) outputChatBox ("Your HP has been increased because you killed "..getPlayerName (source).."#ffffff.", enemy, 255, 255, 255, true) end end addEventHandler ("onPlayerWasted", getRootElement(), increaseHP) not work Link to comment
aka Blue Posted July 4, 2016 Share Posted July 4, 2016 Try this. function increaseHP ( _, attacker, _, _ ) if attacker and attacker ~= source then local actualHealth = getElementHealth ( attacker ) outputChatBox ("Your HP has been increased because you killed "..getPlayerName (source).."#ffffff.", attacker, 255, 255, 255, true) setElementHealth ( attacker, tonumber ( actualHealth ) + 10 ) end end addEventHandler ("onPlayerWasted", getRootElement(), increaseHP) Link to comment
iQsaMi~Mg.HaMoTa_oK! Posted July 4, 2016 Author Share Posted July 4, 2016 Try this. function increaseHP ( _, attacker, _, _ ) if attacker and attacker ~= source then local actualHealth = getElementHealth ( attacker ) outputChatBox ("Your HP has been increased because you killed "..getPlayerName (source).."#ffffff.", attacker, 255, 255, 255, true) setElementHealth ( attacker, tonumber ( actualHealth ) + 10 ) end end addEventHandler ("onPlayerWasted", getRootElement(), increaseHP) thank you it's working 100/100 thanks 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