Configure seperate commands for each state?

Hello,
I was wondering how can i configure different commands for each status of a service?
for example when it goes into WARNING execute script “A”, when it goes into CRITICAL execute script “B”… etc`

Thanks
Nir