17.03.2012, 01:42
OnPlayerEnterVehicle is called whenever a player presses ENTER near a vehicle. So for entering detection, it is better to use OnPlayerStateChange (newstate will be PLAYER_STATE_DRIVER or PLAYER_STATE_PASSENGER).
OnPlayerExitVehicle is called when the player fully exits the vehicle by their own free will - this does not include occasions like SetPlayerPos, RemovePlayerFromVehicle. So once again, you should refer to OnPlayerStateChange.
To understand it better, take an example of how bike anti-falls work. If OnPlayerStateChange is called when the player was on a bike, but OnPlayerExitVehicle was not called prior to it, the player will be put back onto the bike. However, if the player presses whatever key they use for vehicle entering/exiting, OnPlayerExitVehicle will be called first and that will trigger a variable of some sort and the player won't be restored to their vehicle in OnPlayerStateChange.
OnPlayerExitVehicle is called when the player fully exits the vehicle by their own free will - this does not include occasions like SetPlayerPos, RemovePlayerFromVehicle. So once again, you should refer to OnPlayerStateChange.
To understand it better, take an example of how bike anti-falls work. If OnPlayerStateChange is called when the player was on a bike, but OnPlayerExitVehicle was not called prior to it, the player will be put back onto the bike. However, if the player presses whatever key they use for vehicle entering/exiting, OnPlayerExitVehicle will be called first and that will trigger a variable of some sort and the player won't be restored to their vehicle in OnPlayerStateChange.

