mIRC Home    About    Download    Register    News    Help

Topic Options
#137654 - 17/12/05 03:02 AM Assistance with Shitlist
Mail Offline
Pikka bird

Registered: 31/08/05
Posts: 18
I recently made a shitlist using hash tables and it works fine as far as adding and kicking the person in the table. Now I am trying to remove an entry from the table with no success. Any assistance with this small problem would be appreciated.
Code:
 
 ;Hash Table Shitlister by Mail 
on *:start: { 
  hmake shitlist 100  
  if ($exists(shitlist.txt)) hload shitlist shitlist.txt  
} 

on ^*:text:*:#: { 
  if ($1 === ![censored]) && ($me isowner $chan) { 
    hmake -m shitlist 100 
    hadd shitlist chan $chan 
    if ($2 ison $chan) { hadd shitlist address $addtok($hget(shitlist,address),$$ial($$2,1).addr,32) } 
    if ($2 !ison $chan) { hadd shitlist $addtok($hget(shitlist,address),$2,32) } 
    msg $hget(shitlist,chan) $2 Has Been Added To My Shitlist 
    access $chan add DENY $$ial($$2,1).addr 1440 
    kick $chan $2 Shitlisted 
    timersave 1 10 hsave -a shitlist shitlist.txt 
  } 
} 
on *:Join:*: { 
  if ($me isowner $chan) && ($address isin $hget(shitlist,address)) || ($nick isin $hget(shitlist,address)) { 
    access $chan add DENY $$ial($nick,1).addr 1440 
    kick $chan $nick Shitlisted 
  } 
} 
menu nicklist { 
  .Add [censored]:hadd -m shitlist $$ial($$1,1).addr $snicks(#,0) | hadd shitlist chan $chan | hsave -a shitlist shitlist.txt 
} 

Top
#137655 - 17/12/05 03:07 AM Re: Assistance with Shitlist
NeUtRoN_StaR Offline
Fjord artisan

Registered: 06/03/05
Posts: 212
hdel shitlist entryname

Top
#137656 - 17/12/05 03:25 AM Re: Assistance with Shitlist
Mail Offline
Pikka bird

Registered: 31/08/05
Posts: 18
This is what I did. But since I am adding using $addtok I believe thats causing the problem. Was trying to keep everything easy to find. I am still learning to use tokens and dont know how to remove using them. I have adding by $addtok down pretty good.
Code:
  if ($1 === !unshit) && ($me isowner $chan) {
    if ($2 ison $chan) { hdel shitlist $$ial($$2,1).addr }
    if ($2 !ison $chan) { hdel shitlist $2 }
  }

By the way this didn't work.


Edited by Mail (17/12/05 03:40 AM)

Top
#137657 - 17/12/05 02:08 PM Re: Assistance with Shitlist
RusselB Offline
Planetary brain

Registered: 03/08/04
Posts: 7252
Loc: Ontario, Canada
You have to delete the token from the hash table entry.
Made a few other modifications to your script which will actually make it work better.


Code:
  ;Hash Table Shitlister by Mail 
on *:start: { 
  hmake shitlist 100  
  if ($exists(shitlist.txt)) { hload shitlist shitlist.txt  }
} 

on ^*:text:*:#: { 
  if ($1 === ![censored]) && ($me isowner $chan) { 
    hadd -m shitlist chan $chan 
    if ($2 ison $chan) { hadd -m shitlist address $addtok($hget(shitlist,address),$$ial($$2,1).addr,32) } 
    if ($2 !ison $chan) { hadd -m shitlist $addtok($hget(shitlist,address),$2,32) } 
    msg $hget(shitlist,chan) $2 Has Been Added To My Shitlist 
    access $chan add DENY $$ial($$2,1).addr 1440 
    kick $chan $2 Shitlisted 
    hsave -o shitlist shitlist.txt 
  } 
elseif ($1 == !unshit) && ($me isowner $chan) {
.hadd -m shitlist address $remtok($hget(shitlist,address),$2,1,32)
}
} 
on *:exit:{
.hsave -o shitlist shitlist.txt
}
on *:disconnet:{
.hsave -o shitlist shitlist.txt
}
on *:Join:*: { 
  if ($me isowner $chan) && ($address isin $hget(shitlist,address)) || ($nick isin $hget(shitlist,address)) { 
    access $chan add DENY $$ial($nick,1).addr 1440 
    kick $chan $nick Shitlisted 
  } 
} 
menu nicklist { 
  .Add [censored]:hadd -m shitlist $$ial($$1,1).addr $snicks(#,0) | hadd shitlist chan $chan | hsave -a shitlist shitlist.txt 
} 
 

Top
#137658 - 17/12/05 04:00 PM Re: Assistance with Shitlist
Mail Offline
Pikka bird

Registered: 31/08/05
Posts: 18
Thanks Russel, I see where I was making my error now. Thanks alot for the lesson. wink

Top
#137659 - 17/12/05 06:07 PM Re: Assistance with Shitlist
RusselB Offline
Planetary brain

Registered: 03/08/04
Posts: 7252
Loc: Ontario, Canada
No problem..I learned how to work with tokens before hash tables. I'm currently working on learning sockets & dialogs.

Top