Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if (checkalias atfrags) [] [ // Make stats collecting aliases if they do not already exist.
- curflags = 0
- atflags = 0
- curfrags = 0
- atfrags = 0
- curdeaths = 0
- atdeaths = 0
- curscore = 0
- atscore = 0
- curratio = 0
- atratio = 0
- cursniper = 0
- cursniperdmg = 0
- cursmg = 0
- cursmgdmg = 0
- curshot = 0
- curshotdmg = 0
- curar = 0
- curardmg = 0
- curcarb = 0
- curcarbdmg = 0
- curusp = 0
- curuspdmg = 0
- curaki = 0
- curakidmg = 0
- curknife = 0
- curknifedmg = 0
- clast = 0
- rvsfst = 0
- games_played = 0
- tkst = 0
- htkst = 0
- stkst = 0
- gtkst = 0
- ktkst = 0
- ftkst = 0
- ]
- addcheck_si [+= games_played 1]
- calc = [ // Function used for gathering and calculating stats
- curflags = (at (pstat_score (findcn $curname)) 0)
- curfrags = (at (pstat_score (findcn $curname)) 1)
- curdeaths = (at (pstat_score (findcn $curname)) 2)
- curscore = (at (pstat_score (findcn $curname)) 3)
- cursniper = (at (pstat_weap (findcn $curname)) 10)
- cursniperdmg = (at (pstat_weap (findcn $curname)) 11)
- cursmg = (at (pstat_weap (findcn $curname)) 8)
- cursmgdmg = (at (pstat_weap (findcn $curname)) 9)
- curar = (at (pstat_weap (findcn $curname)) 12)
- curardmg = (at (pstat_weap (findcn $curname)) 13)
- curshot = (at (pstat_weap (findcn $curname)) 6)
- curshotdmg = (at (pstat_weap (findcn $curname)) 7)
- curcarb = (at (pstat_weap (findcn $curname)) 4)
- curcarbdmg = (at (pstat_weap (findcn $curname)) 5)
- curusp = (at (pstat_weap (findcn $curname)) 2)
- curuspdmg = (at (pstat_weap (findcn $curname)) 3)
- curaki = (at (pstat_weap (findcn $curname)) 18)
- curakidmg = (at (pstat_weap (findcn $curname)) 19)
- curnade = (at (pstat_weap (findcn $curname)) 16)
- curnadedmg = (at (pstat_weap (findcn $curname)) 17)
- curknife = (at (pstat_weap (findcn $curname)) 0)
- curknifedmg = (at (pstat_weap (findcn $curname)) 1)
- curratio = (divf $curfrags $curdeaths)
- // if (&& (<= $minutesremaining 0) (= $strst 0)) [ // Add current score to all-time totals during intermission.
- += atfrags $curfrags // TODO: Make it possible to add to these for on-the-fly all-time stats viewing.
- += atdeaths $curdeaths
- += atscore $curscore
- += atflags $curflags
- atscoreavg = (divf $curscore $games_played)
- atratio = (divf $atfrags $atdeaths)
- if (= (curmodeattr team) 1) [ // Check if user is in a team mode.
- if (= (curteam) 1) [ // If playing for RVSF, +1 to it's stat.
- += rvsfst 1
- // 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
- ] [
- += clast 1 // Else they are playing for CLA, +1 to it's stat.
- ]] []
- 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.
- // ] []
- if (= $gamemode 0) [
- modest = "TDM"
- ][
- if (= $gamemode 2) [
- modest = "DM"
- ][
- if (= $gamemode 4) [
- modest = "TSURV"
- ][
- if (= $gamemode 3) [
- modest = "SURV"
- ][
- if (= $gamemode 5) [
- modest = "CTF"
- ][
- if (= $gamemode 13) [
- modest = "HTF"
- ][
- if (= $gamemode 15) [
- modest = "KTF"
- ][
- if (= $gamemode 14) [
- modest = "TKTF"
- ][
- if (= $gamemode 6) [
- modest = "PF"
- ][
- if (= $gamemode 9) [
- modest = "LSS"
- ][
- if (= $gamemode 10) [
- modest = "OSOK"
- ][
- if (= $gamemode 11) [
- modest = "TOSOK"
- ][
- if (= $gamemode 7) [
- modest = "BTDM"
- ][
- if (= $gamemode 8) [
- modest = "BDM"
- ][
- if (= $gamemode 12) [
- modest = "BOSOK"
- ][
- if (= $gamemode 1) [
- modest = "COOP"
- ] []]]]]]]]]]]]]]]]
- ]
- clrst = [ // Function used to clear temporary script flow aliases on every map start.
- strst = 0
- ]
- stats = [
- calc // Gather and calculate the stats.
- if (strcmp $arg1 "all") [ // If user entered "all" as the first argument display the all-time stats instead.
- echo All-Time Frags: $atfrags
- echo All-Time Deaths: $atdeaths
- echo All-Time Score: $atscore
- if (< $atdeaths 2) [ // Ratio = # of kills until >= the 2nd death.
- echo All-Time Ratio: (concatword $atfrags .0)
- ] [
- echo All-Time Ratio: $atratio
- ]
- echo CLA: $clast
- echo RVSF: $rvsfst
- ] [ // Else show user the current round stats.
- echo Frags: $curfrags
- echo Deaths: $curdeaths
- if (= $connected 1) [ // Score is only calculated in multiplayer.
- echo Score: $curscore
- ] [
- echo Score: N/A
- ]
- if (< $curdeaths 2) [ // Ratio = # of kills until >= the 2nd death.
- echo Ratio: (concatword $curfrags .0)
- ] [
- echo Ratio: $curratio
- ]]]
- get_stats = [ // Function used for gathering stats that pstat_score cannot access.
- if (= (strstr $conline "3you fragged teammate") 1) [ // team kills
- += tkst 1; += ftkst 1; conline [ ]
- ] [
- if (= (strstr $conline "3you headshotted teammate") 1) [
- += tkst 1; += htkst 1; conline [ ]
- ] [
- if (= (strstr $conline "3you splattered teammate") 1) [
- += tkst 1; += stkst 1; conline [ ]
- ] [
- if (= (strstr $conline "3you knifed teammate") 1) [
- += tkst 1; += ktkst 1; conline [ ]
- ] [
- if (= (strstr $conline "3you gibbed teammate") 1) [
- += tkst 1; += gtkst 1; conline [ ]
- ] []
- sleep 1 [get_stats]
- ]]]]]
- if (strstr $mapstartalways clrst) [] [ // Automate stuff :)
- add2alias mapstartalways [clrst; sleep 3 [get_stats]]
- add2alias start_intermission [stats]
- ]
- newmenu "Current Round Statistics"
- menuinit [(calc)]
- menuitemvar [concat Here are your stats for $modest (concatword (curmap 1) :)]
- menuitem "" -1
- menuitemtextinput "Flags: " "result $curflags"
- menuitemtextinput "Frags: " "result $curfrags"
- menuitemtextinput "Deaths: " "result $curdeaths"
- menuitemtextinput "Score: " "result $curscore"
- menuitemtextinput "Ratio: " "result $curratio"
- menuitemtextinput "FTK's: " "result $ftkst"
- menuitemtextinput "HTK's: " "result $htkst"
- menuitemtextinput "STK's: " "result $stkst"
- menuitemtextinput "KTK's: " "result $ktkst"
- menuitemtextinput "GTK's: " "result $gtkst"
- menuitemtextinput "Total TK's: " "result $tkst"
- menuitem "" -1
- menuitemtextinput "Sniper: " [(concatword $cursniper / $cursniperdmg)]
- menuitemtextinput "SMG: " [(concatword $cursmg / $cursmgdmg)]
- menuitemtextinput "AR: " [(concatword $curar / $curardmg)]
- menuitemtextinput "Shotgun: " [(concatword $curshot / $curshotdmg)]
- menuitemtextinput "Carbine: " [(concatword $curcarb / $curcarbdmg)]
- menuitemtextinput "Pistol: " [(concatword $curusp / $curuspdmg)]
- menuitemtextinput "Akimbo: " [(concatword $curaki / $curakidmg)]
- menuitemtextinput "Grenade: " [(concatword $curnade / $curnadedmg)]
- menuitemtextinput "Knife: " [(concatword $curknife / $curknifedmg)]
- menuitem "" -1
- menuitem "Weapon stats are currently shots/damage." -1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement