What are the official rules if your opponent makes an illegal move? I heard that they lose some time or that they lose the game. I'm not sure what happens.
By the FIDE Laws of Chess, article 7.4:

7.4



a. If during a game it is found that an illegal move, including
failing to meet the requirements of the promotion of a pawn or
capturing the opponent’s king, has been completed, the position
immediately before the irregularity shall be reinstated. If the
position immediately before the irregularity cannot be determined the
game shall continue from the last identifiable position prior to the
irregularity. The clocks shall be adjusted according to Article 6.13.
The Articles 4.3 and 4.6 apply to the move replacing the illegal
move. The game shall then continue from this re-instated position.




b. After the action taken under Article 7.4.a, for the first two
illegal moves by a player the arbiter shall give two minutes extra
time to his opponent in each instance; for a third illegal move by
the same player, the arbiter shall declare the game lost by this
player. However, the game is drawn if the position is such that the
opponent cannot checkmate the player’s king by any possible series of
legal moves.


That is, on the two first illegal moves of your opponent, you gain time on your clock (two minutes, which likely does nothing), but on the third illegal move of your opponent, they lose the game (unless it was already impossible for them to lose it).