Script that the ped goes in front of the vehicle to run the script

what is the script that the ped goes in front of the vehicle and run the resource script?
For example
when you use an item at the side of the vehicle it will display an error showing that the ped must be in front of the vehicle to run the script?