Advertisement
Jlinkz

Assaultcube Auto gema kick script

Jul 2nd, 2012
300
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.40 KB | None | 0 0
  1. bellow is the Assaultcube Auto gema kick script. Paste this inside your assaultcube directory scripts.cfg or autoexe.cfg file.
  2.  
  3. Tip: You must restart ac for script to be loaded.
  4. if you need any help please post on our fourms, http://Forums.esaclan.tk
  5. ________________________________________________________________
  6.  
  7. // autogemakick script by |FOX|Yarukinasu
  8. // to enable or disable the autogemakick, type /autogemakick
  9. // prefix increment operator
  10. ++ = [ += $arg1 1 ]
  11. // a name that cannot be a name
  12. EMPTY = 0000000000000000
  13. // names of the gema maps
  14. GEMA_MAPS = [
  15. G3M4 G3M@ G3MA G3m4 G3m@ G3mA G3ma GEM4 GEM@ GEMA GEMa GEm4 GEm@ GEma
  16. Gem4 Gem@ GemA Gema g3M4 g3M@ g3Ma g3m4 g3m@ g3mA g3ma gEM4 gEM@ gEMA
  17. gEMa gEm4 gEm@ gEmA gEma geM4 geM@ geMa gem@ gemA gema jigsaw ]
  18. // maximum number of clients connected
  19. MAX_CN = 20
  20. // convincing reasons
  21. REASONS = [
  22. if (= $arg1) [ tmpreason = "killing_(You_can_not_kill_on_this_mode)" ] [
  23. if (= $arg1 1) [ tmpreason = "team killing" ] [
  24. if (= $arg1 2) [ tmpreason = "excessive killing" ] [
  25. if (= $arg1 3) [ tmpreason = "excessive and team killing" ] [
  26. if (= $arg1 4) [ tmpreason = "flag spamming" ] [
  27. if (= $arg1 5) [ tmpreason = "changeteam spamming" ] [
  28. if (= $arg1 6) [ tmpreason = "name spamming" ] ] ] ] ] ] ]
  29. result (format "no %1 on gema pl0x~" $tmpreason) ]
  30. // the switch for autogemakickloop
  31. agk = 0
  32. // the list of killers' names
  33. killernamelist = ""
  34. // toggles the autogemakick
  35. autogemakick = [
  36. if $agk [
  37. echo (c 3) "autogemakick is disabled..."; agk = 0 ] [
  38. echo (c 0) "autogemakick is enabled..."; agk = 1 ]
  39. repeat_autogemakick ]
  40. // this loop does the following:
  41. // 1. compares the ffdstat and the old_ffdstat, and if they are unequal,
  42. // check for a player that fragged, team killed, or flag spammed
  43. // 2. says the time it took for a player to score
  44. // 3. kicks the spammers: changeteam spam and name change spam
  45. autogemakickloop = [
  46. update_connectedcn
  47. update_ffdstat
  48. if (strnot $ffdstat $old_ffdstat) [
  49. loop i $MAX_CN [
  50. if (|| [ at $old_connectedcn $i ] [ ! (at $connectedcn $i) ]) [
  51. if (isconnected $i) [
  52. iindex = (* $i 3)
  53. numflag = (at $ffdstat $iindex)
  54. old_numflag = (at $old_ffdstat $iindex)
  55. numfrag = (at $ffdstat (+ $iindex 1))
  56. old_numfrag = (at $old_ffdstat (+ $iindex 1))
  57. numdeath = (at $ffdstat (+ $iindex 2))
  58. old_numdeath = (at $old_ffdstat (+ $iindex 2))
  59. flagdif = (- $numflag $old_numflag)
  60. fragdif = (- $numfrag $old_numfrag)
  61. deathdif = (- $numdeath $old_numdeath)
  62. if (> $fragdif) [
  63. vote 2
  64. if (checkkillername (findpn $i)) [
  65. ban $i (REASONS 2) ] [
  66. kick $i (REASONS 0) ] ] [
  67. if (&& [ <= $fragdif -1 ] [ != $deathdif 1 ]) [
  68. vote 2
  69. if (checkkillername (findpn $i)) [
  70. ban $i (REASONS 3) ] [
  71. kick $i (REASONS 1) ] ] [
  72. if (= $flagdif 1) [
  73. if (= $numflag 1) [
  74. tmpgematime = (div (- (millis) (at $gematimes $i)) 1000)
  75. minutepassed = (div $tmpgematime 60)
  76. secondpassed = (mod $tmpgematime 60)
  77. if (<= $minutepassed 1) [
  78. if $minutepassed [
  79. tmpminute = "1 minute" ] [
  80. tmpminute = "" ] ] [
  81. tmpminute = (concat $minutepassed "minutes") ]
  82. if (<= $secondpassed 1) [
  83. tmpsecond = "1 second" ] [
  84. tmpsecond = (concat $secondpassed "seconds") ]
  85. if (&& $minutepassed [ strnot $tmpsecond ]) [
  86. tmpsecond = (concat " and" $tmpsecond) ]
  87. statmessage = (concat (findpn $i) "finished the gema in")
  88. say (format "%1 %2%3." $statmessage $tmpminute $tmpsecond) ] [
  89. if (>= $numflag 3) [
  90. if (>= $numflag 5) [
  91. vote 2
  92. forceteam $i ] [
  93. say (REASONS 4) ] ] ] ] ] ] ] ] ]
  94. changeskin ]
  95. update_old ffdstat
  96. if (strnot $connectedcn $old_connectedcn) [
  97. loop i $MAX_CN [
  98. if (&& [ at $connectedcn $i ] [ ! (at $old_connectedcn $i) ]) [
  99. gematimes = (update_list $gematimes $i (millis)) ] ] ]
  100. update_old connectedcn
  101. update_teamlist
  102. if (strnot $teamlist $old_teamlist) [
  103. loop i $MAX_CN [
  104. if (&& [ != (at $teamlist $i) -1 ] [ != (at $old_teamlist $i) -1 ]) [
  105. if (&& [ <= (at $teamlist $i) 1 ] [ <= (at $old_teamlist $i) 1 ]) [
  106. if (!= (at $teamlist $i) (at $old_teamlist $i)) [
  107. tmpincrement = (+ (at $changeteam_log $i) 1)
  108. changeteam_log = (update_list $changeteam_log $i $tmpincrement) ] ] ] ] ]
  109. update_old teamlist
  110. if (strnot $changeteam_log $old_changeteam_log) [
  111. loop i $MAX_CN [
  112. if (>= (at $changeteam_log $i) 10) [
  113. kick $i (REASONS 5)
  114. changeteam_log = (update_list $changeteam_log $i 0) ] ] ]
  115. update_old changeteam_log
  116. update_namelist
  117. if (strnot $namelist $old_namelist) [
  118. loop i $MAX_CN [
  119. if (&& [ strnot (at $namelist $i) $EMPTY ] [ strnot (at $old_namelist $i) $EMPTY ]) [
  120. if (strnot (at $namelist $i) (at $old_namelist $i)) [
  121. tmpincrement = (+ (at $name_log $i) 1)
  122. name_log = (update_list $name_log $i $tmpincrement) ] ] ] ]
  123. update_old namelist
  124. if (strnot $name_log $old_name_log) [
  125. loop i $MAX_CN [
  126. if (>= (at $name_log $i) 10) [
  127. kick $i (REASONS 6)
  128. name_log = (update_list $name_log $i 0) ] ] ]
  129. update_old name_log
  130. if (isgema) [ sleep 0 autogemakickloop ] ]
  131. // changes skin vigorously
  132. changeskin = [
  133. if (curteam) [
  134. myskin = 4; maxskin = 5 ] [ // RVSF / SPECTATOR
  135. myskin = 3; maxskin = 3 ] // CLA
  136. tmpcount = 0
  137. changeskinloop ]
  138. // extension of the changeskin
  139. changeskinloop = [
  140. if (>= $myskin $maxskin) [
  141. myskin = 0 ] [
  142. ++ myskin ]
  143. skin $myskin
  144. ++ tmpcount
  145. if (< $tmpcount 60) [ sleep 60 changeskinloop ] ]
  146. // checks whether the killer has been killing
  147. checkkillername = [
  148. tmpkillername = $arg1
  149. tmpnum = 0
  150. loop i (listlen $killernamelist) [
  151. if (strcmp (at $killernamelist $i) $tmpkillername) [
  152. ++ tmpnum ] ]
  153. if (>= $tmpnum 3) [
  154. tmpkillernamelist = ""
  155. tmplistlen = (listlen $killernamelist)
  156. loop i $tmplistlen [
  157. if (strnot (at $killernamelist $i) $tmpkillername) [
  158. tmpkillernamelist = (concat $tmpkillernamelist (at $killernamelist $i)) ] ]
  159. killernamelist = $tmpkillernamelist
  160. result 1 ] [
  161. killernamelist = (concat $killernamelist $tmpkillername)
  162. result 0 ] ]
  163. // initializes a list and updates the old list
  164. init = [
  165. $arg1 = ""
  166. loop i $MAX_CN [
  167. $arg1 = (concat (getalias $arg1) $arg2) ]
  168. update_old $arg1 ]
  169. // if the client number if connected, return 1; otherwise, return 0
  170. isconnected = [ result (strnot (findpn $arg1)) ]
  171. // if the current map is a gema, return 1; otherwise, return 0
  172. isgema = [
  173. ig = 0
  174. if (&& $agk [ = (curmode) 5 ]) [
  175. loop i (listlen $GEMA_MAPS) [
  176. if (strstr (curmap) (at $GEMA_MAPS $i)) [ ig = 1 ] ] ]
  177. result $ig ]
  178. // updates the connectedcn
  179. update_connectedcn = [
  180. connectedcn = ""
  181. loop i $MAX_CN [
  182. connectedcn = (concat $connectedcn (isconnected $i)) ] ]
  183. // updates the connectedcn and the old_connectedcn
  184. update_connectedcns = [ update_connectedcn; update_old connectedcn ]
  185. // updates the ffdstat and the old_ffdstat
  186. update_ffdstats = [ update_ffdstat; update_old ffdstat ]
  187. // updates the ffdstat
  188. update_ffdstat = [
  189. ffdstat = ""
  190. loop i $MAX_CN [
  191. f = (at (pstat_score $i)) // FLAGS
  192. ff = (concat $f (at (pstat_score $i) 1)) // FLAGS + FRAGS
  193. ffd = (concat $ff (at (pstat_score $i) 2)) // FLAGS + FRAGS + DEATHS
  194. ffdstat = (concat $ffdstat $ffd) ] ]
  195. // updates a list
  196. update_list = [
  197. checkinglist = $arg1
  198. ulcn = $arg2
  199. ulvalue = $arg3
  200. tmplist = ""
  201. loop i $ulcn [
  202. tmplist = (concat $tmplist (at $checkinglist $i)) ]
  203. tmplist = (concat $tmplist $ulvalue)
  204. loop i (- (- $MAX_CN 1) $ulcn) [
  205. tmplist = (concat $tmplist (at $checkinglist (+ (+ $ulcn 1) $i))) ]
  206. result $tmplist ]
  207. // updates the namelist
  208. update_namelist = [
  209. namelist = ""
  210. loop i $MAX_CN [
  211. if (isconnected $i) [
  212. namelist = (concat $namelist (findpn $i)) ] [
  213. namelist = (concat $namelist $EMPTY) ] ] ]
  214. // updates the namelist and the old_namelist
  215. update_namelists = [ update_namelist; update_old namelist ]
  216. // updates the old list
  217. update_old = [ (concatword "old_" $arg1) = (getalias $arg1) ]
  218. // updates the teamlist
  219. update_teamlist = [
  220. teamlist = ""
  221. loop i $MAX_CN [ teamlist = (concat $teamlist (at (pstat_score $i) 4)) ] ]
  222. // updates the teamlist and the old_teamlist
  223. update_teamlists = [ update_teamlist; update_old teamlist ]
  224. // this should be executed immediately after a new map has been loaded
  225. repeat_autogemakick = [
  226. init changeteam_log 0
  227. init gematimes (millis)
  228. init name_log 0
  229. update_ffdstats
  230. update_connectedcns
  231. update_namelists
  232. update_teamlists
  233. autogemakickloop ]
  234. // returns 1 if two strings are not equal; otherise, returns 0
  235. strnot = [ result (! (strcmp $arg1 $arg2)) ]
  236. // adds the repeat_autogemakick in mapstartalways
  237. // equivalent to addcheck_msa [ if $agk [ repeat_autogemakick ] ]
  238. // thanks to V-Man's tools.cfg
  239. if (! (strstr (getalias mapstartalways) "if $agk [ repeat_autogemakick ]")) [
  240. add2alias mapstartalways [ if $agk [ repeat_autogemakick ] ] ]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement