Agreed. Recommending improvements is fine, but it's still valid to give out a working version of what was originally asked for first. Most likely, the variable will never be 0 and the OP didn't realize this, so it's a good thing to point that out. But it's possible that it could be 0 depending on the rest of the scripts that might be being used, so I'd point it out, but not change it.
As for channel versus nick based protections, the request was (possibly) for channel based by looking at the code. Giving a working version of that is fine. The reason I say possibly for that is that the ELSE says that they've been warned. They may not have been warned if it's channel based warnings. Again, this is probably just the OP not realizing what it was going to do. So it's also good to point out the problems with that kind of format and then leave it to the OP to choose how to handle it best.
I don't think it's necessary to add "everything" to the variable name. The only time you need $network if if you are on the same channel(s) on multiple networks, which is usually not the case. $chan is only needed if you want a separate counter for each channel. Considering the nick is probably the same person even if the channel is changed while on the same network, allowing more warning just because the person is in a different channel isn't really required. Add to that the fact that the script specifies a single channel, so it won't trigger for other channels anyhow. Just including $nick (or some form of address mask if there are a lot of people using the same nicks) is enough in most cases. The rest just adds more work to the script that isn't really necessary. The additional items can be suggested for times when they may be useful, but I wouldn't put them right in there from the start.
Last edited by Riamus2; 16/04/11 02:52 PM.