This part of the code doesn't work
PHP Code:
public client_putinserver(id) {
new i
i = random_num(0,soundCount-1)
client_cmd(id,"mp3 play sound/mindtricks/%s",soundlist[i])
}
And full script:
PHP Code:
#include <amxmodx>
#define Maxsounds 10
new soundlist[Maxsounds][64]
new soundCount = 0
public plugin_init() {
register_plugin("Loading Music","0.9","Andrax2000")
return PLUGIN_CONTINUE
}
public plugin_precache() {
new dh
new nameFull[64], name[64], nameExt[32]
dh = open_dir("sound/mindtricks", nameFull, 63)
do
{
strtok(nameFull,name,63,nameExt,31,'.')
if (equali(nameExt, "mp3")) {
soundlist[soundCount] = name
soundCount++
}
}
while(soundCount<Maxsounds && next_file(dh, nameFull, 63))
close_dir(dh)
server_print("[AMXX LOADING MUSIC] Found %i mp3s", soundCount)
for (new i = 0; i < soundCount; i++)
{
format(name, 63, "sound/mindtricks/%s.mp3",soundlist[i])
precache_generic(name)
}
return PLUGIN_CONTINUE
}
public client_putinserver(id) {
new i
i = random_num(0,soundCount-1)
client_cmd(id,"mp3 play sound/mindtricks/%s",soundlist[i])
}
How to change this plugin to play music when player is already on server?
__________________