Quote:
#include <amxmodx>
#define MaxSounds 4
new soundlist[MaxSounds][] =
{
"sound/loading/sound_1",
"sound/loading/sound_2",
"sound/loading/sound_3",
"sound/loading/sound_4"
}
public plugin_init()
{
register_plugin("Loading Sound", "1.5", "Sutar")
}
public client_connect(id)
{
client_cmd(id, "mp3 play %s", soundlist[random_num(0, MaxSounds)])
return PLUGIN_CONTINUE
}
public plugin_precache()
{
for(new i = 0; i < MaxSounds; i++)
{
if(!file_exists(soundlist[i]))
{
new path[75]
format(path, 74, "%s.mp3", soundlist[i])
precache_generic(path)
}
}
return PLUGIN_CONTINUE
}
|
Here everything seems right, but an error in line 20
line 20:
Quote:
|
client_cmd(id, "mp3 play %s", soundlist[random_num(0, MaxSounds)])
|
if you do "MaxSounds - 1". All is well, but the last sound will not play. What is wrong?