Bukz

AC > 1104 WIP autoexec

Jun 10th, 2011
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 30.26 KB | None | 0 0
  1. // Settings/Aliases/etc.
  2. autoscreenshot 0
  3. crosshairsize 15
  4. flyspeed 2.25
  5. fov 105
  6. fullconsize 90
  7. jpegquality 90
  8. name "DES|Bukz"
  9. nextprimary 5
  10. scopefov 40
  11. screenshottype 1
  12. sensitivity 2.7
  13. showscoresondeath 0
  14. ofc_gamma_list = [215 175 190 165 190 165 165 170 165 180 165 155 175 165 165 195 200 175 165 155 170 205 165 180 175 150 190 180 165]
  15. dyngamma = 1
  16. showstatsondeath = 1
  17.  
  18. // Consts
  19. MAXSNIPERCOMBOMILLIS = 3000 // See "deathData" below.
  20.  
  21. // Binds
  22. bind 5 [if (curmodeattr team) [voicecom yes "No problem, it happens. :)"]]
  23. bind 6 [voicecom yes "Yes! :)"]
  24. bind LEFT [if (&& (curmodeattr team) (curmodeattr flag)) [voicecom cominginwiththeflag "<- left"] [say "%<- left"]]
  25. bind RIGHT [if (&& (curmodeattr team) (curmodeattr flag)) [voicecom cominginwiththeflag "-> right"] [say "%-> right"]]
  26. bind UP [if (&& (curmodeattr team) (curmodeattr flag)) [voicecom cominginwiththeflag mid] [say %mid]]
  27. bind DOWN [if (curmodeattr team) [if (curmodeattr flag) [voicecom recovertheflag "Recover the flag!"] [voicecom coverme "Cover me!"]] [voicecom imattacking "I'm attacking!"]]
  28. bind F [if $editing [solid 1] [sndtoggle]]
  29. bind N [
  30.   if (&& (listlen $deathData) (<= (- (millis) (at $deathData 4)) 7500)) [
  31.     tmpmsg = shot
  32.     if (= (at $deathData 2) 0) [tmpmsg = knife]
  33.     if (= (at $deathData 2) 1) [if (= (player (at $deathData 0) primary) 5) [tmpmsg = combo] [tmpmsg = pistol]]
  34.     if (= (at $deathData 2) 2) [tmpmsg = carbine]
  35.     if (= (at $deathData 2) 3) [if (at $deathData 3) [tmpmsg = "noob cannon"] [tmpmsg = shotgun]]
  36.     if (= (at $deathData 2) 4) [tmpmsg = spam]  // SMG
  37.     if (= (at $deathData 2) 6) [tmpmsg = spray] // AR
  38.     if (= (at $deathData 2) 5) [if (at $deathData 3) [tmpmsg = headshot] [tmpmsg = snipe]]
  39.     if (= (at $deathData 2) 8) [tmpmsg = nade]
  40.     if (= (at $deathData 2) 9) [tmpmsg = akimbo]
  41.     if (= (player (at $deathData 0) team) (player1 team)) [tmpmsg = TK] // Same team = teamkill
  42.     voicecom niceshot (format "Nice %1, %2! %3" $tmpmsg (at $deathData 5) (at $hapemo (rnd (listlen $hapemo)))) // Output: "Nice %s, %s! %s", weapon, name, emoticon
  43.   ] [voicecom niceshot (concat "Nice shot!" (at $hapemo (rnd (listlen $hapemo))))]
  44. ]
  45. bind MOUSE2 [if $editing [domodifier 10] [altaction]]
  46. bind LCTRL [toggleconsole]
  47. megabind E [] [edittoggle] [melee] [melee] [edittoggle]
  48.  
  49. // Scripts
  50.  
  51. // Alias tools.
  52. blanklist = [loop bll (listlen $arg1) [(at $arg1 $bll) = ""]]
  53. resetlist = [loop rll (listlen $arg1) [(at $arg1 $rll) = 0]]
  54. forceinit = [if (! (checkalias $arg1)) [$arg1 = ""]]
  55. initlist  = [if (listlen $arg1) [loop ill (listlen $arg1) [forceinit (at $arg1 $ill)]]]
  56. addcheck  = [forceinit $arg1; if (! (strstr (getalias $arg1) $arg2)) [add2alias $arg1 $arg2]]
  57.  
  58. blanklist "deathData"
  59. resetlist "timestked lastsnipe lasthit"
  60. initlist "mapstartalways onKill onReload start_intermission" // Ensure the initialization of various native aliases.
  61.  
  62. // Misc tools.
  63. forceclosecon = [if (= $conopen 1) [loop i 2 [toggleconsole]] [if (= $conopen 2) [toggleconsole]]]
  64. forcefullcon  = [if (&& (= $conopen 0) $altconsize) [loop i 2 [toggleconsole]] [if (!= $conopen 2) [toggleconsole]]]
  65. forcealtcon   = [if $altconsize [if (= $conopen 0) [toggleconsole] [if (= $conopen 2) [loop i 2 [toggleconsole]]]] [forcefullcon]]
  66.  
  67. // Auto-Sorry
  68. srymsgs = [Sorry sorry Sry sry Soz soz Oops oops "My fault, sorry" "Ahh, sorry" "Accident, sorry"]
  69. hapemo = ":) (: :> <: :3 :D"
  70. sademo = ":( ): :| |: :/ \: :\ /: ._. D: :c :C :s :S"
  71. if (! (checkalias sryslp)) [sryslp = 1500]
  72. spmsg = 0
  73. addcheck onKill [if (&& (curmodeattr team) (|| $connected (curmodeattr bot))) [if (&& (= $arg1 (player1 cn)) (&& (= (player $arg2 team) (player1 team)) (!= $arg1 $arg2))) [if (! $spmsg) [spmsg = 1; sleep $sryslp [voicecom sorry (concatword (at $srymsgs (rnd (listlen $srymsgs))) "! " (at $sademo (rnd (listlen $sademo)))); spmsg = 0] 1]]]]
  74.  
  75. waskill = [if (&& (= $arg1 (player1 cn)) (&& (!= $arg1 $arg2) (!= (player $arg2 team) (player1 team)))) [result 1] [result 0]]
  76.  
  77. // deathData for storing info about your death.
  78. addcheck onKill [if (= $arg2 (player1 cn)) [deathData = (concat $arg1 $arg2 $arg3 $arg4 (millis) (findpn $arg1) (findpn $arg2))]] // You were killed (somehow), store data into "deathData"
  79. addcheck onKill [if (= $arg2 (player1 cn)) [if (&& (= (player $arg1 team) (player1 team)) (!= $arg1 $arg2)) [+= timestked 1; sleep 750 [echo (concatword (c 9) (player (at $deathData 0) name) "'s TKs: " (c 5) (player (at $deathData 0) tks))]]]] // You got TK'd
  80. addcheck onKill [if (= $arg2 (player1 cn)) [if (= $arg1 (player1 cn)) [+= selfgibs 1]]] // Suicides counter
  81. addcheck onKill [if (= $arg2 (player1 cn)) [if (! (listlen $timeBetDeaths)) [timeBetDeaths = (- (millis) $startmillis)] [add2list timeBetDeaths (- (millis) $lastdeath)]]] // Time between deaths list
  82. addcheck onKill [if (= $arg2 (player1 cn)) [lastdeath = (millis)]]
  83. addcheck onKill [if (= $arg2 (player1 cn)) [if (!= $arg1 $arg2) [updatedata deathdata $arg1]]] // Update deaths list
  84. addcheck onKill [if (= $arg2 (player1 cn)) [if $showstatsondeath [updatestats]]]
  85. addcheck onKill []
  86. addcheck onKill [if (waskill $arg1 $arg2) [if (= $arg3 0) [+= slashes 1]]]
  87. addcheck onKill [if (waskill $arg1 $arg2) [if (&& (= $arg3 5) (= $arg4 1)) [+= headshots 1]]]
  88. addcheck onKill [if (waskill $arg1 $arg2) [if (= $arg3 8) [+= gibs 1]]]
  89. addcheck onKill [if (waskill $arg1 $arg2) [if (! (listlen $timeBetKills)) [timeBetKills = (- (millis) $startmillis)] [add2list timeBetKills (- (millis) $lastkill)]]]
  90. addcheck onKill [if (waskill $arg1 $arg2) [if (= $arg3 (player1 primary)) [+= primarykills 1]]] // Primary weapon kills counter
  91. addcheck onKill [if (waskill $arg1 $arg2) [if (|| (= $arg3 1) (= $arg3 9)) [+= secondarykills 1]]] // Secondary weapon(s) kills counter (pistol/akimbo)
  92. addcheck onKill [if (waskill $arg1 $arg2) [if (&& (|| (= $arg3 1) (= $arg3 9)) (&& (= (player1 primary) 5) (<= (- (millis) $lastsnipe) $MAXSNIPERCOMBOMILLIS))) [+= spcombos 1]]] // Sniper/Pistol combo counter
  93. addcheck onKill [if (waskill $arg1 $arg2) [if (&& (= $arg3 0) (&& (= (player1 primary) 5) (<= (- (millis) $lastsnipe) $MAXSNIPERCOMBOMILLIS))) [+= skcombos 1]]] // Sniper/Knife combo counter
  94. addcheck onKill [if (waskill $arg1 $arg2) [if (&& (= $arg3 8) (&& (= (player1 primary) 5) (<= (- (millis) $lastsnipe) $MAXSNIPERCOMBOMILLIS))) [+= sgcombos 1]]] // Sniper/Grenade combo counter
  95. addcheck onKill [if (waskill $arg1 $arg2) [lastkill = (millis); updatedata victimdata $arg2]] // Update victim list
  96.  
  97. // Intermission-time-stats
  98. updatestats = [ // Dump current stats (check start_intermission below)
  99.   forcefullcon
  100.   statsnames = [Flags Frags Deaths Score Ratio Headshots Slashes Gibs Suicides Reloads Teamkills Teamkilled "Average seconds between kills" "Average seconds between deaths" "Most killed enemy" "Killed by the most" "Teamkilled the most" "Sniper/Pistol combos" "Sniper/Knife combos" "Sniper/Grenade combos" "Primary weapon kills" "Secondary weapon kills"]
  101.   lastGameData = (concat (player1 flags) (player1 frags) (player1 deaths) (player1 points) (divf (player1 frags) (player1 deaths)) $headshots $slashes $gibs $selfgibs $reloads (player1 tks) $timestked (divf (listaverage $timeBetKills) 1000) (divf (listaverage $timeBetDeaths) 1000) (format " 2%1 4--- 9(%2) 5" (findhighest $victimdata) (at $victimdata (+ (findlist $victimdata (findhighest $victimdata)) 1))) (format " 2%1 4--- 9(%2) 5" (findhighest $deathdata) (at $deathdata (+ (findlist $deathdata (findhighest $deathdata)) 1))) (format " 2%1 4--- 9(%2) 5" (at (highestTKS) 0) (at (highestTKS) 1)) $spcombos $skcombos $sgcombos $primarykills $secondarykills)
  102.   echo (c 9)----------
  103.   echo (concatword (c 0) (player1 name) "'s") stats for (c 5) (getmode 1) (curmap 1)
  104.   loop usl (listlen $statsnames) [
  105.     // Start continue statements - skip outputting the stat for various reasons
  106.     if (&& (= $usl 0) (|| (! (curmodeattr flags)) (! (player1 flags)))) [continue] // No flags or not flag mode?
  107.     if (&& (= $usl 3) (|| (! $connected) (< (player1 points) 1))) [continue] // No points or not connected?
  108.     if (= $usl 4) [if (checkrange (player1 deaths) 0 1) [echo (c 1)Ratio: (format " 5%1.0" (player1 frags)); continue]] // Less than 2 deaths? ratio = frags
  109.     if (|| (&& (= $usl 5) (! $headshots)) (|| (&& (= $usl 6) (! $slashes)) (&& (= $usl 7) (! $gibs)))) [continue] // No headshots, slashes, or gibs?
  110.     if (&& (= $usl 8) (! $selfgibs)) [continue] // No suicides?
  111.     if (&& (|| (= $usl 10) (= $usl 11)) (! (curmodeattr team))) [continue] // Not teammode?
  112.     if (|| (&& (= $usl 12) (< (player1 frags) 1)) (&& (= $usl 13) (! (player1 deaths)))) [continue] // No kills or deaths? Skip averages
  113.     if (|| (&& (= $usl 14) (strcmp (findhighest $victimdata) N/A)) (|| (&& (= $usl 15) (strcmp (findhighest $deathdata) N/A)) (&& (= $usl 16) (|| (strcmp (highestTKS) N/A) (! (curmodeattr team)))))) [continue] // No kills/deaths? Skip most kills/killed
  114.     if (|| (&& (= $usl 17) (! $spcombos)) (|| (&& (= $usl 18) (! $skcombos)) (&& (= $usl 19) (! $sgcombos)))) [continue] // No sniper/pistol or sniper/knife combos?
  115.     if (|| (&& (= $usl 20) (! $primarykills)) (&& (= $usl 21) (! $secondarykills))) [continue] // No primary or secondary weapon kills?
  116.     // End continue statements
  117.     echo (format " 1%1: 5%2" (at $statsnames $usl) (at $lastGameData $usl))
  118.   ]
  119.   echo (c 9)----------
  120. ]
  121.  
  122. // Returns the element IMMEDIATELY BEFORE the position of, the highest value in a given list.
  123. // For the stats script, this returns the enemy that you killed the most. (e.g. (findhighest $victimdata) // Example output: unarmed)
  124. // Example list: "name1 int1 name2 int2 name3 int3 name4 int4 name5 int5"
  125. findhighest = [
  126.   if (! (listlen $arg1)) [result N/A] [
  127.     curhighest = 1 // First number = current highest
  128.     loop fhl (listlen $arg1) [
  129.       if (|| (! (testlist (at $arg1 $fhl))) (= $fhl 1)) [continue] [ // Skip if the element is not a valid number, or is at position 1 (curhighest has it covered).
  130.         if (>f (at $arg1 $fhl) (at $arg1 $curhighest)) [curhighest = $fhl] // If the next number is higher than the current highest, update curhighest.
  131.       ]
  132.     ]
  133.     -= curhighest 1 // Take one away, we want to return the player's name not the number.
  134.     result (at $arg1 $curhighest)
  135.   ]
  136. ]
  137.  
  138. // Returns a list of clients that have at least 1 teamkill.
  139. findtkclients = [
  140.   if (&& (curplayers) (&& (curmodeattr team) (> $numargs 0))) [
  141.     blanklist "tkclients"
  142.     tmparg1 = $arg1
  143.     loop ftl (curplayers) [
  144.       if (>= (player $ftl tks) $tmparg1) [add2list tkclients (format "%1 %2" (player $ftl name) (player $ftl tks))]
  145.     ]
  146.     if (listlen $tkclients) [result $tkclients] [result N/A]
  147.   ] [result N/A]
  148. ]
  149.  
  150. // Returns the players name that has the current highest amount of teamkills and how many teamkills they have. (e.g. echo (highestTKS) // Example output: unarmed 5)
  151. highestTKS = [
  152.   if (&& (curplayers) (curmodeattr team)) [
  153.     resetlist "curHTK"
  154.     loop htl (curplayers) [
  155.       if (> (player $htl tks) (player $curHTK tks)) [curHTK = $htl]
  156.     ]
  157.     if (> (player $curHTK tks) 0) [result (format "%1 %2" (player $curHTK name) (player $curHTK tks))] [result N/A]
  158.   ] [result N/A]
  159. ]
  160.  
  161. // Returns 1 if there is more than 1 client of the specified name on the server/in the game/etc, else 0.
  162. findDupeName = [
  163.   tmpDNC = 0
  164.   loop fdl (curplayers) [
  165.     if (> $tmpDNC 1) [break] [
  166.       if (strcmp (player $fdl name) $arg1) [+= tmpDNC 1]
  167.     ]
  168.   ]
  169.   if (> $tmpDNC 1) [result 1] [result 0]
  170. ]
  171.  
  172. // Manages the list of enemies you have killed and how many times you have killed them.
  173. updatedata = [
  174.   vicp = (findlist (getalias $arg1) (findpn $arg2))
  175.   if (> $vicp -1) [
  176.     tmpdata = ""
  177.     loop uvl (listlen (getalias $arg1)) [if (= $uvl (+ $vicp 1)) [add2list tmpdata (+ (at (getalias $arg1) $uvl) 1)] [add2list tmpdata (at (getalias $arg1) $uvl)]]
  178.     $arg1 = $tmpdata
  179.   ] [if (! (findDupeName (findpn $arg2))) [add2list $arg1 (concat (findpn $arg2) 1)]] // Don't add clients with duplicate names to the list! The stats would be inaccurate.
  180. ]
  181.  
  182. statshots = [showscores 0; sleep 1 [screenshot]; sleep 2 [showscores 1]; sleep 1000 [screenshot]]
  183.  
  184. // Server admin stuff
  185.  
  186. run pwlist // \:D
  187.  
  188. claimadmin = [
  189.   if (&& $connected (! (currole))) [
  190.     if (> (listlen $pwlist) 0) [
  191.       app = (findlist $pwlist (curserver 1))
  192.       if (!= $app -1) [
  193.         echo (c 0)Claiming admin for server (c 2) (at $pwlist $app) // (c 0)using password (c 2) (at $pwlist (+ $app 1))
  194.         setadmin 1 (at $pwlist (+ $app 1))
  195.       ] [
  196.         app = (findlist $pwlist (format "%1:%2" (curserver 1) (curserver 3)))
  197.         if (!= $app -1) [
  198.           echo (c 0)Claiming admin for server (c 2) (at $pwlist $app) // (c 0)using password (c 2) (at $pwlist (+ $app 1))
  199.           setadmin 1 (at $pwlist (+ $app 1))
  200.         ] [
  201.           tmp_hostname = (curserver 2)
  202.           app = (findlist $pwlist $tmp_hostname)
  203.           if (!= $app -1) [
  204.             echo (c 0)Claiming admin for server (c 2) (at $pwlist $app) // (c 0)using password (c 2) (at $pwlist (+ $app 1))
  205.             setadmin 1 (at $pwlist (+ $app 1))
  206.           ] [
  207.             app = (findlist $pwlist (format "%1:%2" $tmp_hostname (curserver 3)))
  208.             if (!= $app -1) [
  209.               echo (c 0)Claiming admin for server (c 2) (at $pwlist $app) // (c 0)using password (c 2) (at $pwlist (+ $app 1))
  210.               setadmin 1 (at $pwlist (+ $app 1))
  211.             ] [echo (c 3)Cannot find an admin password for this server in your configuration!]
  212.           ]
  213.         ]
  214.       ]
  215.     ] [echo (c 3)Your admin passwords list is empty!]
  216.   ] [setadmin 0]
  217. ]
  218.  
  219. aban = [
  220.   if $connected [
  221.     tmpvictim = $arg1
  222.     if (> $numargs 1) [tmpreason = $arg2]
  223.     if (! (currole)) claimadmin
  224.     whois $tmpvictim
  225.     sleep 250 screenshot
  226.     sleep 750 [if (> $numargs 1) [ban $tmpvictim $tmpreason] [ban $tmpvictim admin]]
  227.     sleep 1500 claimadmin
  228.   ]
  229. ]
  230.  
  231. akick = [
  232.   if $connected [
  233.     tmpvictim = $arg1
  234.     if (> $numargs 1) [tmpreason = $arg2]
  235.     if (! (currole)) claimadmin
  236.     whois $tmpvictim
  237.     sleep 250 [if (> $numargs 1) [kick $tmpvictim $tmpreason] [kick $tmpvictim admin]]
  238.     sleep 1000 claimadmin
  239.   ]
  240. ]
  241.  
  242. aforce = [
  243.   if $connected [
  244.     tmpvictim = $arg1
  245.     if (> $numargs 1) [say (format "Reason: %1" $arg2)]
  246.     if (! (currole)) claimadmin
  247.     sleep 250 [forceteam $tmpvictim]
  248.     sleep 1000 claimadmin
  249.   ]
  250. ]
  251.  
  252. af = [aforce $arg1 "Setting Teams"]
  253.  
  254. // Mapstartalways
  255. addcheck mapstartalways [startmillis = (millis); accuracy 0; accuracyreset; forceclosecon]
  256. addcheck mapstartalways [blanklist "deathData timeBetDeaths timeBetKills victimdata deathdata oldpstat_weaps"]
  257. addcheck mapstartalways [resetlist "timestked gibs headshots lastkill lastdeath reloads slashes lastsnipe spcombos skcombos sgcombos primarykills secondarykills selfgibs"]
  258.  
  259. // How many times you reloaded counter.
  260. addcheck onReload [+= reloads 1]
  261.  
  262. // Start intermission
  263. addcheck start_intermission [accuracy 1; updatestats; statshots]
  264.  
  265. // MOUSE1
  266. add2bind MOUSE1 [if (&& (= (curweapon) 5) (magcontent 5)) [lastsnipe = (millis)]]
  267.  
  268. addListOnQuit "skcombos selfgibs headshots lastdeath primarykills gibs sgcombos slashes secondarykills timestked reloads spcombos lastkill lastsnipe startmillis statsnames app tkclients tmparg1 curHTK curhighest lastGameData tmpvictim tmpDNC vicp tmpdata victimdata deathdata deathData "// Settings/Aliases/etc.
  269. autoscreenshot 0
  270. crosshairsize 15
  271. flyspeed 2.25
  272. fov 105
  273. fullconsize 90
  274. jpegquality 90
  275. name "DES|Bukz"
  276. nextprimary 5
  277. scopefov 40
  278. screenshottype 1
  279. sensitivity 2.7
  280. showscoresondeath 0
  281. ofc_gamma_list = [215 175 190 165 190 165 165 170 165 180 165 155 175 165 165 195 200 175 165 155 170 205 165 180 175 150 190 180 165]
  282. dyngamma = 1
  283. showstatsondeath = 1
  284.  
  285. // Consts
  286. MAXSNIPERCOMBOMILLIS = 3000 // See "deathData" below.
  287.  
  288. // Binds
  289. bind 5 [if (curmodeattr team) [voicecom yes "No problem, it happens. :)"]]
  290. bind 6 [voicecom yes "Yes! :)"]
  291. bind LEFT [if (&& (curmodeattr team) (curmodeattr flag)) [voicecom cominginwiththeflag "<- left"] [say "%<- left"]]
  292. bind RIGHT [if (&& (curmodeattr team) (curmodeattr flag)) [voicecom cominginwiththeflag "-> right"] [say "%-> right"]]
  293. bind UP [if (&& (curmodeattr team) (curmodeattr flag)) [voicecom cominginwiththeflag mid] [say %mid]]
  294. bind DOWN [if (curmodeattr team) [if (curmodeattr flag) [voicecom recovertheflag "Recover the flag!"] [voicecom coverme "Cover me!"]] [voicecom imattacking "I'm attacking!"]]
  295. bind F [if $editing [solid 1] [sndtoggle]]
  296. bind N [
  297.   if (&& (listlen $deathData) (<= (- (millis) (at $deathData 4)) 7500)) [
  298.     tmpmsg = shot
  299.     if (= (at $deathData 2) 0) [tmpmsg = knife]
  300.     if (= (at $deathData 2) 1) [if (= (player (at $deathData 0) primary) 5) [tmpmsg = combo] [tmpmsg = pistol]]
  301.     if (= (at $deathData 2) 2) [tmpmsg = carbine]
  302.     if (= (at $deathData 2) 3) [if (at $deathData 3) [tmpmsg = "noob cannon"] [tmpmsg = shotgun]]
  303.     if (= (at $deathData 2) 4) [tmpmsg = spam]  // SMG
  304.     if (= (at $deathData 2) 6) [tmpmsg = spray] // AR
  305.     if (= (at $deathData 2) 5) [if (at $deathData 3) [tmpmsg = headshot] [tmpmsg = snipe]]
  306.     if (= (at $deathData 2) 8) [tmpmsg = nade]
  307.     if (= (at $deathData 2) 9) [tmpmsg = akimbo]
  308.     if (= (player (at $deathData 0) team) (player1 team)) [tmpmsg = TK] // Same team = teamkill
  309.     voicecom niceshot (format "Nice %1, %2! %3" $tmpmsg (at $deathData 5) (at $hapemo (rnd (listlen $hapemo)))) // Output: "Nice %s, %s! %s", weapon, name, emoticon
  310.   ] [voicecom niceshot (concat "Nice shot!" (at $hapemo (rnd (listlen $hapemo))))]
  311. ]
  312. bind MOUSE2 [if $editing [domodifier 10] [altaction]]
  313. bind LCTRL [toggleconsole]
  314. megabind E [] [edittoggle] [melee] [melee] [edittoggle]
  315.  
  316. // Scripts
  317.  
  318. // Alias tools.
  319. blanklist = [loop bll (listlen $arg1) [(at $arg1 $bll) = ""]]
  320. resetlist = [loop rll (listlen $arg1) [(at $arg1 $rll) = 0]]
  321. forceinit = [if (! (checkalias $arg1)) [$arg1 = ""]]
  322. initlist  = [if (listlen $arg1) [loop ill (listlen $arg1) [forceinit (at $arg1 $ill)]]]
  323. addcheck  = [forceinit $arg1; if (! (strstr (getalias $arg1) $arg2)) [add2alias $arg1 $arg2]]
  324.  
  325. blanklist "deathData"
  326. resetlist "timestked lastsnipe lasthit"
  327. initlist "mapstartalways onKill onReload start_intermission" // Ensure the initialization of various native aliases.
  328.  
  329. // Misc tools.
  330. forceclosecon = [if (= $conopen 1) [loop i 2 [toggleconsole]] [if (= $conopen 2) [toggleconsole]]]
  331. forcefullcon  = [if (&& (= $conopen 0) $altconsize) [loop i 2 [toggleconsole]] [if (!= $conopen 2) [toggleconsole]]]
  332. forcealtcon   = [if $altconsize [if (= $conopen 0) [toggleconsole] [if (= $conopen 2) [loop i 2 [toggleconsole]]]] [forcefullcon]]
  333.  
  334. // Auto-Sorry
  335. srymsgs = [Sorry sorry Sry sry Soz soz Oops oops "My fault, sorry" "Ahh, sorry" "Accident, sorry"]
  336. hapemo = ":) (: :> <: :3 :D"
  337. sademo = ":( ): :| |: :/ \: :\ /: ._. D: :c :C :s :S"
  338. if (! (checkalias sryslp)) [sryslp = 1500]
  339. spmsg = 0
  340. addcheck onKill [if (&& (curmodeattr team) (|| $connected (curmodeattr bot))) [if (&& (= $arg1 (player1 cn)) (&& (= (player $arg2 team) (player1 team)) (!= $arg1 $arg2))) [if (! $spmsg) [spmsg = 1; sleep $sryslp [voicecom sorry (concatword (at $srymsgs (rnd (listlen $srymsgs))) "! " (at $sademo (rnd (listlen $sademo)))); spmsg = 0] 1]]]]
  341.  
  342. waskill = [if (&& (= $arg1 (player1 cn)) (&& (!= $arg1 $arg2) (!= (player $arg2 team) (player1 team)))) [result 1] [result 0]]
  343.  
  344. // deathData for storing info about your death.
  345. addcheck onKill [if (= $arg2 (player1 cn)) [deathData = (concat $arg1 $arg2 $arg3 $arg4 (millis) (findpn $arg1) (findpn $arg2))]] // You were killed (somehow), store data into "deathData"
  346. addcheck onKill [if (= $arg2 (player1 cn)) [if (&& (= (player $arg1 team) (player1 team)) (!= $arg1 $arg2)) [+= timestked 1; sleep 750 [echo (concatword (c 9) (player (at $deathData 0) name) "'s TKs: " (c 5) (player (at $deathData 0) tks))]]]] // You got TK'd
  347. addcheck onKill [if (= $arg2 (player1 cn)) [if (= $arg1 (player1 cn)) [+= selfgibs 1]]] // Suicides counter
  348. addcheck onKill [if (= $arg2 (player1 cn)) [if (! (listlen $timeBetDeaths)) [timeBetDeaths = (- (millis) $startmillis)] [add2list timeBetDeaths (- (millis) $lastdeath)]]] // Time between deaths list
  349. addcheck onKill [if (= $arg2 (player1 cn)) [lastdeath = (millis)]]
  350. addcheck onKill [if (= $arg2 (player1 cn)) [if (!= $arg1 $arg2) [updatedata deathdata $arg1]]] // Update deaths list
  351. addcheck onKill [if (= $arg2 (player1 cn)) [if $showstatsondeath [updatestats]]]
  352. addcheck onKill [if (waskill $arg1 $arg2) [if (= $arg3 0) [+= slashes 1]]]
  353. addcheck onKill [if (waskill $arg1 $arg2) [if (&& (= $arg3 5) (= $arg4 1)) [+= headshots 1]]]
  354. addcheck onKill [if (waskill $arg1 $arg2) [if (= $arg3 8) [+= gibs 1]]]
  355. addcheck onKill [if (waskill $arg1 $arg2) [if (! (listlen $timeBetKills)) [timeBetKills = (- (millis) $startmillis)] [add2list timeBetKills (- (millis) $lastkill)]]]
  356. addcheck onKill [if (waskill $arg1 $arg2) [if (= $arg3 (player1 primary)) [+= primarykills 1]]] // Primary weapon kills counter
  357. addcheck onKill [if (waskill $arg1 $arg2) [if (|| (= $arg3 1) (= $arg3 9)) [+= secondarykills 1]]] // Secondary weapon(s) kills counter (pistol/akimbo)
  358. addcheck onKill [if (waskill $arg1 $arg2) [if (&& (|| (= $arg3 1) (= $arg3 9)) (&& (= (player1 primary) 5) (<= (- (millis) $lastsnipe) $MAXSNIPERCOMBOMILLIS))) [+= spcombos 1]]] // Sniper/Pistol combo counter
  359. addcheck onKill [if (waskill $arg1 $arg2) [if (&& (= $arg3 0) (&& (= (player1 primary) 5) (<= (- (millis) $lastsnipe) $MAXSNIPERCOMBOMILLIS))) [+= skcombos 1]]] // Sniper/Knife combo counter
  360. addcheck onKill [if (waskill $arg1 $arg2) [if (&& (= $arg3 8) (&& (= (player1 primary) 5) (<= (- (millis) $lastsnipe) $MAXSNIPERCOMBOMILLIS))) [+= sgcombos 1]]] // Sniper/Grenade combo counter
  361. addcheck onKill [if (waskill $arg1 $arg2) [lastkill = (millis); updatedata victimdata $arg2]] // Update victim list
  362.  
  363. // Intermission-time-stats
  364. updatestats = [ // Dump current stats (check start_intermission below)
  365.   forcefullcon
  366.   statsnames = [Flags Frags Deaths Score Ratio Headshots Slashes Gibs Suicides Reloads Teamkills Teamkilled "Average seconds between kills" "Average seconds between deaths" "Most killed enemy" "Killed by the most" "Teamkilled the most" "Sniper/Pistol combos" "Sniper/Knife combos" "Sniper/Grenade combos" "Primary weapon kills" "Secondary weapon kills"]
  367.   lastGameData = (concat (player1 flags) (player1 frags) (player1 deaths) (player1 points) (divf (player1 frags) (player1 deaths)) $headshots $slashes $gibs $selfgibs $reloads (player1 tks) $timestked (divf (listaverage $timeBetKills) 1000) (divf (listaverage $timeBetDeaths) 1000) (format " 2%1 4--- 9(%2) 5" (findhighest $victimdata) (at $victimdata (+ (findlist $victimdata (findhighest $victimdata)) 1))) (format " 2%1 4--- 9(%2) 5" (findhighest $deathdata) (at $deathdata (+ (findlist $deathdata (findhighest $deathdata)) 1))) (format " 2%1 4--- 9(%2) 5" (at (highestTKS) 0) (at (highestTKS) 1)) $spcombos $skcombos $sgcombos $primarykills $secondarykills)
  368.   echo (c 9)----------
  369.   echo (concatword (c 0) (player1 name) "'s") stats for (c 5) (getmode 1) (curmap 1)
  370.   loop usl (listlen $statsnames) [
  371.     // Start continue statements - skip outputting the stat for various reasons
  372.     if (&& (= $usl 0) (|| (! (curmodeattr flags)) (! (player1 flags)))) [continue] // No flags or not flag mode?
  373.     if (&& (= $usl 3) (|| (! $connected) (< (player1 points) 1))) [continue] // No points or not connected?
  374.     if (= $usl 4) [if (checkrange (player1 deaths) 0 1) [echo (c 1)Ratio: (format " 5%1.0" (player1 frags)); continue]] // Less than 2 deaths? ratio = frags
  375.     if (|| (&& (= $usl 5) (! $headshots)) (|| (&& (= $usl 6) (! $slashes)) (&& (= $usl 7) (! $gibs)))) [continue] // No headshots, slashes, or gibs?
  376.     if (&& (= $usl 8) (! $selfgibs)) [continue] // No suicides?
  377.     if (&& (|| (= $usl 10) (= $usl 11)) (! (curmodeattr team))) [continue] // Not teammode?
  378.     if (|| (&& (= $usl 12) (< (player1 frags) 1)) (&& (= $usl 13) (! (player1 deaths)))) [continue] // No kills or deaths? Skip averages
  379.     if (|| (&& (= $usl 14) (strcmp (findhighest $victimdata) N/A)) (|| (&& (= $usl 15) (strcmp (findhighest $deathdata) N/A)) (&& (= $usl 16) (|| (strcmp (highestTKS) N/A) (! (curmodeattr team)))))) [continue] // No kills/deaths? Skip most kills/killed
  380.     if (|| (&& (= $usl 17) (! $spcombos)) (|| (&& (= $usl 18) (! $skcombos)) (&& (= $usl 19) (! $sgcombos)))) [continue] // No sniper/pistol or sniper/knife combos?
  381.     if (|| (&& (= $usl 20) (! $primarykills)) (&& (= $usl 21) (! $secondarykills))) [continue] // No primary or secondary weapon kills?
  382.     // End continue statements
  383.     echo (format " 1%1: 5%2" (at $statsnames $usl) (at $lastGameData $usl))
  384.   ]
  385.   echo (c 9)----------
  386. ]
  387.  
  388. // Returns the element IMMEDIATELY BEFORE the position of, the highest value in a given list.
  389. // For the stats script, this returns the enemy that you killed the most. (e.g. (findhighest $victimdata) // Example output: unarmed)
  390. // Example list: "name1 int1 name2 int2 name3 int3 name4 int4 name5 int5"
  391. findhighest = [
  392.   if (! (listlen $arg1)) [result N/A] [
  393.     curhighest = 1 // First number = current highest
  394.     loop fhl (listlen $arg1) [
  395.       if (|| (! (testlist (at $arg1 $fhl))) (= $fhl 1)) [continue] [ // Skip if the element is not a valid number, or is at position 1 (curhighest has it covered).
  396.         if (>f (at $arg1 $fhl) (at $arg1 $curhighest)) [curhighest = $fhl] // If the next number is higher than the current highest, update curhighest.
  397.       ]
  398.     ]
  399.     -= curhighest 1 // Take one away, we want to return the player's name not the number.
  400.     result (at $arg1 $curhighest)
  401.   ]
  402. ]
  403.  
  404. // Returns a list of clients that have at least 1 teamkill.
  405. findtkclients = [
  406.   if (&& (curplayers) (&& (curmodeattr team) (> $numargs 0))) [
  407.     blanklist "tkclients"
  408.     tmparg1 = $arg1
  409.     loop ftl (curplayers) [
  410.       if (>= (player $ftl tks) $tmparg1) [add2list tkclients (format "%1 %2" (player $ftl name) (player $ftl tks))]
  411.     ]
  412.     if (listlen $tkclients) [result $tkclients] [result N/A]
  413.   ] [result N/A]
  414. ]
  415.  
  416. // Returns the players name that has the current highest amount of teamkills and how many teamkills they have. (e.g. echo (highestTKS) // Example output: unarmed 5)
  417. highestTKS = [
  418.   if (&& (curplayers) (curmodeattr team)) [
  419.     resetlist "curHTK"
  420.     loop htl (curplayers) [
  421.       if (> (player $htl tks) (player $curHTK tks)) [curHTK = $htl]
  422.     ]
  423.     if (> (player $curHTK tks) 0) [result (format "%1 %2" (player $curHTK name) (player $curHTK tks))] [result N/A]
  424.   ] [result N/A]
  425. ]
  426.  
  427. // Returns 1 if there is more than 1 client of the specified name on the server/in the game/etc, else 0.
  428. findDupeName = [
  429.   tmpDNC = 0
  430.   loop fdl (curplayers) [
  431.     if (> $tmpDNC 1) [break] [
  432.       if (strcmp (player $fdl name) $arg1) [+= tmpDNC 1]
  433.     ]
  434.   ]
  435.   if (> $tmpDNC 1) [result 1] [result 0]
  436. ]
  437.  
  438. // Manages the list of enemies you have killed and how many times you have killed them.
  439. updatedata = [
  440.   vicp = (findlist (getalias $arg1) (findpn $arg2))
  441.   if (> $vicp -1) [
  442.     tmpdata = ""
  443.     loop uvl (listlen (getalias $arg1)) [if (= $uvl (+ $vicp 1)) [add2list tmpdata (+ (at (getalias $arg1) $uvl) 1)] [add2list tmpdata (at (getalias $arg1) $uvl)]]
  444.     $arg1 = $tmpdata
  445.   ] [if (! (findDupeName (findpn $arg2))) [add2list $arg1 (concat (findpn $arg2) 1)]] // Don't add clients with duplicate names to the list! The stats would be inaccurate.
  446. ]
  447.  
  448. statshots = [showscores 0; sleep 1 [screenshot]; sleep 2 [showscores 1]; sleep 1000 [screenshot]]
  449.  
  450. // Server admin stuff
  451.  
  452. run pwlist // \:D
  453.  
  454. claimadmin = [
  455.   if (&& $connected (! (currole))) [
  456.     if (> (listlen $pwlist) 0) [
  457.       app = (findlist $pwlist (curserver 1))
  458.       if (!= $app -1) [
  459.         echo (c 0)Claiming admin for server (c 2) (at $pwlist $app) // (c 0)using password (c 2) (at $pwlist (+ $app 1))
  460.         setadmin 1 (at $pwlist (+ $app 1))
  461.       ] [
  462.         app = (findlist $pwlist (format "%1:%2" (curserver 1) (curserver 3)))
  463.         if (!= $app -1) [
  464.           echo (c 0)Claiming admin for server (c 2) (at $pwlist $app) // (c 0)using password (c 2) (at $pwlist (+ $app 1))
  465.           setadmin 1 (at $pwlist (+ $app 1))
  466.         ] [
  467.           tmp_hostname = (curserver 2)
  468.           app = (findlist $pwlist $tmp_hostname)
  469.           if (!= $app -1) [
  470.             echo (c 0)Claiming admin for server (c 2) (at $pwlist $app) // (c 0)using password (c 2) (at $pwlist (+ $app 1))
  471.             setadmin 1 (at $pwlist (+ $app 1))
  472.           ] [
  473.             app = (findlist $pwlist (format "%1:%2" $tmp_hostname (curserver 3)))
  474.             if (!= $app -1) [
  475.               echo (c 0)Claiming admin for server (c 2) (at $pwlist $app) // (c 0)using password (c 2) (at $pwlist (+ $app 1))
  476.               setadmin 1 (at $pwlist (+ $app 1))
  477.             ] [echo (c 3)Cannot find an admin password for this server in your configuration!]
  478.           ]
  479.         ]
  480.       ]
  481.     ] [echo (c 3)Your admin passwords list is empty!]
  482.   ] [setadmin 0]
  483. ]
  484.  
  485. aban = [
  486.   if $connected [
  487.     tmpvictim = $arg1
  488.     if (> $numargs 1) [tmpreason = $arg2]
  489.     if (! (currole)) claimadmin
  490.     whois $tmpvictim
  491.     sleep 250 screenshot
  492.     sleep 750 [if (> $numargs 1) [ban $tmpvictim $tmpreason] [ban $tmpvictim admin]]
  493.     sleep 1500 claimadmin
  494.   ]
  495. ]
  496.  
  497. akick = [
  498.   if $connected [
  499.     tmpvictim = $arg1
  500.     if (> $numargs 1) [tmpreason = $arg2]
  501.     if (! (currole)) claimadmin
  502.     whois $tmpvictim
  503.     sleep 250 [if (> $numargs 1) [kick $tmpvictim $tmpreason] [kick $tmpvictim admin]]
  504.     sleep 1000 claimadmin
  505.   ]
  506. ]
  507.  
  508. aforce = [
  509.   if $connected [
  510.     tmpvictim = $arg1
  511.     if (> $numargs 1) [say (format "Reason: %1" $arg2)]
  512.     if (! (currole)) claimadmin
  513.     sleep 250 [forceteam $tmpvictim]
  514.     sleep 1000 claimadmin
  515.   ]
  516. ]
  517.  
  518. af = [aforce $arg1 "Setting Teams"]
  519.  
  520. // Mapstartalways
  521. addcheck mapstartalways [startmillis = (millis); accuracy 0; accuracyreset; forceclosecon]
  522. addcheck mapstartalways [blanklist "deathData timeBetDeaths timeBetKills victimdata deathdata oldpstat_weaps"]
  523. addcheck mapstartalways [resetlist "timestked gibs headshots lastkill lastdeath reloads slashes lastsnipe spcombos skcombos sgcombos primarykills secondarykills selfgibs"]
  524.  
  525. // How many times you reloaded counter.
  526. addcheck onReload [+= reloads 1]
  527.  
  528. // Start intermission
  529. addcheck start_intermission [accuracy 1; updatestats; statshots]
  530.  
  531. // MOUSE1
  532. add2bind MOUSE1 [if (&& (= (curweapon) 5) (magcontent 5)) [lastsnipe = (millis)]]
  533.  
  534. addListOnQuit "skcombos selfgibs headshots lastdeath primarykills gibs sgcombos slashes secondarykills timestked reloads spcombos lastkill lastsnipe startmillis statsnames app tkclients tmparg1 curHTK curhighest lastGameData tmpvictim tmpDNC vicp tmpdata victimdata deathdata deathData "
Advertisement
Add Comment
Please, Sign In to add comment