Advertisement
Guest User

Untitled

a guest
Jun 26th, 2017
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. if (checkalias atfrags) [] [ // Make stats collecting aliases if they do not already exist.
  2.     curflags = 0
  3.     atflags = 0
  4.     curfrags = 0
  5.     atfrags = 0
  6.     curdeaths = 0
  7.     atdeaths = 0
  8.     curscore = 0
  9.     atscore = 0
  10.     curratio = 0
  11.     atratio = 0
  12.     cursniper = 0
  13.     cursniperdmg = 0
  14.     cursmg = 0
  15.     cursmgdmg = 0
  16.     curshot = 0
  17.     curshotdmg = 0
  18.     curar = 0
  19.     curardmg = 0
  20.     curcarb = 0
  21.     curcarbdmg = 0
  22.     curusp = 0
  23.     curuspdmg = 0
  24.     curaki = 0
  25.     curakidmg = 0
  26.     curknife = 0
  27.     curknifedmg = 0
  28.     clast = 0
  29.     rvsfst = 0
  30.     games_played = 0
  31.     tkst = 0
  32.     htkst = 0
  33.     stkst = 0
  34.     gtkst = 0
  35.     ktkst = 0
  36.     ftkst = 0
  37.     hsst = 0
  38.     knst = 0
  39.     spst = 0
  40.     gbst = 0
  41.     cfst = 0
  42.     dfst = 0
  43.     lfst = 0
  44.     kfst = 0
  45.     sfst = 0
  46.     suicides = 0
  47. ]
  48.  
  49. addcheck_si [+= games_played 1]
  50.  
  51. calc = [ // Function used for gathering and calculating stats
  52.     curflags = (at (pstat_score (findcn $curname)) 0)
  53.     curfrags = (at (pstat_score (findcn $curname)) 1)
  54.     curdeaths = (at (pstat_score (findcn $curname)) 2)
  55.     curscore = (at (pstat_score (findcn $curname)) 3)
  56.     cursniper = (at (pstat_weap (findcn $curname)) 10)
  57.     cursniperdmg = (at (pstat_weap (findcn $curname)) 11)
  58.     cursmg = (at (pstat_weap (findcn $curname)) 8)
  59.     cursmgdmg = (at (pstat_weap (findcn $curname)) 9)
  60.     curar = (at (pstat_weap (findcn $curname)) 12)
  61.     curardmg = (at (pstat_weap (findcn $curname)) 13)
  62.     curshot = (at (pstat_weap (findcn $curname)) 6)
  63.     curshotdmg = (at (pstat_weap (findcn $curname)) 7)
  64.     curcarb = (at (pstat_weap (findcn $curname)) 4)
  65.     curcarbdmg = (at (pstat_weap (findcn $curname)) 5)
  66.     curusp = (at (pstat_weap (findcn $curname)) 2)
  67.     curuspdmg = (at (pstat_weap (findcn $curname)) 3)
  68.     curaki = (at (pstat_weap (findcn $curname)) 18)
  69.     curakidmg = (at (pstat_weap (findcn $curname)) 19)
  70.     curnade = (at (pstat_weap (findcn $curname)) 16)
  71.     curnadedmg = (at (pstat_weap (findcn $curname)) 17)
  72.     curknife = (at (pstat_weap (findcn $curname)) 0)
  73.     curknifedmg = (at (pstat_weap (findcn $curname)) 1)
  74.     curratio = (divf $curfrags $curdeaths)
  75.         // if (&& (<= $minutesremaining 0) (= $strst 0)) [ // Add current score to all-time totals during intermission.
  76.         += atfrags $curfrags                        // TODO: Make it possible to add to these for on-the-fly all-time stats viewing.
  77.         += atdeaths $curdeaths
  78.         += atscore $curscore
  79.         += atflags $curflags
  80.         atscoreavg = (divf $curscore $games_played)
  81.         atratio = (divf $atfrags $atdeaths)
  82.     if (= (curmodeattr team) 1) [ // Check if user is in a team mode.
  83.         if (= (curteam) 1) [ // If playing for RVSF, +1 to it's stat.
  84.             += rvsfst 1
  85. // Did I tell you, team info is kept in pstat_score? ; Seen that, wasn't sure how to use it correctly since it was returning 0 even while in DM. :-s
  86.         ] [
  87.             += clast 1 // Else they are playing for CLA, +1 to it's stat.
  88.         ]] []
  89.     strst = 1 // In case if this function is called more than once during the intermission, mark this as 1 so the above if statement fails.
  90.         // ] []
  91.     if (= $gamemode 0) [
  92.         modest = "TDM"
  93.     ] [
  94.     if (= $gamemode 2) [
  95.         modest = "DM"
  96.     ] [
  97.     if (= $gamemode 4) [
  98.         modest = "TSURV"
  99.     ] [
  100.     if (= $gamemode 3) [
  101.         modest = "SURV"
  102.     ] [
  103.     if (= $gamemode 5) [
  104.         modest = "CTF"
  105.     ] [
  106.     if (= $gamemode 13) [
  107.         modest = "HTF"
  108.     ] [
  109.     if (= $gamemode 15) [
  110.         modest = "KTF"
  111.     ] [
  112.     if (= $gamemode 14) [
  113.         modest = "TKTF"
  114.     ] [
  115.     if (= $gamemode 6) [
  116.         modest = "PF"
  117.     ] [
  118.     if (= $gamemode 9) [
  119.         modest = "LSS"
  120.     ] [
  121.     if (= $gamemode 10) [
  122.         modest = "OSOK"
  123.     ] [
  124.     if (= $gamemode 11) [
  125.         modest = "TOSOK"
  126.     ] [
  127.     if (= $gamemode 7) [
  128.         modest = "BTDM"
  129.     ] [
  130.     if (= $gamemode 8) [
  131.         modest = "BDM"
  132.     ] [
  133.     if (= $gamemode 12) [
  134.         modest = "BOSOK"
  135.     ] [
  136.     if (= $gamemode 1) [
  137.         modest = "COOP"
  138.     ] []]]]]]]]]]]]]]]]
  139. ]
  140.  
  141. clrst = [ // Function used to clear temporary script flow aliases on every map start.
  142.     strst = 0
  143.     hsst = 0
  144.     knst = 0
  145.     spst = 0
  146.     gbst = 0
  147.     cfst = 0
  148.     dfst = 0
  149.     lfst = 0
  150.     kfst = 0
  151.     sfst = 0
  152.     tkst = 0
  153.     htkst = 0
  154.     ktkst = 0
  155.     ftkst = 0
  156.     gtkst = 0
  157.     stkst = 0
  158.     cvflag = 0
  159.     dfflag = 0
  160.     suicides = 0
  161.     combo = 0
  162.     mcombo = 0
  163. ]
  164.  
  165. stats = [
  166.     calc // Gather and calculate the stats.
  167.     ocsize = $consize
  168.         if (strcmp $arg1 "all") [ // If user entered "all" as the first argument display the all-time stats instead.
  169.             echo ""
  170.             echo All-Time Frags: $atfrags
  171.             echo All-Time Deaths: $atdeaths
  172.             echo All-Time Score: $atscore
  173.         if (< $atdeaths 2) [ // Ratio = # of kills until >= the 2nd death.
  174.             echo All-Time Ratio: (concatword $atfrags .0)
  175.         ] [
  176.             echo All-Time Ratio: $atratio
  177.         ]
  178.             echo CLA: $clast
  179.             echo RVSF: $rvsfst
  180.         ] [ // Else show user the current round stats.
  181.             consize 24
  182.             echo ""
  183.             echo Flags: $curflags
  184.             echo Frags: $curfrags
  185.             echo Deaths: $curdeaths
  186.         if (= $connected 1) [ // Score is only calculated in multiplayer.
  187.             echo Score: $curscore
  188.         ] [
  189.             echo Score: N/A
  190.         ]
  191.         if (< $curdeaths 2) [ // Ratio = # of kills until >= the 2nd death.
  192.             echo Ratio: (concatword $curfrags .0)
  193.         ] [
  194.             echo Ratio: $curratio
  195.         ]
  196.             echo FTK's: $ftkst
  197.             echo HTK's: $htkst
  198.             echo STK's: $htkst
  199.             echo KTK's: $ktkst
  200.             echo GTK's: $gtkst
  201.             echo Total TK's: $tkst
  202.             echo ""
  203.         if (= $connected 1) [ // Weapon damage is only shown in multiplayer, for some reason. :(
  204.             echo Sniper: (concatword $cursniper / $cursniperdmg)
  205.             echo SMG: (concatword $cursmg / $cursmgdmg)
  206.             echo AR: (concatword $curar / $curardmg)
  207.             echo Shotgun: (concatword $curshot / $curshotdmg)
  208.             echo Carbine: (concatword $curcarb / $curcarbdmg)
  209.             echo Pistol: (concatword $curusp / $curuspdmg)
  210.             echo Akimbo: (concatword $curaki / $curakidmg)
  211.             echo Grenade: (concatword $curnade / $curnadedmg)
  212.             echo Knife: (concatword $curknife / $curknifedmg)
  213.             echo ""
  214.             echo Weapon stats are currently shots/damage.
  215.         ] [
  216.             echo Sniper: $cursniper
  217.             echo SMG: $cursmg
  218.             echo AR: $curar
  219.             echo Shotgun: $curshot
  220.             echo Carbine: $curcarb
  221.             echo Pistol: $curusp
  222.             echo Akimbo: $curaki
  223.             echo Grenade: $curnade
  224.             echo Knife: $curknife
  225.             echo ""
  226.             echo Weapon stats for SP are currently # of shots fired.
  227.     sleep 10000 [consize $ocsize]
  228. ]]]
  229.  
  230. get_stats = [ // Function used for gathering stats that pstat_score cannot access.
  231.     if (= (strstr $conline " 3you fragged teammate") 1) [
  232.         += tkst 1; += ftkst 1; conline [  ]
  233.     ] [
  234.     if (= (strstr $conline " 3you headshotted teammate") 1) [
  235.         += tkst 1; += htkst 1; conline [  ]
  236.     ] [
  237.     if (= (strstr $conline " 3you splattered teammate") 1) [
  238.         += tkst 1; += stkst 1; conline [  ]
  239.     ] [
  240.     if (= (strstr $conline " 3you knifed teammate") 1) [
  241.         += tkst 1; += ktkst 1; conline [  ]
  242.     ] [
  243.     if (= (strstr $conline " 3you gibbed teammate") 1) [
  244.         += tkst 1; += gtkst 1; conline [  ]
  245.     ] [
  246.     if (&& (= (strstr $conline "you headshotted") 1) (= (strstr $conline " 3teammate") 0)) [
  247.         += hsst 1; conline [  ]
  248.     ] [
  249.     if (&& (= (strstr $conline "you knifed") 1) (= (strstr $conline " 3teammate") 0)) [
  250.         += knst 1; conline [  ]
  251.     ] [
  252.     if (&& (= (strstr $conline "you splattered") 1) (= (strstr $conline " 3teammate") 0)) [
  253.         += spst 1; conline [  ]
  254.     ] [
  255.     if (&& (= (strstr $conline "you gibbed") 1) (= (strstr $conline " 3teammate") 0)) [
  256.         += gbst 1; conline [  ]
  257.     ] [
  258.     if (= (strcmp $conline " 2you got the enemy flag") 1) [
  259.         += sfst 1; conline [  ]
  260.     ] [
  261.     if (= (strcmp $conline " 2you got the flag") 1) [
  262.         += sfst 1; conline [  ]
  263.     ] [
  264.     if (= (strcmp $conline " 2you dropped the flag") 1) [
  265.         += dfst 1; conline [  ]
  266.     ] [
  267.     if (= (strcmp $conline " 2you lost the flag") 1) [
  268.         += lfst 1; conline [  ]
  269.     ] [
  270.     if (= (strstr $conline " 2you have kept the flag for") 1) [ // TKTF/KTF Flags
  271.         += kfst 1; conline [  ]
  272.     ][
  273.     if (&& (= $gamemode 5) (= (strcmp $conline " 2you scored") 1)) [ // CTF Flags
  274.         += cfst 1; conline [  ]
  275.     ] [
  276.     if (&& (= $gamemode 13) (= (strcmp $conline " 2you scored") 1)) [ // HTF Flags
  277.         += hfst 1; conline [  ]
  278.     ] [
  279.     if (= (strcmp $conline "you covered the flag") 1) [
  280.         += cvflag 1; conline [  ]
  281.     ] [
  282.     if (= (strcmp $conline "you defended the flag") 1) [
  283.         += dfflag 1; conline [  ]
  284.     ] [
  285.     if (= (strcmp $conline "YOU COVERED THE FLAG") 1) [ // Turns out strcmp is case-sensitive. Damn you /hudextras 3... :P
  286.         += cvflag 1; conline [  ]
  287.     ] [
  288.     if (= (strcmp $conline "YOU DEFENDED THE FLAG") 1) [
  289.         += dfflag 1; conline [  ]
  290.     ] [
  291.     if (= (strcmp $conline " 2you suicided!") 1) [
  292.         += suicides 1; conline [  ]
  293.     ] [
  294.     if (= (strcmp $conline "combo") 1) [
  295.         += combo 1; conline [  ]
  296.     ] [
  297.     if (= (strcmp $conline "multi combo x2") 1) [
  298.         +mcombo 1; conline [  ]
  299.     ] []]]]]]]]]]]]]]]]]]]]]]]
  300.     sleep 1 [get_stats]
  301. ]
  302.  
  303. if (strstr $mapstartalways clrst) [] [ // Automate stuff :)
  304.     add2alias mapstartalways [clrst; sleep 3 [get_stats]]
  305.     add2alias start_intermission [stats]
  306. ]
  307.  
  308. newmenu "Current Round Statistics"
  309. menuinit [(calc)]
  310. menuitemvar [concat (c 4)Here are your stats for $modest (concatword (curmap 1) :)]
  311. menuitem "" -1
  312. menuitemvar [concat (c 0) "        ~Flags~"]
  313. menuitemtextinput " 2Scored: " "result $cfst" // CTF Flags
  314. menuitemtextinput " 2Covered: " "result $cvflag"
  315. menuitemtextinput " 2Defended: " "result $dfflag"
  316. menuitemtextinput " 2Dropped: " "result $dfst"
  317. menuitemtextinput " 2Hunted: " "result $hfst" // HTF Flags
  318. menuitemtextinput " 2Kept: " "result $kfst"   // TKTF/KTF Flags
  319. menuitemtextinput " 3Lost: " "result $lfst"
  320. menuitemtextinput " 2Stolen: " "result $sfst" // # of times carrying flag.
  321. menuitem "" -1
  322. menuitemvar [concat (c 3) "        ~Kills~" ]
  323. menuitemtextinput " 2Frags: " "result $curfrags"
  324. menuitemtextinput " 3Deaths: " "result $curdeaths"
  325. menuitemtextinput " 3Suicides: " "result $suicides"
  326. menuitemtextinput " 2Score: " "result $curscore"
  327. menuitemtextinput " 2Combos: " "result $combo"
  328. menuitemtextinput " 2Multi-Combos: " "result $mcombo"
  329. menuitemtextinput " 2Ratio: " "result $curratio"
  330. menuitemtextinput " 2Gibs: " "result $gbst"
  331. menuitemtextinput " 2Headshots: " "result $hsst"
  332. menuitemtextinput " 2Knife Gibs: " "result $knst"
  333. menuitemtextinput " 2Splatters: " "result $spst"
  334. menuitemtextinput " 3FTK's: " "result $ftkst"
  335. menuitemtextinput " 3HTK's: " "result $htkst"
  336. menuitemtextinput " 3STK's: " "result $stkst"
  337. menuitemtextinput " 3KTK's: " "result $ktkst"
  338. menuitemtextinput " 3GTK's: " "result $gtkst"
  339. menuitemtextinput " 7Total TK's: " "result $tkst"
  340. menuitem "" -1
  341. menuitemvar [concat (c 1) "      ~Weapons~" ]
  342. menuitemtextinput " 2Sniper: " [(concatword $cursniper / $cursniperdmg)]
  343. menuitemtextinput " 2SMG: " [(concatword $cursmg / $cursmgdmg)]
  344. menuitemtextinput " 2AR: " [(concatword $curar / $curardmg)]
  345. menuitemtextinput " 2Shotgun: " [(concatword $curshot / $curshotdmg)]
  346. menuitemtextinput " 2Carbine: " [(concatword $curcarb / $curcarbdmg)]
  347. menuitemtextinput " 2Pistol: " [(concatword $curusp / $curuspdmg)]
  348. menuitemtextinput " 2Akimbo: " [(concatword $curaki / $curakidmg)]
  349. menuitemtextinput " 2Grenade: " [(concatword $curnade / $curnadedmg)]
  350. menuitemtextinput " 2Knife: " [(concatword $curknife / $curknifedmg)]
  351. menuitem "" -1
  352. menuitemvar [concat (c 4)Weapon stats are currently shots/damage.]
  353.  
  354. showcurstatsbind = [ // Pre-built alias that users can bind to a key for easy menu viewing.
  355.     calc
  356.     showmenu "Current Round Statistics"
  357.     onrelease [closemenu "Current Round Statistics"]
  358. ]
  359.  
  360. bind BACKQUOTE [showcurstatsbind]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement