Do I have to stay in Hungary in case my university provides online education?
You do. If you are absent for more than 30 days, you will not be entitled to your living and housing allowance until your return, as these allowances are intended to contribute to your costs of living in Hungary. For details related to abroad stays, please check out section III.3.5 of the Operational Regulations (Scroll down to the Rights and Obligations section).