Atouk Posted February 7, 2013 Share Posted February 7, 2013 Please, I need help of a spray that will give HP to the player where you shoot the spray, and when no one is around, when you are only give HP for you. I hope answers, thanks. skype: Agustin Barbero . Link to comment
Ab-47 Posted February 7, 2013 Share Posted February 7, 2013 Required Functions; setElementHealth getElementHealth addEventHandler Simple hint; make it yourself. Wiki; https://wiki.multitheftauto.com/ Link to comment
ViRuZGamiing Posted February 7, 2013 Share Posted February 7, 2013 A bit like this; https://community.multitheftauto.com/index.php?p= ... ls&id=4863 Just edit it but don't edit Credits. Only edit: • outputChatBox • addCommandHandler's if they are in • Add new things or Delete things is also possible Link to comment
Atouk Posted February 7, 2013 Author Share Posted February 7, 2013 addEventHandler("onClientPlayerDamage", localPlayer, function(attacker, weapon, bodypart, loss) if (attacker and getElementType(attacker) == "player" and weapon == 41 then cancelEvent() if (not isTimer(pause)) then local health = getElementHealth(localPlayer) if (health < 99) then triggerServerEvent("medic:healing", localPlayer, attacker) pause = setTimer(function() end, 1000, 1) end end end end ) I have an error? Link to comment
Ab-47 Posted February 8, 2013 Share Posted February 8, 2013 addEventHandler("onClientPlayerDamage", localPlayer, function(attacker, weapon, bodypart, loss) if (attacker and getElementType(attacker) == "player" and weapon == 41 then cancelEvent() if (not isTimer(pause)) then local health = getElementHealth(localPlayer) if (health < 99) then triggerServerEvent("medic:healing", localPlayer, attacker) pause = setTimer(function() end, 1000, 1) end end end end ) I have an error? How bout checking it yourself? /debugscript 3 and check for bad arguments. Link to comment
3NAD Posted February 8, 2013 Share Posted February 8, 2013 Tell me the Results. addEventHandler ( "onClientPlayerDamage", localPlayer, function ( attacker, weapon, bodypart, loss ) if attacker and getElementType ( attacker ) == "player" and weapon == 41 then cancelEvent ( ) local health = getElementHealth ( localPlayer ) if ( health < 99 ) then -- triggerServerEvent("medic:healing", localPlayer, attacker) setElementHealth ( localPlayer, health + 10 ) end end end ) Link to comment
Blaawee Posted February 9, 2013 Share Posted February 9, 2013 server: addEventHandler ( 'onPlayerDamage', root, function ( attacker, weapon ) if attacker and getElementType ( attacker ) == 'player' and weapon == 41 then cancelEvent ( ) local health = getElementHealth ( source ) if ( health < 99 ) then setElementHealth ( source, health + 1 ) else outputChatBox( 'He is in a good condition', attacker, 255, 0, 0, true ) end end end ) Link to comment
TAPL Posted February 9, 2013 Share Posted February 9, 2013 server: addEventHandler ( 'onPlayerDamage', root, function ( attacker, weapon ) if attacker and getElementType ( attacker ) == 'player' and weapon == 41 then cancelEvent ( ) local health = getElementHealth ( source ) if ( health < 99 ) then setElementHealth ( source, health + 1 ) else outputChatBox( 'He is in a good condition', attacker, 255, 0, 0, true ) end end end ) https://wiki.multitheftauto.com/wiki/OnPlayerDamage It should also be noted that canceling this event has no effect. Cancel the client-side event onClientPlayerDamage instead. Link to comment
Atouk Posted February 13, 2013 Author Share Posted February 13, 2013 Thank you very much to all, the script works perfectly. 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