nacrotic
06-17-2007, 05:33 PM
#include <amxmodx>
#include <amxmisc>
#define PLUGIN "dod_FunSounds"
#define VERSION "1.0"
#define AUTHOR "N@CR0T!C"
#define MAX_SOUND 64
new g_soundName[MAX_SOUND][32]
new g_soundNums
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_cvar("FunSounds_SubFolder","FunSounds")
register_cvar("FunSounds_Remake","0")
modifspeech()
}
public plugin_precache() {
new sndfile[128]
new path[30]
new filename[128]
new soundPath [62]
get_cvar_string("FunSounds_SubFolder",path,29)
get_configsdir(sndfile,127)
format(filename,127,"%s/dod_funsounds.cfg",sndfile);
if (!file_exists(filename)){
return 0
}
new text[256]
new a , pos = 0
while (g_soundNums < MAX_SOUND && read_file(filename,pos++,text,255,a)){
if (text[0] == ';'){
continue
}
if (parse(text,g_soundName[g_soundNums],31) < 1){
continue
}
format(soundPath,61,"%s/%s.wav",path,g_soundName[g_soundNums])
precache_sound(soundPath)
g_soundNums++
}
return 1
}
public modifspeech()
{
if(get_cvar_num("FunSounds_Remake"))
{
new sndfile[128]
new path[30]
new filename[128]
new speechfile[128]
new soundPath [62]
new soundToWrite[96]
get_cvar_string("FunSounds_SubFolder",path,29)
get_configsdir(sndfile,127)
format(filename,127,"%s/dod_funsounds.cfg",sndfile);
format(speechfile,127,"%s/speech.ini",sndfile);
if (!file_exists(filename)){
return 0
}
new text[256]
new a , pos = 0
while (g_soundNums < MAX_SOUND && read_file(filename,pos++,text,255,a)){
if (text[0] == ';'){
continue
}
if (parse(text,g_soundName[g_soundNums],31) < 1){
continue
}
format(soundPath,61,"%s/%s.wav",path,g_soundName[g_soundNums])
if (!file_exists(speechfile)){
return 0
}
format(soundToWrite,95,"^"%s^" ^"spk \^'%s\^'^" ^"cd^" ^"u^"",g_soundName[g_soundNums],soundPath)
write_file ( speechfile, soundToWrite, 35 )
g_soundNums++
}
set_cvar_num("FunSounds_Remake",0)
}
return 1
}
In config dir th file dod_funsounds.cfg
alliesscore
axisscore
the sma compiled but not work
#include <amxmisc>
#define PLUGIN "dod_FunSounds"
#define VERSION "1.0"
#define AUTHOR "N@CR0T!C"
#define MAX_SOUND 64
new g_soundName[MAX_SOUND][32]
new g_soundNums
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_cvar("FunSounds_SubFolder","FunSounds")
register_cvar("FunSounds_Remake","0")
modifspeech()
}
public plugin_precache() {
new sndfile[128]
new path[30]
new filename[128]
new soundPath [62]
get_cvar_string("FunSounds_SubFolder",path,29)
get_configsdir(sndfile,127)
format(filename,127,"%s/dod_funsounds.cfg",sndfile);
if (!file_exists(filename)){
return 0
}
new text[256]
new a , pos = 0
while (g_soundNums < MAX_SOUND && read_file(filename,pos++,text,255,a)){
if (text[0] == ';'){
continue
}
if (parse(text,g_soundName[g_soundNums],31) < 1){
continue
}
format(soundPath,61,"%s/%s.wav",path,g_soundName[g_soundNums])
precache_sound(soundPath)
g_soundNums++
}
return 1
}
public modifspeech()
{
if(get_cvar_num("FunSounds_Remake"))
{
new sndfile[128]
new path[30]
new filename[128]
new speechfile[128]
new soundPath [62]
new soundToWrite[96]
get_cvar_string("FunSounds_SubFolder",path,29)
get_configsdir(sndfile,127)
format(filename,127,"%s/dod_funsounds.cfg",sndfile);
format(speechfile,127,"%s/speech.ini",sndfile);
if (!file_exists(filename)){
return 0
}
new text[256]
new a , pos = 0
while (g_soundNums < MAX_SOUND && read_file(filename,pos++,text,255,a)){
if (text[0] == ';'){
continue
}
if (parse(text,g_soundName[g_soundNums],31) < 1){
continue
}
format(soundPath,61,"%s/%s.wav",path,g_soundName[g_soundNums])
if (!file_exists(speechfile)){
return 0
}
format(soundToWrite,95,"^"%s^" ^"spk \^'%s\^'^" ^"cd^" ^"u^"",g_soundName[g_soundNums],soundPath)
write_file ( speechfile, soundToWrite, 35 )
g_soundNums++
}
set_cvar_num("FunSounds_Remake",0)
}
return 1
}
In config dir th file dod_funsounds.cfg
alliesscore
axisscore
the sma compiled but not work