mIRC Homepage

Assistance with Shitlist

Posted By: Mail

Assistance with Shitlist - 17/12/05 03:02 AM

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 
} 
Posted By: NeUtRoN_StaR

Re: Assistance with Shitlist - 17/12/05 03:07 AM

hdel shitlist entryname
Posted By: Mail

Re: Assistance with Shitlist - 17/12/05 03:25 AM

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.
Posted By: RusselB

Re: Assistance with Shitlist - 17/12/05 02:08 PM

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 
} 
 
Posted By: Mail

Re: Assistance with Shitlist - 17/12/05 04:00 PM

Thanks Russel, I see where I was making my error now. Thanks alot for the lesson. wink
Posted By: RusselB

Re: Assistance with Shitlist - 17/12/05 06:07 PM

No problem..I learned how to work with tokens before hash tables. I'm currently working on learning sockets & dialogs.
© 2019 mIRC Discussion Forums