Hi guys!
The past few days I have been trying to create a code that checks if a player is in a specific vehicle, if he’s inside a vehicle but isn’t in the correct one, a pop up should appear. The problem is, that the pop up appears when you enter in any vehicle. Here’s the code:
private bool IsPlayerInsideDeliveryVehicle()
{
if ((Game.PlayerPed.IsSittingInVehicle() && GetEntityModel(Game.PlayerPed.Handle) != GetHashKey(DeliveryData.MODEL_SCOOTER))
|| (Game.PlayerPed.IsSittingInVehicle() && GetEntityModel(Game.PlayerPed.Handle) != GetHashKey(DeliveryData.MODEL_VAN))
|| (Game.PlayerPed.IsSittingInVehicle() && GetEntityModel(Game.PlayerPed.Handle) != GetHashKey(DeliveryData.MODEL_TRUCK)))
{
Screen.ShowNotification(DeliveryData._U["DELIVERY_WRONG_VEHICLE"]);
return true;
}
return false;
}