Browse Source

Added support for OnRoundEndMusicPlayed

Provides an example for printing out song information.
nosoop 8 years ago
parent
commit
16791bffb0
1 changed files with 9 additions and 2 deletions
  1. 9 2
      scripting/round_end_music_sample_provider.sp

+ 9 - 2
scripting/round_end_music_sample_provider.sp

@@ -9,9 +9,9 @@
 #pragma newdecls required
 #include <round_end_music>
 
-#define PLUGIN_VERSION "0.1.0"
+#define PLUGIN_VERSION "0.1.1"
 public Plugin myinfo = {
-    name = "Round End Music: Sample Source",
+    name = "Round End Music: Sample Source and Handler",
     author = "nosoop",
     description = "Loads hard-coded music entries.  Mostly for testing.",
     version = PLUGIN_VERSION,
@@ -48,6 +48,13 @@ MusicEntry GenerateSong(const char[] title, const char[] source, const char[] fi
 	return song;
 }
 
+public void OnRoundEndMusicPlayed(MusicEntry song) {
+	char title[64], source[64];
+	song.GetTitle(title, sizeof(title));
+	song.GetSource(source, sizeof(source));
+	PrintToChatAll("You're now listening to: %s from %s!", title, source);
+}
+
 void OnRoundEndMusicAvailable() {
 	REM_RegisterSource(HardcodedArrayMusicSource);
 }