Browse Source

Added SongWasRecentlyPlayed support

Showed an example for the replay functionality.
nosoop 8 years ago
parent
commit
d524cbc021
1 changed files with 6 additions and 2 deletions
  1. 6 2
      scripting/round_end_music_sample_provider.sp

+ 6 - 2
scripting/round_end_music_sample_provider.sp

@@ -9,7 +9,7 @@
 #pragma newdecls required
 #include <round_end_music>
 
-#define PLUGIN_VERSION "0.1.2"
+#define PLUGIN_VERSION "0.1.3"
 public Plugin myinfo = {
     name = "Round End Music: Sample Source and Handler",
     author = "nosoop",
@@ -52,10 +52,14 @@ MusicEntry GenerateSong(const char[] title, const char[] source, const char[] fi
 }
 
 public void OnRoundEndMusicPlayed(MusicEntry song) {
-	char title[64], source[64];
+	char title[64], source[64], filePath[PLATFORM_MAX_PATH];
 	song.GetTitle(title, sizeof(title));
 	song.GetSource(source, sizeof(source));
 	PrintToChatAll("You're now listening to: %s from %s!", title, source);
+	
+	song.GetFilePath(filePath, sizeof(filePath));
+	PrintToServer("[rem-sample] Played %s (replay? %b)", filePath,
+			REM_SongWasRecentlyPlayed(song));
 }
 
 void OnRoundEndMusicAvailable() {