I added some logs.
If I comment:
PHP Code:
if(pnum < 2) return
it should ban, but it didn't. I added log after ban comand and log is in log file but ban don't work and it's strange. I tried your's ban command and mine (that work on client_disconnect) with no result.