Most likely your code has a "bracket mismatch" resulting in a nested event (one event inside another event, not allowed). e.g.:
Code:
on <EVENT1> {
  if (something) {
    - do something - 
  }
  - do something -

  on <EVENT2> {
    - do something -
  }
}
...note that there's an "even" number of opening and closing brackets, but the second event definition is in fact interpreted like a command "on", because it's inside the command part of the first event.

It has to be like:
Code:
on <EVENT1> {
  if (something) {
    - do something - 
  }
  - do something -
}

on <EVENT2> {
  - do something -
}


mIRC will reallign (indent acc. to brackets) the code if you switch tabs in the scripts editor, or close and reopen the editor, or click the "check brackets" button (upper right corner). You'll soon get used to this method of detecting bracket problems smile