PM Blocker with Dialog

By Bouncer on Apr 21, 2008

Here is a PM system I made some time ago with help from some of you here at Hawkee (excuse me for not naming anyone, but I forget exactly who all helped and it was a long time ago). You can block all PM's or add names to a list of allowed names that can PM you. It can be turned on and off at will as well. I believe I have all bugs there might have been worked out of it, so the time has come to post it for you all to use. Enjoy :)

-Edit-
Had to stop the DND working on a msg from Services, else it kept trying until you would flood out.

menu nicklist,status {
  DND System:dnd_system
}

alias dnd_system {
  dialog -mdo dnd_system dnd_system
}

dialog dnd_system {
  title "DND System"
  size -1 -1 100 160
  option dbu

  box "Controls", 1, 4 3 92 154

  text "DND Allow List", 2, 10 27 34 7, disable

  list 3, 10 35 80 100

  edit "", 4, 10 130 80 10, autohs

  radio "ON", 5, 26 13 15 10, group 
  radio "OFF", 6, 56 13 17 10

  button "Add", 7, 10 141 40 11
  button "Remove", 8, 50 141 40 11
}

on *:dialog:dnd_system:*:*: { 
  if ( $devent == init ) { 
    loadbuf -o $dname 3 dnd_allow.txt
    did -f $dname 4
    did -b $dname 7,8
    did -c $dname $iif(%dnd == on,5,6)
  }
  elseif ( $devent == sclick ) {
    if ( $did == 3 ) {
      did -e $dname 8
    }
    elseif ( $did == 5 ) {
      set %dnd on
      amsg 14,1[3,1 DND 0,1is 3,1ON 14,1][0,1 I am not accepting 3,1P2P's 14,1]
    }
    elseif ( $did == 6 ) {
      set %dnd off
      amsg 14,1[3,1 DND 0,1is 3,1OFF 14,1][0,1 I am now accepting 3,1P2P's 14,1]
    }
    elseif ( $did == 7 ) {
      if (( $read(dnd_allow.txt,w,$did(4)) == $null )) { 
        write -a dnd_allow.txt $chr(32) $+ $iif($did(dnd_system,3) != $null,$($crlf,0)) $did(4) 
        var %dnd_allow.line = $lines(dnd_allow.txt) 
        did -a $dname 3 $iif($did(dnd_system,3) != $null,$crlf) $+ $read(dnd_allow.txt,%dnd_allow.line)
      }
      did -r $dname 4
      did -b $dname 7
    }
    elseif ( $did == 8 ) {
      write -ds $did(3).seltext dnd_allow.txt
      var %l = 1 
      did -d $dname 3 $did(3).sel 
      while ( %l <= $lines(friends.txt) ) { 
        if (( $read(dnd_allow.txt,%l) == $null ) { goto lines } 
        did -a $dname 3 $iif($did(dnd_system,3) != $null,$crlf) $+ $read(dnd_allow.txt,%l)
        :lines
        inc %l
      }
      did -b $dname 8
    }
  }
  elseif ) $devent == dclick ) {
    if ( $did == $did(3).seltext ) {
      query $did(3).seltext
    }
  }
  elseif ( $devent == edit ) {
    did $iif($did(4),-e,-b) $dname 7
  } 
}

on ^*:TEXT:*:?: { 
  if ($nick == services) { close -m | halt }
  if ( %dnd == on ) && ( !$read(dnd_allow.txt,ntw,$nick) ) {
    .msg $nick 14,1[3,1 DND 0,1is 3,1ON 14,1][0,1 I am not accepting 3,1P2P's 14,1]  
    close -m 
    halt 
  }
}

Comments

Sign in to comment.
Xiodrade   -  Feb 04, 2012

I don't like how if someone not accepted PMs you, it closes all the accepted peoples PMs...but that was easily fixed by changing close -m to close -m $nick.

 Respond  
Eugenio   -  Jun 09, 2008

Becuase the script isnt execptional, its usefull.

 Respond  
T012m3n7oR   -  Jun 09, 2008

lol quit going all math out...
its his comment its w/e.

eugenio, then why didn\'t you rate him 9/10? :P

 Respond  
EL   -  Jun 08, 2008

ROFL@ gEne nah fella you said 2 things one counts as 50 and the other counts an the other 50 ya muppet stfu talkin to me BOY and we should stop spamin this dudes code>_>

 Respond  
T012m3n7oR   -  Jun 08, 2008

lolz, i already do play in traffic :)

and code what? :P

 Respond  
Eugenio   -  Jun 08, 2008

actually your both wrong and im right, the colours are horrid = 10% the script was nice = 90% so both of you stfu, like your in my mind or something ffs gtfo.
FAIL

 Respond  
EL   -  Jun 08, 2008

Umm the 50% wasn\'t about his rate you twats it was about his critique of the code.You said he complimented on some ones code but really only half of his comment was a compliment the other half wasn\'t hence my 50%:

Eugenio Said:
very nice script <--GOOD 50%
horrid colours. <--BAD 50%
7/10 --your 70%

Go play in traffic before you comment about my post son and GENE stfu boy and go code.:P

 Respond  
Eugenio   -  Jun 08, 2008

ROFL dumb bugger, pwnT

 Respond  
T012m3n7oR   -  Jun 08, 2008

only 50% ? lol you can\'t do math :P
7/10 = 70% xD

 Respond  
EL   -  Jun 08, 2008

ROFL well really only a 50% compliment cause he hated on the colors:P

 Respond  
Eugenio   -  Jun 08, 2008

rofl

 Respond  
T012m3n7oR   -  Jun 08, 2008

eugenio you complimented someone for once! im going to die!

 Respond  
Eugenio   -  May 13, 2008

very nice script
horrid colours.
7/10

 Respond  
dull   -  May 11, 2008

Hey Bouncer this script is nice... Very useful for blocking those enoying people you just dont want to ignore!

 Respond  
Jonesy44   -  Apr 29, 2008

haha @ EL

Bouncer, i\'ll try it once i\'ve finished this dammed history essay.. zzzzzzzzzz (you get the idea >.>)

 Respond  
EL   -  Apr 29, 2008

LAWL i never quit i ll quit when im dead....fat chance i ll die any time soon tho :P

 Respond  
Bouncer   -  Apr 29, 2008

Care to test/comment/criticize/rate my snippet jonesy44? :P

 Respond  
Jonesy44   -  Apr 29, 2008

lmfao :s

El quit with the inuendo xD

 Respond  
Bouncer   -  Apr 29, 2008

Haha, well slow or not, with no words, they can\'t click add. Click all day and it will do nothing. Once they start typing in the field, the Add button is the enabled. Also the Remove button is Disabled until a nick is selected from the allow list, then it too enables. I don\'t see how I can make it say an error message, when you can\'t even click the button, therefore you cannot trigger anything with it. Not even an error message.

And @ big, depends on what you are implying, lol.

 Respond  
EL   -  Apr 29, 2008

LOL yeah yeah like i said mundane but some ppl are well...a bit fuckin slow =/ LAWL i bet you like it big :P

 Respond  
Bouncer   -  Apr 29, 2008

Error for what? With no text in the edit, you cannot click add, and with no nick selected, you cannot click remove. Lol. As for big, I like the size :P

 Respond  
EL   -  Apr 29, 2008

Scratch the 6/10 ima give you a 7/10 cause it is usefull.`-.-

 Respond  
EL   -  Apr 29, 2008

The dialog is a bit BIG.You should add error notices for checkin to see if text has been entered the edit field and a entry is sselected in the list box.Mundane sure maybe but correct oh yes :P other wise its all good it blocks who its supposeed to an allows who it supposed to.\"Rate it or Hate it\"...6/10.`-.-

 Respond  
Bouncer   -  Apr 22, 2008

Ok, thanks for the explanation and example. I will have to try out some codes using it and learn when it is best to implement it.

 Respond  
guest598594   -  Apr 22, 2008

All it is, really, is an if and an else in one line.

$iif(if statement, if true, if false)

//echo -a I $iif($me == MountainDew,am,aint) MountainDew

Pretty simple :)

 Respond  
Bouncer   -  Apr 22, 2008

Updated, and thanks for the tip mountaindew. I haven\'t used $iif much at all and am still unfamiliar with all of it\'s potential uses. I have read the help file on it and it only helps so much with my understanding.

 Respond  
guest598594   -  Apr 21, 2008
    if ( $did(4) == $null ) {
      did -b $dname 7
    }
    elseif ( $did(4) != $null ) {
      did -e $dname 7
    }

I would use an $iif there

did $iif($did(4),-e,-b) $dname
 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.