it is nothing to do with valves and switches. if your oil light is on and the engine is rattling that is telling you there is no oil pressure. assuming you have checked your oil level and that is ok, then next step is to get oil and filter change right away, you could have a blocked filter. if that dont cure it then its probably the oil pump or the oil pickup pipe. to replace the pump is about a 10hr job. you are now talking money. also if youve been driving the car for any length of time whilst rattling, you may also have caused internal damage due to lack of lubrication.