|
Joined: Feb 2004
Posts: 3
Self-satisified door
|
OP
Self-satisified door
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?
|
|
|
|
Joined: Dec 2002
Posts: 1,922
Hoopy frood
|
Hoopy frood
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
|
|
|
|
Joined: Feb 2004
Posts: 3
Self-satisified door
|
OP
Self-satisified door
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
|
|
|
|
Joined: Dec 2002
Posts: 1,922
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 1,922 |
Here's an example: 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 - 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.
|
|
|
|
Joined: Feb 2004
Posts: 3
Self-satisified door
|
OP
Self-satisified door
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
Last edited by EricDraven; 05/02/04 03:23 AM.
|
|
|
|
Joined: Dec 2002
Posts: 1,922
Hoopy frood
|
Hoopy frood
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
|
|
|
|
Joined: Dec 2002
Posts: 332
Fjord artisan
|
Fjord artisan
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 ?
|
|
|
|
Joined: Dec 2002
Posts: 1,922
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 1,922 |
Well you can check this yourself 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.
|
|
|
|
Joined: Dec 2002
Posts: 332
Fjord artisan
|
Fjord artisan
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
|
|
|
|
Joined: Oct 2003
Posts: 2
Bowl of petunias
|
Bowl of petunias
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?
|
|
|
|
|