MZ Conditional encounters

Hey, I want to disable random encounters if a certain switch is turned on, how can I do this?
This one looks good:

Original thread: https://forums.rpgmakerweb.com/threads/conditional-encounters.137046/