1) Your /writeini and $readini lines are missing parameters.
If this script works, it's a fluke.
Refer to mIRC's help file /help /writeini and /help $readini for more information.
2) Glines require IRCop status to be able to set/remove them, yet there is nothing in the code to ensure that the client running the code has the required access.
3) The $nick references in the ON NICK event refer to the old nick.
You probably want to refer to the nick that they changed to, so you need to change those $nick references to $newnick
I am unable to accurately rate this script, based on the information I have posted above, and the fact that the lowest rating is a 1 for bad/ripped.