One little suggestion:
on *:JOIN:#: {
set %.ch $chan
CTCP $nick VERSION
}
on 1:CTCPREPLY:VERSION*:/onotice #channelname $nick is using IRC client: $1-
/onotice requires op status on the channel.
Also, you're using #channelname, which is telling the script to notice the channel #channelname.
Try your variable %.ch instead.
Easy fix:
on @*:JOIN:#: {
set %.ch $chan
CTCP $nick VERSION
}
on 1:CTCPREPLY:VERSION*:/onotice %.ch $nick is using IRC client: $1-
The @ sign in front of the event denotes OP status.