here have this my script:
Code:
#include <amxmod>
#include <amxmisc>
public plugin_init(){
register_plugin("Play added Sounds Managment","0.9.9","graczu")
register_concmd("amx_play","cmdPlay",ADMIN_CHAT,"- play sound: amx_play soundfilename from sound/misc/")
register_concmd("amx_playshow","cmdDzwieki",0,"- show list of added sounds")
}
public cmdPlay(id,level,cid){
if (!cmd_access(id,level,cid,2))
return PLUGIN_HANDLED
new message[192], name[32],authid[32],forma[128]
read_args(message,191)
remove_quotes(message)
get_user_authid(id,authid,31)
get_user_name(id,name,31)
format(forma, 127, "sound/misc/%s.wav", message)
if (file_exists(forma)){
client_cmd(0,"spk misc/%s.wav",message)
client_print(0,print_chat,"[Play: %s : %s ]",name,message)
} else {
client_print(0,print_chat,"[Play: %s : %s - brak pliku ]",name,forma)
}
return PLUGIN_HANDLED
}
public cmdDzwieki(id) {
new motdfile[64], motd[128]
new nextline=0
new txtlen
while((nextline = read_file("addons/amxmodx/configs/sound.txt",nextline,motdfile,63,txtlen))){
format(motd, 127, "- amx_play %s", motdfile)
console_print(id,motd)
}
}
public plugin_precache() {
new soundfile[64], sound[128]
new nextline=0
new txtlen
while((nextline = read_file("addons/amxmodx/configs/sound.txt",nextline,soundfile,63,txtlen))){
format(sound, 127, "misc/%s.wav", soundfile)
precache_sound(sound)
}
}
insert sound files to upload and be able to play in:
addons/amxmodx/configs/sound.txt
just names of files without .wav
insert files in: sound/misc/ (serverside)
when game:
amx_play soundname << to play sound
amx_playshow to see files in sound.txt