on_collision(func_name, vehicle_name)

Parameters:
func_name (string) name of the function, or "" to unregister the event
vehicle_name (string) name of the vehicle (or name of the player, to trigger whenever the player's vehicle is in a collision)
 
Returns:
none

Description:
Register a callback function for when a vehicle collides with a mover, another vehicle, or the world.

When the callback is executed, the following parameters are passed to it:
 - (string) name of the vehicle that the callback is associated with
 - (string) name of the mover/vehicle that was collided with; or nil, if the collision was with the world
 - (float) relative speed of impact, in m/s

Note that this event is not triggered when the vehicle collides with a pedestrian. To set up a callback for that event, use on_hit_ped.

 

back to indexSR3 Script Action Documentation
Last updated: Tue, 09 Aug 2011 11:32:15