I recommend using a simple hashtable instead of setting some %variables.
Hashtables are 'non-sorted' lists, usually containing 2 'columns': item and data.
Here, I'm using $nick for item and $fulladdress for data.
The latter might be usefull if you want to modify the script in the future...

; a user joins your channel: add the nick and address for 3 seconds to a hashtable
; also note the use of the "!" prefix, replacing "if ($nick != $me)"

on !*:join:#yourchan: { hadd -mu3 joiners $nick $fulladdress }

; a user parts your channel: if there is an entry for $nick in the hashtable, perform a ban command
; use $+($nick,!*@*) to ban that nick; $v1 to ban the fulladdress; or some $mask($v1,N) to apply one if mIRCs default banmasks

on @!*:part:#yourchan: {
  if ($hget(joiners,$nick)) { 
    mode $chan +b $+($nick,!*@*)

Anyway, I doubt that a NICKban is the most efficient sollution.
In the majority of cases, bots fit some 'pattern', e.g. using the same *!*@*.domain or *!ident@* time and again - if you can provide more information about this, we might be able to make a better script.