also, i've edited your code. now it's better, and easier to configure
PHP Code:
#pragma semicolon 1
#define DEBUG
#include <sourcemod>
#include <sdktools>
#include <colors>
// ----->> SONG LIST <<----- //
static char g_sSongList[][][255] =
{
{"dnc_song1.mp3", "Name Song 1"},
{"dnc_song2.mp3", "Name Song 2"},
{"dnc_song3.mp3", "Name Song 3"},
{"dnc_song4.mp3", "Name Song 4"}
}; // ----->> SONG LIST <<----- //
#define g_sServerTag "{red}[Server]"
public Plugin myinfo =
{
name = "Round End Musics",
author = "KaTeX & stephen473",
description = "Puts Music at the end of Rounds..",
version = "1.1",
url = "https://steamcommunity.com/id/kHardy"
};
public void OnPluginStart()
{
HookEvent("round_end", Event_RoundEnd, EventHookMode_Pre);
}
public void OnMapStart()
{
int soundcount;
for(int i = 0; i <= sizeof(g_sSongList); i++)
{
char buffer[PLATFORM_MAX_PATH];
Format(buffer, sizeof(buffer), "sound/%s", g_sSongList[i][0]);
AddFileToDownloadsTable(buffer);
PrecacheSound(g_sSongList[i][0]);
soundcount = i;
}
PrintToServer("[Round End] %i sounds loaded.", soundcount);
}
public void Event_RoundEnd(Event event, const char[] name, bool dontBroadcast)
{
int randomnum = GetRandomInt(0, sizeof(g_sSongList) - 1);
EmitSoundToAll(g_sSongList[randomnum][0]);
CPrintToChatAll("%s {default}Now is playing: {green}%s", g_sServerTag, g_sSongList[randomnum][1]);
}
__________________