Jump to content

Fire Extinguisher and Fire Truck to Repair


Namorek

Recommended Posts

now i get it: fix vehicle with fire extinguisher. here (client-side):

  
function vehicleFireFix(weapon, _, _, _, _, _, element) 
  if weapon == 42 and element and getElementType(element) == "vehicle" then 
    local health = getElementHealth(element) 
    if health < 500 then -- dont want to "fix" healthy cars 
      --fixVehicle(element) -- uncomment to fix the damage model also 
      setElementHealth(element, health + 10)  
    end 
  end 
end 
addEventHandler("onClientPlayerWeaponFire", getLocalPlayer(), vehicleFireFix) 
  

EDIT: added a health check

EDIT2: "gradual" healing, you can change "healing" speed by editing "health + 10"

Link to comment
now i get it: fix vehicle with fire extinguisher. here (client-side):
  
function vehicleFireFix(weapon, _, _, _, _, _, element) 
  if weapon == 42 and element and getElementType(element) == "vehicle" then 
    if getElementHealth(element) < 500 then -- dont want to "fix" healthy cars 
      --fixVehicle(element) -- uncomment to fix the damage model also 
      setElementHealth(element, 500)  
    end 
  end 
end 
addEventHandler("onClientPlayerWeaponFire", getLocalPlayer(), vehicleFireFix) 
  

EDIT: added a health check

Very thanks! and Please Vehicle has broken and Fire no Bomb long this fire help :D

Link to comment

with the script above it works fine, i've tested, you can extinguish the fire and it stops > no explosion.

that is of course if you'll make it in time.

or you want the vehicle not exploding at all when burning?

i dont think that can be done easily, cancelling the onVehicleExplode event doesnt help here.

Link to comment

nop, you'll need to find some event (i suggest onVehicleDamage when vehicle health below 250, if i remember correctly when fire starts) and set it damageproof, as Doomed_Space_Marine suggested.

and then when you put out the fire - set it back to normal.

though i dont see a point to make vehicles burning this way, they'll be indestructible. :D

Link to comment

This guy since last 3 months learned NOTHING. Because you all are giving him complete codes, instead of trying to teach him something :/ Like a slaves. Ehh.

Namorek - maybe post in Polish section? You will probably find more ppl being able to help you and teach you something, so you won't have to post new topic in every problem you want to solve?

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