Browse Source

Added configurable song delay

"Look ma, it's the wheel!  Again."

(Basically just getting REM up to feature-parity with the old
implementation.)
nosoop 8 years ago
parent
commit
c94b5dad16
1 changed files with 9 additions and 3 deletions
  1. 9 3
      scripting/round_end_music.sp

+ 9 - 3
scripting/round_end_music.sp

@@ -12,7 +12,7 @@
 #pragma newdecls required
 #include <round_end_music>
 
-#define PLUGIN_VERSION "0.3.0"
+#define PLUGIN_VERSION "0.4.0"
 public Plugin myinfo = {
     name = "[CSRD] Round End Music",
     author = "nosoop",
@@ -24,7 +24,7 @@ public Plugin myinfo = {
 bool g_bQueueLocked = false;
 ArrayList g_QueuedSongs, g_ActiveSongs, g_PlayedSongs;
 
-ConVar g_ConVarMaxActiveSongs, g_ConVarEnabled;
+ConVar g_ConVarMaxActiveSongs, g_ConVarEnabled, g_ConVarSongDelay;
 
 Handle g_RequestSongForward;
 
@@ -54,6 +54,9 @@ public void OnPluginStart() {
 			true, 1.0, false);
 	g_ConVarEnabled = CreateConVar("sm_rem_enabled", "1", "Enables Round End Music.", _,
 			true, 0.0, true, 1.0);
+	g_ConVarSongDelay = CreateConVar("sm_rem_song_delay", "4.3",
+			"Amount of time after the round end to wait before playing the song.", _,
+			true, 0.0);
 	
 	AutoExecConfig();
 }
@@ -252,7 +255,10 @@ void FireOnREMPlayedPostEvent(MusicEntry song) {
 }
 
 public void OnRoundEnd(Event event, const char[] name, bool dontBroadcast) {
-	// TODO timer
+	CreateTimer(g_ConVarSongDelay.FloatValue, RoundEndMusicPlaybackDelay);
+}
+
+public Action RoundEndMusicPlaybackDelay(Handle timer, any data) {
 	PlayRoundEndMusic();
 }