123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- /**
- * Round End Music: Sample Sources
- *
- * An example plugin showing how to add songs to the Round End Music playlist.
- */
- #pragma semicolon 1
- #include <sourcemod>
- #pragma newdecls required
- #include <round_end_music>
- #define PLUGIN_VERSION "0.1.2"
- public Plugin myinfo = {
- name = "Round End Music: Sample Source and Handler",
- author = "nosoop",
- description = "Loads hard-coded music entries. Mostly for testing.",
- version = PLUGIN_VERSION,
- url = "https://pika.nom-nom-nom.us/"
- }
- char SONGS[][][] = {
- { "You're at the Party", "Lemon Demon", "nomnomnomsongs/pikapoo/attheparty.mp3" },
- { "Come on Down", "The Price is Right", "nomnomnomsongs/tpir.mp3" },
- { "1812 Overture", "Tchaikovsky", "nomnomnomsongs/1812.mp3" },
- { "Back to the Future", "The Outatime Orchestra", "nomnomnomsongs/bttf.mp3" },
- { "Blinded by Light", "Final Fantasy 13", "nomnomnomsongs/blindedbylight.mp3" },
- { "Yatta!", "Green Leaves", "nomnomnomsongs/yatta.mp3" },
- { "Hydroponics Lab", "Escape From Puppy Death Factory", "nomnomnomsongs/pikapoo/puppydeathfactory.mp3" },
- { "Theme", "Jackie Chan Adventures", "nomnomnomsongs/jchana.mp3" },
- { "Throwback Galaxy", "Super Mario Galaxy 2", "nomnomnomsongs/throwback.mp3" },
- };
- public void HardcodedArrayMusicSource() {
- for (int i = 0; i < sizeof(SONGS); i++) {
- MusicEntry entry = GenerateSong(SONGS[i][0], SONGS[i][1], SONGS[i][2]);
-
- if (!REM_AddSong(entry)) {
- PrintToServer("[rem-sample] Song %s could not be queued.", SONGS[i][2]);
- }
- delete entry;
- }
-
- PrintToServer("[rem-sample] %d songs requested", REM_GetActiveSongCount());
- }
- MusicEntry GenerateSong(const char[] title, const char[] source, const char[] filePath) {
- MusicEntry song = new MusicEntry();
- song.SetTitle(title);
- song.SetSource(source);
- song.SetFilePath(filePath);
- 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);
- }
- public void OnAllPluginsLoaded() {
- if (LibraryExists("round-end-music")) {
- OnRoundEndMusicAvailable();
- }
- }
- public void OnLibraryAdded(const char[] name) {
- if (StrEqual(name, "round-end-music")) {
- OnRoundEndMusicAvailable();
- }
- }
|