Jump to content

[Help!] Resource damage car


Lally

Recommended Posts

onVehicleDamage :  This event is triggered when a vehicle is damaged.

OR just use a timer

local mathCeil = math.ceil
function checkVehicleDamage()
   local vehicles = getElementsByType("vehicle")
   for i=1, #vehicles do
       local vehiclehealth = mathCeil(getElementHealth (vehicles[i]))
       if tonumber(vehiclehealth) < 255.5 then 
           setVehicleEngineState (vehicles[i], false )
           setVehicleDamageProof(vehicles[i], true)
           setElementHealth(vehicles[i],255)
       end
    end 
end 
setTimer(checkVehicleDamage, 100, 0)

 

Link to comment

Thanks Walid. But now it's another matter if the minigun shooting say in the car and exploding begin to spawn infinite pieces of the car and make it lag. If you can help me out here a pictures of evidence. Photo
And if you ask my doing something like a text when you enter the car and start the car as you try to give a text as the engine is broken.

Edited by Lally
Link to comment
On 04/11/2016 at 5:25 PM, Lally said:

Is very good! But now the problem is that I bind the j to start the car and gender has no effect if it is broken or not. And if you mess and fix it no longer hurt.

 

 

3 minutes ago, Lally said:

@Walid Can you help me? You're only helping me

Try to do it by yourself then post your code here.

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