Release Get highest scoring player
#1
Code:
getHighestScoringPlayer() { players = level.players; winner = undefined; tie = false; for( i = 0; i < players.size; i++ ) { if ( !isDefined( players[i].score ) ) continue; if ( players[i].score < 1 ) continue; if(!isalive(players[i])) continue; if ( !isDefined( winner ) || players[i].score > winner.score ) { winner = players[i]; tie = false; } else if ( players[i].score == winner.score ) { tie = true; } wait .05; } if ( tie || !isDefined( winner ) ) { winner = getRandomPlayer(); return winner; } else return winner; }
[Image: MaEIQ.png]
Reply

#2
Code:
#include common_scripts\utility; GetHighestScoringPlayer() { players = level.players; winner = undefined; for( i = 0; i < players.size; i++ ) { if ( !isDefined( players[i].score ) ) continue; if ( players[i].score < 1 ) continue; if ( !isDefined( winner ) || players[i].score > winner.score ) winner = players[i]; else if ( players[i].score == winner.score ) if( CoinToss() ) winner = players[i]; } return winner; }

Your way if there is a tie it takes a "Random player" which that player could have 0 points while the tie was at 30,000 points.
My way selects one of the two who tied randomly
Reply

#3
Code:
highPlayer = maps\mp\gametypes\_globallogic_score::getHighestScoringPlayer();

thanks to deadcrayon for sharing this.
Reply

#4
(08-30-2011, 19:04)Lemon Wrote:
Code:
highPlayer = maps\mp\gametypes\_globallogic_score::getHighestScoringPlayer();

thanks to deadcrayon for sharing this.

Yes both Pozzuh and I know that one, what we posted is a slightly modified version of that.

In case of a tie, it returns "undefined" which will cause a crash for you I bet, and our modified versions return a player in the event of a tie, avoiding the crash.
Reply

#5
Why did you add a check to skip people on the "axis" team. Tongue
[Image: 30xhrep.png]

A casual conversation between barata and I about Nukem.
Reply

#6
(08-31-2011, 02:32)master131 Wrote: Why did you add a check to skip people on the "axis" team. Tongue

Oh fuck, that was for my mod a while ago Smile Removed
[Image: MaEIQ.png]
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
  Help Sentry Gun kill = Player kill Snake 8 8,250 11-07-2013, 13:41
Last Post: Nekochan
  Player can write Fl0w_.JACKDAN 2 5,136 09-19-2013, 16:36
Last Post: Fl0w_.JACKDAN
  [CoD 4] Trying to set a player -- DidUknowiPwn 7 8,291 07-03-2013, 21:58
Last Post: Pozzuh
  [Release] Black Ops Single Player/Zombie Trainer V3.6 Craig87 52 101,660 07-01-2013, 15:12
Last Post: explosivebanana55
Video Preview AIZombies eXtreme 2.0 / Zombie Player (Music Player) DidUknowiPwn 4 8,076 06-24-2013, 16:37
Last Post: DidUknowiPwn
  "VEH_LinkCommonChecks: Player already has an owner" - After long games akillj 4 5,414 06-07-2013, 11:38
Last Post: akillj
  Question on how to "Spawn" a flying rocket as a player? akillj 8 8,505 06-04-2013, 01:54
Last Post: rotceh_dnih
  Using Cheat Engine with Zombies Single Player kikkawa 3 14,857 06-03-2013, 01:18
Last Post: kikkawa
  [Request] Random player model hillbilly 1 3,850 05-12-2013, 08:30
Last Post: archit
Brick [Release] MW3 Single Player CONSOLE v1.9.433 can1907 13 37,422 05-01-2013, 15:18
Last Post: vton

Forum Jump:


Users browsing this thread:
1 Guest(s)

Forum Powered By MyBB, Theme by © 2002-2026 Melroy van den Berg.