Jump to content

Medic Flowers [HELP]


Recommended Posts

When i have added damage blocker into the Client-side, medic stopped to heal ....

Anybody can say what's wrong here ?

Server-side

local skin = {[274]=true, [275] = true, [276]=true} 
  
function healFlowers (attacker, attackerweapon, bodypart, loss) 
  theHealth = getElementHealth (source) 
    if not skin[getElementModel(attacker)] then return end  
      if ( theHealth == 100 ) then  
      givePlayerMoney( attacker, 0 ) 
      end 
      if (attackerweapon == 14) and (loss > 1) and ( theHealth < 100 ) then 
          setElementHealth ( source, theHealth+20 )  
          givePlayerMoney (attacker, 10*theHealth)  
      end 
    end 
addEventHandler ("onPlayerDamage", getRootElement(), healFlowers ) 
  
  
medicVehicles = { [416]=true }  
medicSkins = { [274]=true, [275]=true, [276]=true }  
  
function medicenterVehicle ( player, seat, jacked ) 
    if ( medicVehicles[getElementModel ( source )] ) and ( not medicSkins[getElementModel ( player )] ) and ( seat == 0 ) then  
            cancelEvent() 
        outputChatBox ( "Only paramedics can drive this vehicle.", player )  
    end 
end 
addEventHandler ( "onVehicleStartEnter", getRootElement(), medicenterVehicle ) 

Client-side

addEventHandler ( "onClientPlayerDamage",localPlayer, 
function ( attacker, weapon, bodypart) 
    if weapon == 14 then 
        cancelEvent() 
    end 
end) 

Link to comment
setElementHealth triggers the onClientPlayerDamage event, therefore your cancelEvent() will cancel the healing for obvious reasons.

The solution is simple: delete those client-side lines of code.

But if i will remove this code, flowers will damage players which i want to heal

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