mIRC Home    About    Download    Register    News    Help

Print Thread
#70241 04/02/04 03:45 AM
Joined: Feb 2004
Posts: 3
E
Self-satisified door
OP Offline
Self-satisified door
E
Joined: Feb 2004
Posts: 3
i op on a server that includes regestered users age and sex as part of the /whois
what i need to do is strip this out of /whois into a %var so i can check it or print it out
main reason being to kick anyone who isnt a teen out of teens room and isnt an adult out of adultsonly room
doing
/debug on
/whois targetnick
/debug off
shows the line i need is
:irc.ukchatterbox.com 320 mynick targetnick :is 19/male
so am i right in saying i have to trap the raws from a /whois command?, how do i do this?

#70242 04/02/04 04:35 AM
Joined: Dec 2002
Posts: 1,922
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
raw 320:*: echo -s Name: $2 - Age: $gettok($4,1,47) - Sex: $gettok($4,2,47)

Using $gettok($4,2,47) you can even kick females out of males-only room wink

#70243 04/02/04 05:03 AM
Joined: Feb 2004
Posts: 3
E
Self-satisified door
OP Offline
Self-satisified door
E
Joined: Feb 2004
Posts: 3
thanks, but how do i assign the returned line to a variable so that i can print it to a window, or use it in a warning/kick
and how can i do it to everyone in the room without flooding my status (ie supress /whois from displaying), but still be able to do /whois normaly from command line or popup

#70244 04/02/04 07:44 AM
Joined: Dec 2002
Posts: 1,922
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
Here's an example:
Code:
On @*:join:[color:blue]#teenworld[/color],[color:blue]#20+[/color]:{
  if $hget(whois,0).item < 3 {
    ;
    ; The hash table "whois" stores the nicks you are doing a WHOIS on.
    ;
    hadd -mu20 whois $nick #
    whois $nick
  }
}
 
raw *:*:{
  ;
  ; 310-320 is the range of WHOIS replies.
  ;
  if $numeric isnum 310-320 && $hget(whois,$2) {
    if $numeric == 320 {
      [color:green]echo -s Name: $2 - Age: $gettok($4,1,47) - Sex: $gettok($4,2,47)[/color]
    }
    if $numeric == 318 { 
      ; 
      ; 318 = End of WHOIS
      ;
      hdel whois $2
    }
    haltdef
  }
}

To know what a specific command does, type /help /command. See the gree line? This informal /echo can be replaced with anything else. For example -
Code:
    if $numeric == 320 {
      var %nick = $2
      var %chan = $hget(whois,$2)
      var %age = $gettok($4,1,47)
 
      if %chan == #teenworld && %age >= 20 {
        notice %nick Man, you're too old for %chan
      }
      elseif %chan == #20+ && %age < 20 {
        kick %chan %nick See you in #teenworld
      }
    }

I hope it wasn't too complicated...
To keep the current code structure, first paste in Word or Wordpad then copy to the mIRC editor.

#70245 05/02/04 03:22 AM
Joined: Feb 2004
Posts: 3
E
Self-satisified door
OP Offline
Self-satisified door
E
Joined: Feb 2004
Posts: 3
thanks m8, cant get it to work as typed, but at least it gives me some ideas to work on
(note to self: best readup about hash tables now)
by the way, i use EditPlus for all my scripting,html coding etc but thanks grin

Last edited by EricDraven; 05/02/04 03:23 AM.
#70246 05/02/04 03:48 AM
Joined: Dec 2002
Posts: 1,922
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
I couldn't test this script because the servers I'm on do not send the age/sex reply you mentioned. If you want, tell me the name of your network and we'll do some tests.

You can find a hash tables tutorial here:
http://helpdesk.zaz.net/documents/tutorials.php

#70247 05/02/04 04:11 AM
Joined: Dec 2002
Posts: 332
C
Fjord artisan
Offline
Fjord artisan
C
Joined: Dec 2002
Posts: 332
probably i am misunderstanding this but ? if this is the response
:irc.ukchatterbox.com 320 mynick targetnick :is 19/male
wont this
Age: $gettok($4,1,47) - Sex: $gettok($4,2,47)
return the number 1 for age and the number 9 for sex ?

#70248 05/02/04 04:55 AM
Joined: Dec 2002
Posts: 1,922
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
Well you can check this yourself smile
Assuming $4 is the word "17/male", type:
  • //echo -a Age: $gettok(17/male,1,47)
    //echo -a Sex: $gettok(17/male,2,47)
Those $gettok's treat the string as if it's separated by / - ASCII number 47 - and return either the first (1) or second (2) part of that string. Read more on tokens at Helpdesk's website.

#70249 05/02/04 01:36 PM
Joined: Dec 2002
Posts: 332
C
Fjord artisan
Offline
Fjord artisan
C
Joined: Dec 2002
Posts: 332
ah i see now thats what i was unclear on was the number 47 or 32 etc.. from the help file makes sense now thx for the explanation smile

#70250 05/02/04 11:38 PM
Joined: Oct 2003
Posts: 2
K
Bowl of petunias
Offline
Bowl of petunias
K
Joined: Oct 2003
Posts: 2
What if you wanted to check for how many channels the joining nick is in, like for porn advertiser kicking purposes?


Link Copied to Clipboard