call the 34th VFUNC of CVehicle which is a bool that checks whether a component of the vehicle is open.
In c++, it would be like this
[shcode=cpp]
// BONNET = 0,
if ( pVehicle->IsComponentOpen ( eComponents::BONNET ) )
{
// component is open
}
[/shcode]
assuming there is no opcode that checks vehicle component states.