I did this as a SA-MP script in my server.
I'll explain it and then, if you know how to begin with it, you can try creating the code.
1. Get all cars in a streamed range (not sure how to do this myself, but I'm a newer scripter).
2. Make sure the car is in streamed range (can't remember the range to use sorry), if it's not remove_references_to_car
3. Use opcode 03ED on the car (this will disable it from exploding when flipped).
3. Check if the vehicle is bellow a health of 250, this is when the fire will begin (249.99 and down).
4. If the vehicle is bellow 250, then set it to 240 (this will loop the health so the vehicle stays low enough to be on fire, but not low enough to make it explode).
5. You can use opcode 02CF to create fire around the car for more realism.
6. If you want the explosions, try adding a variable to count how many times the vehicle has been bellow 250 (each loop +=1), maybe after 60 times, have it create_explosion at the cars location.
7. Have this loop.