The only thing that I can see from what you posted, is the fact that, $nick returns $null in a raw event, so your first if statement tries to check $null !isop #chat