Advertisement
Guest User

Untitled

a guest
Jun 25th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.34 KB | None | 0 0
  1. //******************************************************************************
  2. // _____ _ _ __
  3. // | _ | | | | | / _|
  4. // | | | |_ __ ___ _ __ | | | | __ _ _ __| |_ __ _ _ __ ___
  5. // | | | | '_ \ / _ \ '_ \| |/\| |/ _` | '__| _/ _` | '__/ _ \
  6. // \ \_/ / |_) | __/ | | \ /\ / (_| | | | || (_| | | | __/
  7. // \___/| .__/ \___|_| |_|\/ \/ \__,_|_| |_| \__,_|_| \___|
  8. // | | We don't make the game you play.
  9. // |_| We make the game you play BETTER.
  10. //
  11. // Website: http://openwarfaremod.com/
  12. //******************************************************************************
  13.  
  14. #include openwarfare\_eventmanager;
  15. #include openwarfare\_utils;
  16.  
  17. init()
  18. {
  19. // Get the main module's dvars
  20. level.scr_killingspree_enable = getdvarx( "scr_killingspree_enable", "int", 0, 0, 1 );
  21. level.scr_unreal_headshot_sound = getdvarx( "scr_unreal_headshot_sound", "int", 0, 0, 1 );
  22. level.scr_unreal_firstblood_sound = getdvarx( "scr_unreal_firstblood_sound", "int", 0, 0, 1 );
  23.  
  24. // If killing spree sounds are not enabled then there's nothing to do here
  25. if ( level.scr_killingspree_enable == 0 && level.scr_unreal_headshot_sound == 0 && level.scr_unreal_firstblood_sound == 0 )
  26. return;
  27.  
  28. // Load the kills/sounds to be used
  29. if ( level.scr_killingspree_enable == 1 ) {
  30. killingSprees = getdvarx( "scr_killingspree_sounds", "string", "2 doublekill;5 killingspree;7 rampage;9 dominating;12 unstoppable;15 godlike" );
  31. killingSprees = strtok( killingSprees, ";" );
  32. level.scr_killingspree_kills = [];
  33. level.scr_killingspree_sounds = [];
  34. for ( iSpree = 0; iSpree < killingSprees.size; iSpree++ ) {
  35. thisSpree = strtok( killingSprees[ iSpree ], " " );
  36. level.scr_killingspree_kills[ iSpree ] = int( thisSpree[0] );
  37. level.scr_killingspree_sounds[ iSpree ] = thisSpree[1];
  38. }
  39. }
  40.  
  41. level thread addNewEvent( "onPlayerConnected", ::onPlayerConnected );
  42. }
  43.  
  44.  
  45. onPlayerConnected()
  46. {
  47. self thread onPlayerKillStreak();
  48. self thread addNewEvent( "onPlayerSpawned", ::onPlayerSpawned );
  49. }
  50.  
  51.  
  52. onPlayerSpawned()
  53. {
  54. self.killingSpree = 0;
  55. }
  56.  
  57. onPlayerKillStreak()
  58. {
  59. self endon("disconnect");
  60. level endon( "game_ended" );
  61.  
  62. for(;;)
  63. {
  64. self waittill("kill_streak", killStreak, streakGiven, sMeansOfDeath );
  65. playedSound = false;
  66.  
  67. // Check if we need to play first blood sound
  68. if ( level.scr_unreal_firstblood_sound == 1 && !playedSound && !isDefined( level.firstBlood ) ) {
  69. playedSound = true;
  70. level.firstBlood = true;
  71. self playLocalSound( "firstblood" );
  72. }
  73.  
  74. // Check if we need to play a sound for killing spree
  75. if ( level.scr_killingspree_enable == 1 && streakGiven && !playedSound ) {
  76. killingSpree = 0;
  77. while ( killingSpree < level.scr_killingspree_kills.size && level.scr_killingspree_kills[ killingSpree ] != killStreak )
  78. killingSpree++;
  79.  
  80. // Check if we found a match and play the corresponding sound
  81. if ( killingSpree < level.scr_killingspree_kills.size ) {
  82. self playLocalSound( level.scr_killingspree_sounds[ killingSpree ] );
  83. playedSound = true;
  84. }
  85. }
  86.  
  87. // Check if we need to play headshot sound
  88. if ( level.scr_unreal_headshot_sound == 1 && !playedSound && sMeansOfDeath == "MOD_HEAD_SHOT" ) {
  89. playedSound = true;
  90. self playLocalSound( "headshot" );
  91. }
  92. }
  93. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement