Advertisement
Guest User

Untitled

a guest
Jun 25th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. if (checkalias curfrags) [] [ // Make stats collecting aliases if they do not already exist.
  2.     curfrags = 0
  3.     atfrags = 0
  4.     curdeaths = 0
  5.     atdeaths = 0
  6.     curscore = 0
  7.     atscore = 0
  8.     curratio = 0
  9.     atratio = 0
  10.     cursniper = 0
  11.     cursmg = 0
  12.     curshot = 0
  13.     curar = 0
  14.     curcarb = 0
  15.     curusp = 0
  16.     curaki = 0
  17.     clast = 0
  18.     rvsfst = 0
  19. ]
  20.  
  21. calc = [ // Function used for gathering and calculating stats
  22.     curfrags = (at (pstat_score (findcn $curname)) 1)
  23.     curdeaths = (at (pstat_score (findcn $curname)) 2)
  24.     curscore = (at (pstat_score (findcn $curname)) 3)
  25.     curratio = (divf $curfrags $curdeaths)
  26.     cursniper = (at (pstat_weap (findcn $curname)) 10)
  27.     cursmg = (at (pstat_weap (findcn $curname)) 8)
  28.     curar = (at (pstat_weap (findcn $curname)) 12)
  29.     curshot = (at (pstat_weap (findcn $curname)) 6)
  30.     curcarb = (at (pstat_weap (findcn $curname)) 4)
  31.     curusp = (at (pstat_weap (findcn $curname)) 2)
  32.     curaki = (at (pstat_weap (findcn $curname)) 18)
  33.     curnade = (at (pstat_weap (findcn $curname)) 16)
  34.     curknife = (at (pstat_weap (findcn $curname)) 0)
  35.         if (&& (<= $minutesremaining 0) (= $strst 0)) [ // Add current score to all-time totals during intermission.
  36.             += atfrags $curfrags                        // TODO: Make it possible to add to these for on-the-fly all-time stats viewing.
  37.             += atdeaths $curdeaths
  38.             += atscore $curscore
  39.             atratio = (divf $atfrags $atdeaths)
  40.                 if (= (curmodeattr team) 1) [ // Check if user is in a team mode.
  41.                     if (= (curteam) 1) [ // If playing for RVSF, +1 to it's stat.
  42.                         += rvsfst 1
  43.                     ] [
  44.                         += clast 1 // Else they are playing for CLA, +1 to it's stat.
  45.                 ]] []
  46.             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.
  47.         ] []
  48. ]
  49.  
  50. clrst = [ // Function used to clear temporary script flow aliases on every map start.
  51.     strst = 0
  52. ]
  53.  
  54. stats = [
  55.     calc // Gather and calculate the stats.
  56.         if (strcmp $arg1 "all") [ // If user entered "all" as the first argument display the all-time stats instead.
  57.             echo All-Time Frags: $atfrags
  58.             echo All-Time Deaths: $atdeaths
  59.             echo All-Time Score: $atscore
  60.                 if (< $atdeaths 2) [ // Ratio = # of kills until >= the 2nd death.
  61.             echo All-Time Ratio: (concatword $atfrags .0)
  62.             ] [
  63.             echo All-Time Ratio: $atratio
  64.             ]
  65.             echo CLA: $clast
  66.             echo RVSF: $rvsfst
  67.         ] [ // Else show user the current round stats.
  68.         echo Frags: $curfrags
  69.         echo Deaths: $curdeaths
  70.             if (= $connected 1) [ // Score is only calculated in multiplayer.
  71.         echo Score: $curscore
  72.     ] [
  73.         echo Score: N/A
  74.     ]
  75.             if (< $curdeaths 2) [ // Ratio = # of kills until >= the 2nd death.
  76.         echo Ratio: (concatword $curfrags .0)
  77.     ] [
  78.         echo Ratio: $curratio
  79. ]]]
  80.  
  81. if (strstr $mapstartalways clrst) [] [ // Automate stuff :)
  82.     add2alias mapstartalways [clrst]
  83.     add2alias start_intermission [stats]
  84. ]
  85.  
  86. newmenu "Current Round Statistics"
  87. menuinit [(calc)]
  88. menuitemtextinput "Frags: " "result $curfrags"
  89. menuitemtextinput "Deaths: " "result $curdeaths"
  90. menuitemtextinput "Score: " "result $curscore"
  91. menuitemtextinput "Ratio: " "result $curratio"
  92. menuitem "" -1
  93. menuitemtextinput "Sniper: " "result $cursniper"
  94. menuitemtextinput "SMG: " "result $cursmg"
  95. menuitemtextinput "AR: " "result $curar"
  96. menuitemtextinput "Shotgun: " "result $curshot"
  97. menuitemtextinput "Carbine: " "result $curcarb"
  98. menuitemtextinput "Pistol: " "result $curusp"
  99. menuitemtextinput "Akimbo: " "result $curaki"
  100. menuitemtextinput "Grenade: " "result $curnade"
  101. menuitemtextinput "Knife: " "result $curknife"
  102.  
  103.  
  104. bind BACKQUOTE [calc; showmenu "Current Round Statistics"; onrelease [closemenu "Current Round Statistics"]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement