|
|
Joined: Feb 2003
Posts: 3,432
Hoopy frood
|
Hoopy frood
Joined: Feb 2003
Posts: 3,432 |
on *:join:#: {
if ($nick != $me) && ($chan == #chat18+) {
if (!$isfile($+(join.txt))) { write join.txt }
if ($nick isin $read(join.txt, w, $+(*,$nick,*))) { describe $Chan Hey $nick $+ , Welcome Back. :) }
else {
describe $chan Hello $nick $+ , Welcome to $chan $+ . May we have your age Please ?
;write join.txt $nick
}
}
}
menu nicklist {
Add user:{ write join.txt $1 }
}
Just copy and paste, don't change anything and see if it working as you want it to right click in the nick list and you should see the menu there, the nick you have highlighted will be the one you add to the list..
if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
|
|
|
|
Joined: Nov 2003
Posts: 102
Vogon poet
|
OP
Vogon poet
Joined: Nov 2003
Posts: 102 |
ha, Works perfect! Thanks very much
|
|
|
|
Joined: Feb 2003
Posts: 3,432
Hoopy frood
|
Hoopy frood
Joined: Feb 2003
Posts: 3,432 |
If you want it to auto add in the future, just remove the ; in the end of the code: ;write join.txt $nick and you can edit the adding thing too.
menu nicklist {
Add user:{ write join.txt $1 | echo -a Added $1 to the list. }
}
if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
|
|
|
|
Joined: Nov 2003
Posts: 102
Vogon poet
|
OP
Vogon poet
Joined: Nov 2003
Posts: 102 |
wow man i was just messing with it and you even fixed my first problem...your code works with my PNP so i dont need to run it on my chat script anymore Very nice man . Greatly apprecate your services!
|
|
|
|
Joined: Jul 2007
Posts: 1,129
Hoopy frood
|
Hoopy frood
Joined: Jul 2007
Posts: 1,129 |
This one uses variables for nick storage and does the same thing instead of the text file: on *:JOIN:#: {
if ($nick != $me) && ($chan == #chat18+) {
if ($istok(%Users,$nick,44)) { describe # Hey $nick $+ , welcome back. :) }
else { describe # Hello $nick $+ , welcome to $chan $+ . May we have your age please? }
}
}
menu nicklist {
Add user: {
if ($1 isin %Users) { echo 4 -a * User $1 has already been added. }
else { set %Users $addtok(%Users,$1,44) | echo 2 -a * $1 added to the list. }
}
Delete user: {
if ($1 !isin %Users) { echo 4 -a * User $1 does not exist. }
else {
set %Users $remtok(%Users,$1,1,44) | echo 2 -a * User $1 has been removed from the list.
}
}
} Also a delete feature is added so you can remove nicknames stored that you don't want anymore.
Last edited by Tomao; 01/11/08 07:13 AM.
|
|
|
|
Joined: Dec 2007
Posts: 48
Ameglian cow
|
Ameglian cow
Joined: Dec 2007
Posts: 48 |
Wouldn't this be a perfect situation for user levels? o.O
|
|
|
|
Joined: Aug 2004
Posts: 7,252
Hoopy frood
|
Hoopy frood
Joined: Aug 2004
Posts: 7,252 |
One problem that I can foresee using variables for this, is if you are running the code on multiple channels and/or multiple networks, especially if there is a large number of users per channel and/or a network that allows very long nicks.
Eg: 5 networks @ 10 channels/network, 100 nicks/channel & 50 characters/nick. Some quick math gives me a total of 255,000 characters, which, if all stored in the one variable, would exceed (or at least push) the current limits for the number of characters allowed in a variable.
|
|
|
|
Joined: Jul 2007
Posts: 1,129
Hoopy frood
|
Hoopy frood
Joined: Jul 2007
Posts: 1,129 |
So what is your recommendation on such matter? Using a hash table perhaps?
|
|
|
|
Joined: Aug 2004
Posts: 7,252
Hoopy frood
|
Hoopy frood
Joined: Aug 2004
Posts: 7,252 |
While hash tables are one way of handling this, Kol's suggestion makes a lot of sense.
|
|
|
|
|
|