I'm making a tcl that adds extra info line to the user who is adding. For example: user Lame adds user test1, then the bot writes a line in to the user Lame record that he has 1 user added and he's nick is test1 and every time when user Lame adds someone, the bot adds his nick to that info line. This looks like this
Ok thats fine but the problem comes when let say test2 is deleted form the bot and I need his nick to be deleted from the info line of the other user (Lame). How do I make the bot to delete test2 from the info line of user Lame and leave test1 and test3 still in place ? So after words when someone matches user Lame he'll find
This little piece was posted a little while back by TriPpen^KiSs. Basically it scans userhandles for a given value, in this example, a particular field in the users XTRA info. This should address the problem?
foreach n [userlist] {
if {[getuser $n XTRA] == "$value"} {
puthelp "PRIVMSG $nick : Scan has $n with XTRA of $value"
}
Both the check it's making on each user and the action it takes can easily be changed. So to take it further, then do a check on the "test1 test2 test3" field. Lets say this field is stored in one of the users XTRA OPSADDED field
set x [split [getuser $hand XTRA OPSADDED]]
set z ""
if {$x != ""} {
foreach y $x {
if {$y != "$nick"} {
set z "$y $z"
}
}
if {$z != ""} {setuser $hand XTRA OPSADDED $z}
}
The final piece would look something like:
proc delmemrecord {exmember} {
foreach n [userlist] {
set x [split [getuser $n XTRA OPSADDED]]
set t 0
if {$x != ""} {
set t 1
set z ""
foreach y $x {
if {$y != "$exmember"} {
set z "$y $z"
}
}
if {$t > 0} {setuser $n XTRA OPSADDED $z}
}
}
<font size=-1>[ This Message was edited by: Mordred on 2002-04-06 05:13 ]</font>