mIRC Home    About    Download    Register    News    Help

Print Thread
#44251 26/08/03 06:52 PM
Joined: Feb 2003
Posts: 43
K
Kazz Offline OP
Ameglian cow
OP Offline
Ameglian cow
K
Joined: Feb 2003
Posts: 43
OK, here's the deal

I want to make a kicklist so that if a person is kicked from any channel that you were on the next time he comes in any room that you are in there is a message telling you that he had a previous offense.

So far I have this:

Code:
 On *:Kick:*:{
 write KickList.txt $nick 
}

On *:Join:*:{
  $read(KickList.txt,s, $+ $nick)
}
  


I know, I know it's horrible but I haven't tried scripting any mirc code for like 5 months now and I have almost completely forgotten anything that I knew about it so

PLEASE HELP


smirk Mr.Newb smirk
A.K.A Kazz
#44252 26/08/03 06:57 PM
Joined: May 2003
Posts: 2,265
P
Hoopy frood
Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
Code:
on *:KICK:#:{
if (!$read(kicklist.txt,s,$knick)) {
write kicklist.txt $knick
}
}
on *:JOIN:#:{
if ($read(kicklist.txt,s,$nick)) {
kick # $nick You had a previous offense, bye :(
}
}


new username: tidy_trax
#44253 26/08/03 07:03 PM
Joined: Feb 2003
Posts: 43
K
Kazz Offline OP
Ameglian cow
OP Offline
Ameglian cow
K
Joined: Feb 2003
Posts: 43
Thanx Pheonix grin


smirk Mr.Newb smirk
A.K.A Kazz
#44254 26/08/03 07:12 PM
Joined: May 2003
Posts: 2,265
P
Hoopy frood
Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
np laugh


new username: tidy_trax
#44255 26/08/03 07:47 PM
Joined: Mar 2003
Posts: 1,271
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Mar 2003
Posts: 1,271
The code pheonix posted for you has several problems which will cause it to behave erratic, and most definately not the way you would want it to.

$read(filename,s,word) searches filename for a line beginning with word, and then return the rest of the line. Since there is nothing else, the $read statement returns nothing, so the if statement will always return $false, or with the ! in place, it will always return $true.

Other problem in pheonix' code is that he uses $nick in his code and not $knick. $nick is the nickname of the OP who kicked out the user, and I doubt you'd want to tag him as abusive. $knick is the user that got kicked.

You could fix this by simply doing /write filename $knick $1- ($1- being the user's kick reason). Then when you use $read(filename,s,$nick) the $read statement will return something, and the if statement pheonix posted would work the way you want it to. This however still provides a big problem when your text file gets big. mIRC's file routines aren't the fastest, and the bigger the file gets, the longer it takes.

Also, pheonix only kicks the user. Can you imagine what happens if the user checked rejoin channels when kicked in his mIRC options? I can....

Did you ever try adding the user ti the userlist?

Code:
on *:KICK:#: {
[color:green]  ; might wanna add a check to make sure you're not screwing yourself with this[/color]
[color:green]  ; note I am adding the channel -- wouldn't want the user to get[/color]
[color:green]  ; kicked in channel A and then warned in channel B[/color]
  if ($knick != $me) guser WARNEDUSER $knick 3 $chan
}
[color:green]; add the @ so it only triggers when you're an op. [/color]
[color:green]; wouldn't want this to do it's stuff when you're not an op...[/color]
on @WARNEDUSER:JOIN:#: {
[color:green]  ; check if it's the right channel ![/color]
  if ($ulist($address($nick,3)).info == $chan) {
    msg $chan The user $nick has been kicked before for violating channel rules!
  }
}


DALnet #Helpdesk
I hear and I forget. I see and I remember. I do and I understand. -Confucius
#44256 26/08/03 07:52 PM
Joined: May 2003
Posts: 2,265
P
Hoopy frood
Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
1: edited the $knick problem blush.
2: no it doesn't always return $false :tongue:.


new username: tidy_trax
#44257 26/08/03 07:57 PM
Joined: Mar 2003
Posts: 1,271
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Mar 2003
Posts: 1,271
Perhaps you should try it. The description I gave of $read with the s flag is accurate and correct in all my tests.

Code:
/write test.txt something
//echo -a $read(test.txt,s,something)


In default mIRC, that returns
* /echo: insufficient parameters
because mIRC cannot echo "nothing" - ergo the read() statement returns nothing. If you try the following example:

Code:
/write test.txt something this does work
//echo -a $read(test.txt,s,something)

a default mIRC returns:
this does work


DALnet #Helpdesk
I hear and I forget. I see and I remember. I do and I understand. -Confucius
#44258 26/08/03 08:07 PM
Joined: May 2003
Posts: 2,265
P
Hoopy frood
Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
ah, i see, it echos insuficient parameters if theres nothing after the word :tongue:
i tried: $read(sockbot.txt,s,sockread) - it returned %s - the line was: sockread %s
then i tried: $read(sockbot.txt,s,;ctcp) - it returned insufficient params - the line was: ;ctcp

this would work though:
Code:
on *:KICK:#:{
if (!$read(kicklist.txt,w,$+(*,$knick,*)) {
write kicklist.txt $knick
}
}
on *:JOIN:#:{
if ($read(kicklist.txt,w,$+(*,$nick,*)) {
echo $chan $nick had previous offenses
}
}

Last edited by pheonix; 26/08/03 08:48 PM.

new username: tidy_trax
#44259 26/08/03 08:12 PM
Joined: Mar 2003
Posts: 1,271
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Mar 2003
Posts: 1,271
It would - but I would still advise the user to read the other comments I meade. Your code is still an invitation to a flood fest. And the kickees would win, cause eventually so many users get added to the text file it would slow the user considerably.


DALnet #Helpdesk
I hear and I forget. I see and I remember. I do and I understand. -Confucius
#44260 26/08/03 08:18 PM
Joined: May 2003
Posts: 2,265
P
Hoopy frood
Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
just giving him what he asked for smile


new username: tidy_trax
#44261 26/08/03 08:43 PM
Joined: Mar 2003
Posts: 1,271
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Mar 2003
Posts: 1,271
Actually he just asked for a message and never mentioned a kick ...

Also, for fairness sake, I must add to my code the following:
I know for a fact that huge txt files (several MB) temporarily freeze your mIRC when using $read, it may take so long as to even get you a ping timeout. I do not know if the same happens if you were to use a userlist of the same size, never tried it. If it does, you might have to resort to hashtables. I guess it would depend on whether mIRC reads the userlist from a file or from memory. I haven't been able to find it in a file, so I guess it's in memory (which would make this point mute), but then where does mIRC store it when you exit the program. I couldn't find such file. Anyway, because I can't find it in any file, I assume it's stored in memory, and then a userlist should not experience the same problems as a file-based userlist like you (original poster) suggested. Or at least to a lesser extent.


DALnet #Helpdesk
I hear and I forget. I see and I remember. I do and I understand. -Confucius
#44262 26/08/03 08:52 PM
Joined: May 2003
Posts: 2,265
P
Hoopy frood
Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
edited the kick thing to an echo, bout the file size thing: i have a (fairly)slow computer and mirc doesnt freeze whilst reading through files until they reach 18mb for me, i dont think he'll manage to add that many users anyway :tongue:


new username: tidy_trax

Link Copied to Clipboard