Jump to content

Medic job


Recommended Posts

Hello guys, im making my medic job, but i have two problems... The spray can makes the source do the stupid gagging animation, and I tried using "cancelEvent( )" but, it didn't work... It also takes a little bit of the sources health, so if the're health is like 5, they will die if I try to heal them.

Code:

----------------------------- 
-- Player Healing          -- 
----------------------------- 
addEventHandler ( "onPlayerDamage", root, function ( attacker, weapon, loss )  
    if ( attacker ) then 
        if ( getElementData ( attacker, "Job" ) == "Medic" ) then 
            if ( weapon == 41 ) then 
                if ( getElementHealth ( source ) < 100 ) then    
                    cancelEvent ( ) 
                    setElementHealth ( source, getElementHealth ( source ) + 15 ) 
                    givePlayerMoney ( attacker, 200 ) 
                    exports["SRNCore"]:sendClientMessage ( attacker, "You've healed "..getPlayerName ( source ), 0, 255, 0 ) 
                    exports["SRNCore"]:sendClientMessage ( source, getPlayerName ( attacker ).." has healed you.", 0, 255, 0 ) 
                else 
                    exports["SRNCore"]:sendClientMessage ( attacker, getPlayerName ( source ).." dosn't need healing.", 255, 0, 0 ) 
                    cancelEvent ( ) 
                end 
            end 
        end 
    end 
end ) 

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...