Advertisement
Guest User

Untitled

a guest
Sep 29th, 2010
322
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.33 KB | None | 0 0
  1. #include maps\mp\_utility;
  2. #include common_scripts\utility;
  3.  
  4. processLobbyScoreboards()
  5. {
  6. foreach ( player in level.placement["all"] )
  7. player setPlayerScoreboardInfo();
  8.  
  9. if ( level.teamBased )
  10. {
  11. alliesScore = getTeamScore( "allies" );
  12. axisScore = getTeamScore( "axis" );
  13.  
  14. if ( alliesScore == axisScore )
  15. winner = "tied";
  16. else if ( alliesScore > axisScore )
  17. winner = "allies";
  18. else
  19. winner = "axis";
  20.  
  21. if ( winner == "tied" )
  22. {
  23. // build both, assign type to your team
  24. buildScoreboardType( "allies" );
  25. buildScoreboardType( "axis" );
  26.  
  27. foreach ( player in level.players )
  28. {
  29. if ( player.pers["team"] == "spectator" )
  30. player setPlayerData( "round", "scoreboardType", "allies" );
  31. else
  32. player setPlayerData( "round", "scoreboardType", player.pers["team"] );
  33. }
  34. }
  35. else
  36. {
  37. // build just winner, assign type to winner
  38. buildScoreboardType( winner );
  39.  
  40. foreach ( player in level.players )
  41. player setPlayerData( "round", "scoreboardType", winner );
  42. }
  43. }
  44. else // not teambased
  45. {
  46. buildScoreboardType( "neutral" );
  47.  
  48. foreach ( player in level.players )
  49. player setPlayerData( "round", "scoreboardType", "neutral" );
  50. }
  51.  
  52. foreach ( player in level.players )
  53. {
  54. // TODO: convert this to round stats
  55. player setClientDvars(
  56. "player_summary_xp", player.pers["summary"]["xp"],
  57. "player_summary_score", player.pers["summary"]["score"],
  58. "player_summary_challenge", player.pers["summary"]["challenge"],
  59. "player_summary_match", player.pers["summary"]["match"],
  60. "player_summary_misc", player.pers["summary"]["misc"]
  61. );
  62. }
  63. }
  64.  
  65. setPlayerScoreboardInfo()
  66. {
  67. scoreboardPlayerCount = getClientMatchData( "scoreboardPlayerCount" );
  68. if ( scoreboardPlayerCount <= 24 ) //MaxPlayers
  69. {
  70. setClientMatchData( "players", self.clientMatchDataId, "score", self.pers["score"] );
  71. println( "Scoreboard: [" + self.name + "(" + self.clientMatchDataId + ")][score]: " + self.pers["score"] );
  72.  
  73. kills = self getPlayerStat( "kills" );
  74. setClientMatchData( "players", self.clientMatchDataId, "kills", kills );
  75. println( "Scoreboard: [" + self.name + "(" + self.clientMatchDataId + ")][kills]: " + kills );
  76.  
  77. assists = self getPlayerStat( "assists" );
  78. setClientMatchData( "players", self.clientMatchDataId, "assists", assists );
  79. println( "Scoreboard: [" + self.name + "(" + self.clientMatchDataId + ")][assists]: " + assists );
  80.  
  81. deaths = self getPlayerStat( "deaths" );
  82. setClientMatchData( "players", self.clientMatchDataId, "deaths", deaths );
  83. println( "Scoreboard: [" + self.name + "(" + self.clientMatchDataId + ")][deaths]: " + deaths );
  84.  
  85. faction = game[self.pers["team"]];
  86. setClientMatchData( "players", self.clientMatchDataId, "faction", faction );
  87. println( "Scoreboard: [" + self.name + "(" + self.clientMatchDataId + ")][faction]: " + faction );
  88.  
  89. println( "Scoreboard: scoreboardPlayerCount was " + scoreboardPlayerCount );
  90. scoreboardPlayerCount++;
  91. setClientMatchData( "scoreboardPlayerCount", scoreboardPlayerCount );
  92. println( "Scoreboard: scoreboardPlayerCount now " + scoreboardPlayerCount );
  93. }
  94. else
  95. {
  96. println( "Scoreboard: scoreboardPlayerCount is greater than 24 (" + scoreboardPlayerCount + ")" );
  97. }
  98. }
  99.  
  100. buildScoreboardType( team )
  101. {
  102. assert( team == "allies" || team == "axis" || team == "neutral" );
  103.  
  104. println( "Scoreboard: Building scoreboard (" + team + ")" );
  105.  
  106. if ( team == "neutral" )
  107. {
  108. index = 0;
  109. foreach ( player in level.placement["all"] )
  110. {
  111. setClientMatchData( "scoreboards", team, index, player.clientMatchDataId );
  112. println( "Scoreboard: [scoreboards][" + team + "][" + index + "][" + player.clientMatchDataId + "]" );
  113. index++;
  114. }
  115. }
  116. else
  117. {
  118. otherTeam = getOtherTeam( team );
  119.  
  120. index = 0;
  121. foreach ( player in level.placement[team] )
  122. {
  123. setClientMatchData( "scoreboards", team, index, player.clientMatchDataId );
  124. println( "Scoreboard: [scoreboards][" + team + "][" + index + "][" + player.name + "(" + player.clientMatchDataId + ")]" );
  125. index++;
  126. }
  127.  
  128. foreach ( player in level.placement[otherTeam] )
  129. {
  130. setClientMatchData( "scoreboards", team, index, player.clientMatchDataId );
  131. println( "Scoreboard: [scoreboards][" + team + "][" + index + "][" + player.name + "(" + player.clientMatchDataId + ")]" );
  132. index++;
  133. }
  134. }
  135. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement