Try using my plugin. You need to put the sounds in
. If it doesn't work - you did NOT convert them properly or you have the old ones in your game/server/downloadurl, so at least change their names.
Code:
#include <amxmodx>
#include <amxmisc>
#include <nvault>
#define PLUGIN_VERSION "2.2"
new const g_szPrefix[] = "^4[REMusic]^1"
new Array:g_aSounds,
g_iArraySize,
g_iVault,
g_iSound,
g_pRandom,
g_msgSayText
new g_iBlocked[33]
enum
{
TYPE_INVALID = 0,
TYPE_WAV,
TYPE_MP3
}
public plugin_init()
{
register_plugin("Round End Music", PLUGIN_VERSION, "OciXCrom")
register_cvar("REMusic", PLUGIN_VERSION, FCVAR_SERVER|FCVAR_SPONLY|FCVAR_UNLOGGED)
register_logevent("OnRoundEnd", 2, "1=Round_End")
register_clcmd("say /ers", "cmdMute")
register_clcmd("say_team /ers", "cmdMute")
g_pRandom = register_cvar("remusic_random", "1")
g_msgSayText = get_user_msgid("SayText")
g_iVault = nvault_open("REMusic")
}
public plugin_precache()
{
g_aSounds = ArrayCreate(32, 1)
fileRead()
}
public plugin_end()
ArrayDestroy(g_aSounds)
public client_putinserver(id)
{
g_iBlocked[id] = 0
UseVault(id, 1)
}
public client_disconnect(id)
UseVault(id, 0)
UseVault(id, iType)
{
new szAuthId[32], szData[2]
get_user_authid(id, szAuthId, charsmax(szAuthId))
switch(iType)
{
case 0:
{
num_to_str(g_iBlocked[id], szData, charsmax(szData))
nvault_set(g_iVault, szAuthId, szData)
}
case 1:
{
nvault_get(g_iVault, szAuthId, szData, charsmax(szData))
g_iBlocked[id] = str_to_num(szData)
}
}
}
public OnRoundEnd()
{
new szSound[32], iPlayers[32], iPnum, blRandom = get_pcvar_num(g_pRandom) == 1
ArrayGetString(g_aSounds, blRandom ? random(g_iArraySize) : g_iSound, szSound, charsmax(szSound))
get_players(iPlayers, iPnum)
new iType = get_sound_type(szSound)
for(new i; i < iPnum; i++)
{
if(g_iBlocked[iPlayers[i]] == 1)
ColorChat(iPlayers[i], "Round end sounds are turned off for you. Type ^3/ers ^1to enable them.")
else
client_cmd(iPlayers[i], "%s%s", iType == TYPE_WAV ? "spk " : "mp3 play ", szSound)
}
if(!blRandom)
{
g_iSound = g_iSound == g_iArraySize - 1 ? 0 : g_iSound + 1
client_print(0, print_chat, "%i", g_iSound)
}
}
public cmdMute(id)
{
g_iBlocked[id] = (g_iBlocked[id] == 1) ? 0 : 1
ColorChat(id, "Round end sounds have been ^3turned %s^1.", (g_iBlocked[id] == 1) ? "off" : "on")
return PLUGIN_HANDLED
}
fileRead()
{
new szConfigsName[256], szFilename[256]
get_configsdir(szConfigsName, charsmax(szConfigsName))
formatex(szFilename, charsmax(szFilename), "%s/REMusic.ini", szConfigsName)
new iFilePointer = fopen(szFilename, "rt")
if(iFilePointer)
{
new szData[128]
while(!feof(iFilePointer))
{
fgets(iFilePointer, szData, charsmax(szData))
trim(szData)
switch(szData[0])
{
case EOS, ';': continue
default:
{
switch(get_sound_type(szData))
{
case TYPE_WAV: precache_sound(szData)
case TYPE_MP3:
{
format(szData, charsmax(szData), "sound/%s", szData)
precache_generic(szData)
}
case TYPE_INVALID:
{
log_amx("Skipping invalid sound file: %s", szData)
continue
}
}
ArrayPushString(g_aSounds, szData)
}
}
}
g_iArraySize = ArraySize(g_aSounds)
fclose(iFilePointer)
}
}
get_sound_type(szSound[])
{
if(szSound[strlen(szSound) - 4] != '.')
return TYPE_INVALID
switch(szSound[strlen(szSound) - 1])
{
case 'v', 'V': return TYPE_WAV
case '3': return TYPE_MP3
}
return TYPE_INVALID
}
ColorChat(const id, const szInput[], any:...)
{
new iPlayers[32], iCount = 1
static szMessage[191]
vformat(szMessage, charsmax(szMessage), szInput, 3)
format(szMessage[0], charsmax(szMessage), "%s %s", g_szPrefix, szMessage)
replace_all(szMessage, charsmax(szMessage), "!g", "^4")
replace_all(szMessage, charsmax(szMessage), "!n", "^1")
replace_all(szMessage, charsmax(szMessage), "!t", "^3")
if(id)
iPlayers[0] = id
else
get_players(iPlayers, iCount, "ch")
for(new i; i < iCount; i++)
{
if(is_user_connected(iPlayers[i]))
{
message_begin(MSG_ONE_UNRELIABLE, g_msgSayText, _, iPlayers[i])
write_byte(iPlayers[i])
write_string(szMessage)
message_end()
}
}
}