mIRC Homepage
Posted By: jb0525283 Script Check If Nick Is Identified - 07/12/14 07:29 PM
Hi,

I am making a script that only is available to a few nicks. I obviously can do a simple check if the nick is in the approved list, but I also need to check if they are identified, otherwise someone could log in and since they have 30 seconds to identify, they could use it when they shouldn't be able to.

These are regular users, NOT ops, so isop will not work. Wish there was a isidentified.

So how do I check if they are identified?
Posted By: Nillen Re: Script Check If Nick Is Identified - 07/12/14 07:33 PM
I know that pball : http://scripting.pball.x10.mx/

made a script that checks for ident, you can modify it to your needs
Code:
/*
[Addon]
Script=Check Ident
Version=1
Author=pball
Desc=Check if a nick is identified
For=Mirc
Date=

[script]
*/
alias chkident { set -u3 $+(%,ns_,$$1) 1 | .msg nickserv status $$1 }

menu nicklist,query {
  Check Identified:{ set -u3 $+(%,ns_,$$1) 1 | .msg nickserv status $$1 }
}

on ^*:notice:*:*:{
  if ($nick == nickserv) {
    if ($1 == STATUS) && ($3 isnum) && ($($+(%,ns_,$2),2)) {
      if ($3 == 0) || ($3 == 1) { echo 4 -a $2 is not identified | set -u3 $+(%,ns_,$2) 2 | ns info $2 } 
      else echo 11 -a $2 is identified 
      halt
    }
    elseif ($($+(%,ns_,$strip($2)),2)) { echo 4 -a $2 is not registered | halt }
    elseif ($var(%ns_*,1).value) halt
  }
}
Posted By: jb0525283 Re: Script Check If Nick Is Identified - 07/12/14 07:36 PM
I know you can do that, but I dont want to detect idents. I want to check if they are identified on text so to speak. That possible?
Posted By: Nillen Re: Script Check If Nick Is Identified - 07/12/14 07:41 PM
That's why I said you can modify it.
Use the script that mentions if they are idented, and do that every time they speak.
Posted By: pball Re: Script Check If Nick Is Identified - 07/12/14 07:45 PM
The only way I know to check if a nick is identified is to whois the nick or request the info through nickserv. So you can't check if they are identified during an on text event.
Posted By: jb0525283 Re: Script Check If Nick Is Identified - 07/12/14 07:49 PM
why cant I request that info from NS on text?
Posted By: Nillen Re: Script Check If Nick Is Identified - 07/12/14 08:19 PM
What I meant was to store the nick, whois the nick and then take action whether or not it's identified upon getting the notice from nickserv.

OP, you can't cause it requires you to use two different events and mIRC can't handle two events at once.
So like I said, store the nick on text event, whois the nick, on notice event verify if the nick is ident or not and then take action to it.
Delay will likely be <1 second.
Posted By: jb0525283 Re: Script Check If Nick Is Identified - 07/12/14 08:39 PM
So how would I keep track of all the different nicks as they identify, leave, etc? mirc is not exactly the best at dynamic arrays..
Posted By: pball Re: Script Check If Nick Is Identified - 07/12/14 10:41 PM
How about something like this.

on text !command {
set %command $nick
ns status $nick
}

on notice {
if %command && identified {
do command here
}
}

There will be some lag time since you'd have to wait for nickserv to reply. You could also save a variable saying that nick is identified and just check that and skip checking if identified each time.

Or

Like I have with a bot of mine. I type a login command and then I have unlimited access for a set time before I have to login again.

Some code for that. (feel lucky, never shared code from this bot ^_^)

Code:
on text if ($1 == ~login) && ($address($nick,7) isin %loadnicks) { set -u10 $+(%,$nick,.ns.status) $nick | ns status $nick }

on ^*:notice:*:*:{
  if ($nick == nickserv) && ($1 == STATUS) && ($2 == $($+(%,$2,.ns.status),2)) && ($3 isnum) {
    if ($3 == 3) {
      set -u1800 $+(%,$2,.login) true 
      .timer $+ $+($2,.login) 1 1680 .msg = $+ $2 2 minutes till log off 
      .timer $+ $+($2,.loginup) 1 1800 .msg = $+ $2 your time is up 
      .msg = $+ $2 welcome to $me $+ 's admin system (to logout manually type ~logoff)
    }
    halt
  }
}


You could remove the timer from the variable and just have it remove that when the person parts/quits from the chan, so it checks if they are identified next time they join. Might also want those variables to be removed when your mirc closes.
© mIRC Discussion Forums