SHARE
TWEET

GhostKill NickProtection / On connect edit.

Ford Jun 22nd, 2011 181 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;Nick Protection Script by Ford_Lawnmower irc.mindforge.org #USA-Chat
  2. menu channel,status {
  3.   Nick Protection:dialogopen Nickprotection Nickprotection
  4. }
  5. dialog NickProtection {
  6.   title "Nick Protection"
  7.   size -1 -1 120 128
  8.   option dbu
  9.   text "Protection List:", 1, 8 6 105 8, center
  10.   list 2, 7 16 106 74, sort size vsbar
  11.   button "Add", 3, 8 96 29 12
  12.   button "Edit", 4, 44 96 29 12
  13.   button "Delete", 5, 81 96 29 12
  14.   button "Set Up Unidentified Protection", 6, 8 112 101 12
  15. }
  16. On *:dialog:NickProtection:init:*:{
  17.   var %records $hget(NickProtection,0).item
  18.   while (%records)  {
  19.     did -a $dname 2 $gettok($hget(NickProtection,%records).data,2,32) $gettok($hget(NickProtection,%records).data,1,32)
  20.     dec %records
  21.   }
  22. }
  23. On *:dialog:NickProtection:Sclick:3-6:{
  24.   if ($did == 6) { DialogOpen UProtect UProtect | return }
  25.   if ($did == 5) {
  26.     if ($did($dname,2).seltext) {
  27.       var %Pnetwork $gettok($v1,1,32), %Pnick $gettok($v1,2,32), %Pnetworks $notify(%Pnick).network
  28.       hdel NickProtection $+(%Pnick,%Pnetwork)
  29.       if ($gettok(%Pnetworks,2,44)) {
  30.         %Pnetworks = $deltok(%Pnetworks,$findtok(%Pnetworks,%Pnetwork,1,44),44)
  31.         .notify -r %Pnick
  32.         .notify -n %Pnick %Pnetworks Added by NickProtection Script
  33.       }
  34.       else { .notify -r %Pnick }
  35.       if ($dialog($dname)) { did -d $dname 2 $didwm($dname,2,%Pnetwork %Pnick) }
  36.     }
  37.     return
  38.   }
  39.   if ($did == 4) {
  40.     if ($did($dname,2).seltext) {
  41.       dialogopen NP_Add_Edit Np_Add_Edit
  42.       tokenize 32 $hget(NickProtection,$+($gettok($did($dname,2).seltext,2,32),$gettok($did($dname,2).seltext,1,32)))
  43.       dialog -x NickProtection
  44.       did -c NP_Add_Edit 1 $didwm(NP_Add_Edit,1,$2)
  45.       did -ra NP_Add_Edit 2 $1
  46.       did -a NP_Add_Edit 3 $3
  47.       if ($4) { did -c NP_Add_Edit 4 }
  48.       if ($5) { did -c NP_Add_Edit 5 }
  49.       if ($6) { did -c NP_Add_Edit 13 }
  50.     }
  51.     return
  52.   }
  53.   dialogopen NP_Add_Edit Np_Add_Edit
  54.   dialog -x NickProtection
  55. }
  56. dialog NP_Add_Edit {
  57.   title "Nick Protection Add/Edit"
  58.   size -1 -1 120 128
  59.   option dbu
  60.   combo 1, 40 8 72 10, drop
  61.   edit "", 2, 40 32 72 10, autohs
  62.   edit "", 3, 40 48 72 10, pass autohs
  63.   check "Protect this Nickname", 4, 40 64 66 10
  64.   check "Identify this Nickname", 5, 40 80 66 10
  65.   button "Apply", 6, 8 112 37 12
  66.   button "Close", 7, 75 112 37 12, cancel
  67.   text "Network:", 8, 8 9 26 8, right
  68.   text "Nickname:", 9, 8 33 26 8, right
  69.   text "Password:", 10, 8 49 26 8
  70.   text "GhostKill:", 11, 8 65 26 8, right
  71.   text "Identify:", 12, 8 80 26 8, right
  72.   check "Recover after Ghosting", 13, 40 96 74 10
  73.   text "Recover:", 14, 8 96 25 8, right
  74. }
  75. On *:dialog:Np_Add_Edit:Close:*:{ dialogopen NickProtection NickProtection }
  76. On *:dialog:Np_Add_Edit:Sclick:6:{
  77.   tokenize 32 $iif($did($dname,2).text,$v1,0) $iif($did($dname,1).seltext,$v1,0) $iif($did($dname,3).text,$v1,0) $did($dname,4).state $did($dname,5).state $did($dname,13).state
  78.   if ($1) && ($2) && ($3) {
  79.     dialog -x $dname
  80.     hadd -m NickProtection $+($1,$2) $1-
  81.     dialogopen NickProtection NickProtection
  82.     var %message Added by NickProtection Script
  83.     if ($2 == all) {
  84.       $iif($notify($1),.notify -r $1)
  85.       notify $1 %message
  86.       return
  87.     }
  88.     if ($notify($1).network) {
  89.       var %networks $v1
  90.       .notify -r $1
  91.       .notify -n $1 $iif($istok(%networks,$2,44),%networks,$addtok(%networks,$2,44)) %message
  92.       return
  93.     }
  94.     $iif($notify($1),.notify -r $1)
  95.     .notify -n $1-2 %message
  96.   }
  97. }
  98. On *:dialog:NP_Add_Edit:init:*:{
  99.   var %nets $scon(0)
  100.   while (%nets) && ($dialog($dname)) {
  101.     did -a $dname 1 $scon(%nets).network
  102.     dec %nets
  103.   }
  104.   did -a $dname 1 ALL
  105.   did -c $dname 1 $didwm($dname,1,$network)
  106.   did -a $dname 2 $me
  107.   did -f $dname 3
  108.   Tokenize 32 $did(NickProtection,2).seltext
  109.   $iif($gettok($hget(NickProtection,$+($2,$1)),4,32),did -c $dname 4)
  110.   $iif($gettok($hget(NickProtection,$+($2,$1)),5,32),did -c $dname 5)
  111.   $iif($gettok($hget(NickProtection,$+($2,$1)),6,32),did -c $dname 13)
  112. }
  113. dialog UProtect {
  114.   title "Unidentified Protection"
  115.   size -1 -1 120 136
  116.   option dbu
  117.   combo 1, 32 8 84 10, drop
  118.   edit "", 2, 32 24 82 10, autohs
  119.   check "Protect for this Network", 3, 32 40 74 10
  120.   button "Apply", 5, 45 123 32 12
  121.   button "Exit", 6, 82 123 32 12, cancel
  122.   text "Network:", 7, 0 8 31 8, right
  123.   text "Nick Prefix:", 8, 0 24 31 8, right
  124.   box "Current list of Unidentified Protections", 10, 6 56 110 66
  125.   list 4, 10 64 102 54, size vsbar
  126. }
  127. On *:dialog:UProtect:init:*: {
  128.   var %nets $scon(0)
  129.   while (%nets) {
  130.     did -a $dname 1 $scon(%nets).network
  131.     dec %nets
  132.   }
  133.   did -c $dname 1 $didwm($dname,1,$network)
  134.   UProList
  135.   if ($hget(UProtect,$did($dname,1).seltext)) {
  136.     did -ra $dname 2 $v1
  137.     did -c $dname 3
  138.   }
  139. }
  140. On *:dialog:UProtect:Sclick:1,3-5: {
  141.   if ($did == 1) {
  142.     if ($hget(UProtect,$did($dname,1).seltext)) {
  143.       did -ra $dname 2 $v1
  144.       did -c $dname 3
  145.     }
  146.     else { did -r $dname 2 | did -u $dname 3 }
  147.   }
  148.   if ($did == 3) && ($did($dname,2).text) {
  149.     var %net $did($dname,1).seltext
  150.     if ($did($dname,3).state) {
  151.       hadd -m UProtect %net $did($dname,2).text
  152.     }
  153.     else { $iif($hfind(UProtect,%net).item,hdel UProtect $v1) }
  154.     UProList
  155.   }
  156.   if ($did == 4) {
  157.     did -c $dname 1,3 $didwm($dname,1,$gettok($did($dname,4).seltext,1,32))
  158.     did -ra $dname 2 $gettok($did($dname,4).seltext,2,32)
  159.   }
  160. }
  161. alias -l UProList {
  162.   did -r UProtect 4
  163.   var %nets $hget(UProtect,0).item
  164.   while (%nets) {
  165.     did -a UProtect 4 $hget(Uprotect,%nets).item $hget(Uprotect,%nets).data
  166.     dec %nets
  167.   }
  168. }
  169. On *:Nick: {
  170.   if ($regex($newnick,/\Q $+ $hget(UProtect,$network) $+ \E[0-9]{4}/i)) && ($nick == $me) && ($hfind(nickprotection,$+(*,$network),0,w).item) {
  171.     nick $remove($hfind(nickprotection,$+(*,$network),$r(1,$v1),w).item,$network)
  172.   }
  173. }
  174. On *:Notice:*NickServ IDENTIFY*:?: {
  175.   if ($nick == Nickserv) {
  176.     if ($gettok($hget(NickProtection,$+($me,$network)),5,32)) || ($gettok($hget(NickProtection,$+($me,ALL)),5,32)) {
  177.       .msg nickserv identify $iif($gettok($hget(NickProtection,$+($me,$network)),3,32),$v1,$gettok($hget(NickProtection,$+($me,ALL)),3,32))
  178.     }
  179.   }
  180. }
  181. On $*:Notice:/\/ns recover\s(.*)\[password]/Si:?:{
  182.   if ($nick == Nickserv) && ($gettok($server,-2-,46) == $gettok($wildsite,-2-,46)) {
  183.     .msg nickserv recover $regml(1) $iif($gettok($hget(NickProtection,$+($nick,$network)),3,32),$v1,$gettok($hget(NickProtection,$+($nick,ALL)),3,32))
  184.   }
  185. }
  186. On ^*:Notify:{
  187.   if ($notify($nick).note == Added by NickProtection Script) { haltdef }
  188.   if ($nick == $me) { return }
  189.   if ($gettok($hget(NickProtection,$+($nick,$network)),4,32)) || ($gettok($hget(NickProtection,$+($nick,ALL)),4,32)) {
  190.     echo -st 07NickProtection-GhostKill 04Killed $nick $notify($nick).addr 06@ $time On $adate
  191.     .msg nickserv ghost $nick $iif($gettok($hget(NickProtection,$+($nick,$network)),3,32),$v1,$gettok($hget(NickProtection,$+($nick,ALL)),3,32))
  192.     if ($gettok($hget(NickProtection,$+($nick,$network)),6,32)) || ($gettok($hget(NickProtection,$+($nick,ALL)),6,32)) { .timer 1 4 nick $nick }
  193.   }
  194. }
  195. ;Raw 433:*: {
  196. ;  if ($gettok($hget(NickProtection,$+($2,$network)),5,32)) || ($gettok($hget(NickProtection,$+($2,ALL)),5,32)) {
  197. ;    .msg nickserv release $2 $iif($gettok($hget(NickProtection,$+($2,$network)),3,32),$v1,$gettok($hget(NickProtection,$+($2,ALL)),3,32))
  198. ;    .timer 1 4 nick $2
  199. ;  }
  200. ;}
  201. On *:Connect:{
  202.   if (!$hget(NickProtection)) {
  203.     hmake NickProtection 5
  204.     if ($exists(NickProtection.hsh)) hload NickProtection NickProtection.hsh
  205.   }
  206.   if (!$hget(Uprotect)) {
  207.     hmake Uprotect 5
  208.     if ($exists(Uprotect.hsh)) hload Uprotect Uprotect.hsh
  209.   }
  210.   if ($gettok($hget(NickProtection,$+($me,$network)),5,32)) || ($gettok($hget(NickProtection,$+($me,ALL)),5,32)) {
  211.     .msg nickserv identify $iif($gettok($hget(NickProtection,$+($me,$network)),3,32),$v1,$gettok($hget(NickProtection,$+($me,ALL)),3,32))
  212.   }
  213. }
  214. On *:Start:{
  215.   if ($exists(NickProtection.hsh)) { hmake NickProtection 5 | hload NickProtection NickProtection.hsh  }
  216.   if ($exists(Uprotect.hsh)) { hmake Uprotect 5 | hload Uprotect Uprotect.hsh  }  
  217. }
  218. On *:Disconnect:{
  219.   if ($hget(NickProtection)) { hsave NickProtection NickProtection.hsh }
  220.   if ($hget(Uprotect)) { hsave Uprotect Uprotect.hsh }
  221. }
  222. On *:Exit:{
  223.   if ($hget(NickProtection)) {
  224.     hsave NickProtection NickProtection.hsh
  225.     hfree NickProtection
  226.   }
  227.   if ($hget(Uprotect)) {
  228.     hsave Uprotect Uprotect.hsh
  229.     hfree Uprotect
  230.   }  
  231. }
  232. alias -l DialogOpen { dialog $iif($dialog($1),-v,-m) $1- }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top