Jump to content

Stop giving attacker money


Recommended Posts

Posted

Hi all

I got a problem with this medic job script, I want to make that medic will stop getting money from healing players when players already have 100% of health. so here the script

edit : if i hit player who has 100% health. first hit I aint getting money, second hit the player lost hp, and third hit the player get healed again.

function healPlayerOnHit_Handler(theAttacker, theWeapon, theBodyPart, theLoss) 
    if(getElementType(theAttacker) == "player") then 
    if(theWeapon == 14) and (getElementHealth(source) < 95) then 
            cancelEvent() 
            local targetCurrentHealth = getElementHealth(source) 
            local newHealth = targetCurrentHealth+15 
            setElementHealth(source, newHealth) 
            givePlayerMoney(theAttacker, 1.7*newHealth) 
        end 
             
    end 
end 
addEventHandler("onPlayerDamage", getRootElement(), healPlayerOnHit_Handler) 
  

I hope you understand what I wanna do, Thank you.

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...