/attack is a toggle.

Use /startattack and /stopattack instead. Alternatively, you can use "!" as a non-toggle prefix (for toggled abilities, i.e. !Shoot, !Auto Shot ).