Posts: 2
Threads: 1
Joined: Sep 2010
Reputation:
0
Hi, my name is Peter and i am new arround here.
I would like to know if it is possible (and how) to detect when a car hits another car and return its id.
Thanks in advance!
Posts: 900
Threads: 21
Joined: Jan 2007
Reputation:
0
Natively, no.
However, you can make a couple of workarounds (which most likely won't be 100% precise although), for example, in a timer you could keep track of vehicles' healths, velocitys, and positions, and using that data try to 'guess' when two vehicles could have collided.
Posts: 500
Threads: 15
Joined: May 2007
Reputation:
0
OnVehicleUpdateDamage gets called for all vehicles, except motorbikes.
I suppose with a bit of calculating, you could work out if two vehicles hit each other. More accurate in my opinion than a timer.
Too early to code lol Here is what I would do :
OnVehicleDamage - Store ID, tickcount and pos to a [vehicleid] array
Each time it gets called, check if it's < 10 ticks (guess), if so, IsPlayerInRangeOfPoint (saved pos), return stored ID.
Posts: 2
Threads: 1
Joined: Sep 2010
Reputation:
0
Thanks a lot!
@Rac3r That's exactly what i was thinking, but thank you for the callback, i didn't find it.
Promise i'll post my gamemode when it's done. Thanks again!