I'm trying to add on some code to a End Round Music plugin so it will display the title of the song and the artist. However no matter what I do I get an error message.
Error:
Code:
/groups/sourcemod/upload_tmp/textX7WO3V.sp(125) : error 033: array must be indexed (variable "musicfile")
Line of code that's broken:
Code:
(125) if (musicfile == "LARoundEnd/ermsong1.mp3"){
(126) PrintCenterTextAll("Song Title - Author");
(127) }
Function that's broken:
Code:
public Event_TeamPlayRoundWin(Handle:event, const String:name[], bool:dontBroadcast)
{
if (GetArraySize(g_Array_PerMapMusicFiles) == 0) {
return;
}
// play music
decl String:musicfile[PLATFORM_MAX_PATH];
GetArrayString(g_Array_PerMapMusicFiles, g_Cursor, musicfile, sizeof(musicfile));
decl String:playcmd[PLATFORM_MAX_PATH];
Format(playcmd, sizeof(playcmd), "play \"%s\"", musicfile);
for (new i = 1; i < MaxClients; i++) {
if (IsClientConnected(i) && IsClientInGame(i) && !IsFakeClient(i) &&
g_ClientCookies[i] == MUSIC_ENABLED)
{
//EmitSoundToClient(i, musicfile);
ClientCommand(i, playcmd);
}
}
g_Cursor++;
if (g_Cursor == GetArraySize(g_Array_PerMapMusicFiles)) {
g_Cursor = 0;
}
PrintToChatAll("musicfile: %s", musicfile);
if (musicfile == "LARoundEnd/ermsong1.mp3"){
PrintCenterTextAll("Song Title - Author");
}
}
How do I fix this problem? Let me know if there's any other parts of the code that you need.