1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- /**
- * 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.0"
- public Plugin myinfo = {
- name = "Round End Music: Sample Source",
- 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" },
- };
- 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;
- }
- 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();
- }
- }
|