mIRC Home    About    Download    Register    News    Help

Print Thread
#146235 01/04/06 09:18 PM
Joined: Apr 2006
Posts: 43
D
Ameglian cow
OP Offline
Ameglian cow
D
Joined: Apr 2006
Posts: 43
Well i was making a script so when i do !addip <ip goes here>
it will store it in ip.txt and give it a number, So if i were to do !viewip <number> it would show me that IP.

on *:TEXT:!addip*:#: {
if ($me == [BBF]Guard) {
set %wtf $Lines(ip.txt)
inc %wtf
write ip.txt %wtf $2-
notice $nick $2- Has been added to the IP file as IP # $+ %wtf
unset %wtf
}
}
on *:TEXT:!viewip*:#: {
if ($me == [BBF]Guard) {
msg $chan $read(ip.txt, s, $2)
}
}

#146236 01/04/06 09:39 PM
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Code:
on *:text:!addip*:#:{
if ($me == [BBD]Guard) {
.write ip.txt $2-
.notice $nick $2- Has been added to the IP file as IP # $+ $lines(IP.txt)
}
}
on *:text:!viewip*:#:{
if ($me == [BBF]Guard) {
.msg $chan $read(ip.txt,$2)
}
}
  


Please note that I haven't included any safeties to prevent
1) the same IP address being added more than once
2) confirmation that it is a valid IP address
3) a null entry (ie: someone using !addip but not providing an IP address)
4) someone specifying a non-existant or invalid entry in the !viewip section

#146237 01/04/06 11:05 PM
Joined: Apr 2006
Posts: 43
D
Ameglian cow
OP Offline
Ameglian cow
D
Joined: Apr 2006
Posts: 43
I get

-
* /write: unable to open file (line 19, script.ini)
-

#146238 02/04/06 12:18 AM
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
You'd better post your code (and please remember to use the Code Tags when you do), as the entire code that I posted only has 11 lines, therefore making it impossible for my code to come up with an error on line 19

#146239 02/04/06 01:37 AM
Joined: Apr 2006
Posts: 43
D
Ameglian cow
OP Offline
Ameglian cow
D
Joined: Apr 2006
Posts: 43
When i do this
<[BBF]Dave> !addip 754.12.654.23
I get
-[BBF]Guard- 754.12.654.23 Has been added to the IP file as IP #batcave1

But it never saves it into the txt.


Code:
 on *:text:!addip*:#:{if ($me == [BBD]Guard) {.write ip.txt $2-.notice $nick $2- Has been added to the IP file as IP # $+ $lines(IP.txt)}}on *:text:!viewip*:#:{if ($me == [BBF]Guard) {.msg $chan $read(ip.txt,$2)}}  

Last edited by Dave4989; 02/04/06 01:38 AM.
#146240 02/04/06 02:09 AM
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Dave: If the code that you're trying to use is all on one line, like you posted, remove that code, then re-enter the code that I gave you one line at a time. Due to compatability problems, code copied from this forum does not copy inot internet explorer correctly, and when trying to copy it, one gets it all on one line, like you posted.

Also, I noticed in your reply that the bot's nick is [BBF]Guard, yet in the code it checks to see if the bot's nick is [BBD]Guard.

One thing I did forget about when writing the code is the fact that the # will translate into the name of the channel in the notice message. To get the # symbol showing replace it in the notice message with $chr(35)

Also, you might try putting the n switch into the $read command.


Link Copied to Clipboard