Guest User

Speedrun.cs

a guest
Aug 2nd, 2016
48
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package Timer {
  2. function clientCmdGameStart() {
  3. Parent::clientCmdGameStart();
  4. if ($ResetTime) {
  5. $runningElapsedTime = 0;
  6. $startSimTime = getSimTime();
  7. $ResetTime = 0;
  8. }
  9. messageScoreStats();
  10. }
  11.  
  12. function clientCmdGameEnd() {
  13. Parent::clientCmdGameEnd();
  14.  
  15. $runningElapsedTime += PlayGui.ElapsedTime;
  16. if (PM_MissionList.getSelectedId() == PM_MissionList.rowCount() && $MissionType $= "Advanced") {
  17. dumpScoreStats();
  18. }
  19. }
  20.  
  21. function GameConnection::onConnectionAccepted(%this) {
  22. Parent::onConnectionAccepted(%this);
  23. $ResetTime = 1;
  24. }
  25.  
  26. function disconnect() {
  27. Parent::disconnect();
  28. dumpScoreStats();
  29. }
  30.  
  31. function dumpScoreStats() {
  32. MessageBoxOk("Final Stats: ",
  33. "Total Elapsed Time: " @ formatTimeHours($runningElapsedTime) NL
  34. "Total Running Time: " @ formatTimeHours(getSimTime() - $startSimTime));
  35. }
  36.  
  37. function messageScoreStats() {
  38. addHelpLine(
  39. "Current Elapsed Time: " @ formatTimeHours($runningElapsedTime) NL
  40. "Current Running Time: " @ formatTimeHours(getSimTime() - $startSimTime));
  41. }
  42. };
  43. activatePackage(Timer);
RAW Paste Data