Doubt in Programming (not repeating code)

my intention is when I press button 1 on the remote control, (on / off the relay), same thing for button 2, now when button 3 is pressed, it sends the infrared, for example to increase the TV volume

When I press 1 and 2, everything works normally (on / off the relay), but when I press button 3, it only sends the infrared code once, and when I press button 3 again nothing happens, and even when I press the button again button 1 and 2, they do not work (relay on / off)

JARBASR02.ino (1.13 KB)