Advertisement
Guest User

Untitled

a guest
Jul 28th, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.55 KB | None | 0 0
  1. // Auto-ignore script with wildcard (e.g. clantag) support by DES|Bukz
  2. // Requires tools.cfg
  3.  
  4. initialize [eikellist] []
  5. initialize [aiscript aiwildcards] 0
  6.  
  7. // add2ai -- Used to add names to the auto-ignore list, supports multiple entires at the same time
  8. // via multiple arguments (up to 24).
  9. alias add2ai [
  10.   if (> $numargs 0) [
  11.     loop x $numargs [add2list eikellist (getalias (format "arg%1" (+ $x 1)))]
  12.     echo (c 0)Your auto-ignore list has sucessfully been updated!
  13.     checkclients
  14.   ] [
  15.     echo (c 3)"/add2ai requires at least 1 argument (name)..."
  16.   ]
  17. ]
  18.  
  19. // checkclients -- Used to check all clients on a server against entries in the auto-ignore list.
  20. alias checkclients [
  21.   if (> (listlen $eikellist) 0) [
  22.     loop w (+ (curhighestcn) 1) [
  23.       loop u (listlen $eikellist) [
  24.         if $aiwildcards [
  25.           if (strstr (findpn $w) (at $eikellist $u)) [
  26.             ignore $w
  27.           ] []
  28.         ] [
  29.           if (strcmp (findpn $w) (at $eikellist $u)) [
  30.             ignore $w
  31.           ] []
  32.         ]
  33.       ]
  34.     ]
  35.   ] []
  36. ]
  37.  
  38. alias showai [echo $eikellist]
  39.  
  40. // clearai -- Used to remove all entires in the auto-ignore list, will unignore any players that were
  41. // on the list before doing so. TODO: Support for an optional argument that will only remove specific
  42. // entires if they exist.
  43. alias clearai [
  44.   if (= $arg1 1) [
  45.     loop f (+ (curhighestcn) 1) [
  46.       loop e (listlen $eikellist) [
  47.         if $aiwildcards [
  48.           if (strstr (findpn $f) (at $eikellist $e)) [
  49.             clearignored $f
  50.           ] []
  51.         ] [
  52.           if (strcmp (findpn $f) (at $eikellist $e)) [
  53.             clearignored $f
  54.           ] []
  55.         ]
  56.       ]
  57.     ]
  58.     alias eikellist []
  59.     echo (c 2)The contents of your auto-ignore list has been cleared!
  60.   ] []
  61. ]
  62.  
  63. // To avoid recursive bloat on the client, plug checkclients into msa and some other specific
  64. // events, to ensure automation of the script.
  65. addcheck_msa [if (&& (= $aiscript 1) (= $connected 1)) [checkclients] []]
  66.  
  67. add2conloop [
  68. if_conline_has "connected:" [if (&& (= $aiscript 1) (= $connected 1)) [checkclients] []] [] // Check clients upon a new connection
  69. if_conline_has "is now known as" [if (&& (= $aiscript 1) (= $connected 1)) [checkclients] []] [] // Check clients upon a name change
  70. ]
  71.  
  72. alias ai [showmenu "Auto-Ignore"]
  73.  
  74. newmenu "Auto-Ignore"
  75. menuitemcheckbox [Use wildcards?] [$aiwildcards] [aiwildcards = $arg1]
  76. menuitemcheckbox [Enable script?] [$aiscript] [aiscript = $arg1]
  77. menuitem [] -1
  78. menuitemvar [concat (c 0)Add to auto-ignore list] [closemenu "Auto-Ignore"; saycommand "/add2ai "]
  79. menuitemvar [concat (c 3)Clear auto-ignore list] [showmenu "Clear AI Confirm"]
  80. menuitemvar [concat (c 2)Show auto-ignore list] [showai]
  81. menuitem [] -1
  82. menuitem [           OK] [closemenu "Auto-Ignore"; checkclients]
  83.  
  84. newmenu "Clear AI Confirm"
  85. menuinitselection [4]
  86. menuitem [Are you sure you want to delete all] -1
  87. menuitem [entries from your auto-ignore list?] -1
  88. menuitem [] -1
  89. menuitemvar [concat (c 0)Yes] [clearai 1]
  90. menuitemvar [concat (c 3)No] [closemenu "Clear AI Confirm"]
  91.  
  92. add2menu Misc [menuitem [Auto-ignore settings] [showmenu "Auto-Ignore"]]
  93.  
  94. docsection [AI];
  95.  
  96. docident [add2ai] [Adds names to your auto-ignore list.];
  97. docargument [N] [The name you wish to add.];
  98. docexample [/add2ai unarmed] [Result: Adds "unarmed" to the auto-ignore list.];
  99. docexample [/add2ai unarmed wildjoe fatn00b] [Result: Adds all 3 names to the auto-ignore list.];
  100. docremark [Multiple names can be added to the list at once by using multiple arguments (up to 24). If wildcard support is enabled, clan tags may be used instead of full names, to block multiple clients with a single entry.];
  101.  
  102. docident [clearai] [Clears the entire contents of your auto-ignore list.];
  103. docargument [X] [Must be 1 to work.];
  104. docexample [/clearai 1] [Result: Clears the auto-ignore list.];
  105.  
  106. docident [showai] [Shows the current contents of your auto-ignore list.];
  107.  
  108. docident [ai] [Shows the auto-ignore script menu.];
  109.  
  110. // Example script usage of add2ai.
  111. // Adds "|FOO|" to the client's auto-ignore list only if wildcard support is enabled and "|FOO|"
  112. // does not already exist in the list. From then on, while the wildcard feature is enabled,
  113. // anyone with "|FOO|" anywhere in their name will be auto-ignored. If wildcard support is disabled,
  114. // only clients with the exact name "|FOO|" will be auto-ignored.
  115. //
  116. // if $aiwildcards [
  117. //  loop i (listlen $eikellist) [
  118. //    if (strcmp (at $eikellist $i) |FOO|) [tmpfound = 1] [tmpfound = 0]
  119. //  ]
  120. //  if $tmpfound [] [add2ai |FOO|]
  121. // ] []
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement