My car died and now it won't start

I have a 98 pontiac sunfire with 130 k it died out last week while I was driving got a p0342 code I replaced the camshaft sensor still nothing I’m getting spark and I can hear the fuel pump click on can anyone help

New cam sensor says timing is off? Broke or loose chain/belt? Or tensioner.

It’s time to visit a good independent mechanic and get your problem straightened out. If you don’t…the expense may get out of hand. That can tend to happen when you get in over your head with a frustrating mechanical problem.

If the engine in your car has a timing belt, it may have broken…If it’s a chain, it may have jumped time…Does it sound normal when you crank it or does it have a different, free-wheeling kind of sound?

This car has a timing chain whether it’s a 2.2 or a 2.4.

It sounds normal it just cranks like if it was out of gas

Cam sensors are pretty cheap and should be easy to install so that would be worth a shot in my book. If that doesn’t do it, it would be a trip to the shop.

Have you tried spraying starting fluid into the intake while cranking to confirm spark?

Will it make a diffrence if I replaced the sensor but didn’t erase the code

No, the code should have no direct effect on the operation of the sensor.