Jump to content

Repairing vehicles


Xwad

Recommended Posts

Posted

That is what i made i think its not good:/ Can you help me a little bit to correct the failures?

  
local weaponsToDamageVehicle = { 
    [9] = true 
} 
function handleVehicleDamage(attacker, weapon, loss, x, y, z, tyre) 
if (attackerweapon == 41) and (loss > 1) and ( theHealth < 95 ) then 
          setVehicleHealth ( source, theHealth+17 ) 
    fixVehicle ( vehicleValue ) 
end 
addEventHandler("onClientVehicleDamage", root, handleVehicleDamage) 
  

Posted

1. theHealth isn't defined

2. vehicleValue isn't defined , use source instead which is the vehicle which get damaged.

3. There isn't a function called setVehicleHealth , i guess you mean setElementHealth but there isn't need for this function, fixVehicle will work.

Posted

one more question. Is this server side?

  
function healFlowers (attacker, attackerweapon, bodypart, loss) 
  theHealth = getElementHealth (source) 
      if ( theHealth > 95 ) then --checks clients health 
        end 
      else 
        if (attackerweapon == 41) and (loss > 1) and ( theHealth < 95 ) then 
          setElementHealth ( source, theHealth+17 )           givePlayerMoney (attacker, 1.7*theHealth)                                        end 
    end 
end 
addEventHandler ("onPlayerDamage", getRootElement(), healFlowers ) 
  
  

Posted
  
function healFlowers (attacker, attackerweapon, bodypart, loss) 
  theHealth = getElementHealth (source) 
      if ( theHealth > 95 ) then  
       return end 
        if (attackerweapon == 41) and (loss > 1) and ( theHealth < 95 ) then 
          setElementHealth ( source, theHealth+17 )  
          givePlayerMoney (attacker, 1.7*theHealth)                                     
    end 
end 
addEventHandler ("onPlayerDamage", getRootElement(), healFlowers ) 
  
  

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