The "schedule" opcode is an i-time opcode and your k-time if statement
does not affect it.
In more detail: Csound code is not actually just a single program, it is
three different programs whose statements can be mixed together in the
file. Some statements run at i-time (once when the note starts); some at
k-time (once per control cycle); and some at a-time (which functionally
means once per audio sample, though the actual implementation may fake
this by processing multiple samples at once). These three programs are
separated out and run separately at the appropriate times. You can
confuse yourself by writing k-time statements in the middle of i-time
code, but that won't change their relative order of execution.
So your code is really saying:
; AT I-TIME
ktrig init 0
schedule 2, 0, 1
; AT K-TIME
if (ktrig != 0) then
; nothing here!
I think if you put a k-time opcode like "event" inside the k-time if
statement instead of "schedule", you'll find that it does get affected by
the conditional. But you'll need to add a bit of further logic (resetting
a k-time variable as in the manual's example for "event") to prevent it
from triggering a new event on every single k-cycle.