7 posts,
3 people · 892 views
Thread Rating: ★★★★★
| closedPrecache sound don't work |
| Started by nacrotic on 06-17-2007, 04:33 PM |
N
nacrotic
Threads: 5
Joined: Aug 2006
started this thread
Posts: 16Threads: 5
Joined: Aug 2006
06-17-2007, 04:33 PM
#1
#include <amxmodx>n#include <amxmisc>nn#define PLUGIN "dod_FunSounds"n#define VERSION "1.0"n#define AUTHOR "N@CR0T!C"nn#define MAX_SOUND 64nnnew g_soundName[MAX_SOUND][32]nnew g_soundNumsnnpublic plugin_init() {n register_plugin(PLUGIN, VERSION, AUTHOR)n register_cvar("FunSounds_SubFolder","FunSounds")n register_cvar("FunSounds_Remake","0")n modifspeech()n n}nnpublic plugin_precache() {n new sndfile[128]n new path[30]n new filename[128]n new soundPath [62]n get_cvar_string("FunSounds_SubFolder",path,29)n get_configsdir(sndfile,127)n format(filename,127,"%s/dod_funsounds.cfg",sndfile);n if (!file_exists(filename)){n return 0n }n new text[256]n new a , pos = 0n while (g_soundNums < MAX_SOUND && read_file(filename,pos++,text,255,a)){n if (text[0] == ';'){n continuen }n if (parse(text,g_soundName[g_soundNums],31) < 1){n continuen }n format(soundPath,61,"%s/%s.wav",path,g_soundName[g_soundNums])n precache_sound(soundPath)n g_soundNums++n }n return 1n}nnpublic modifspeech()n{n n if(get_cvar_num("FunSounds_Remake"))n {n new sndfile[128]n new path[30]n new filename[128]n new speechfile[128]n new soundPath [62]n new soundToWrite[96]n get_cvar_string("FunSounds_SubFolder",path,29)n get_configsdir(sndfile,127)n format(filename,127,"%s/dod_funsounds.cfg",sndfile);n format(speechfile,127,"%s/speech.ini",sndfile);n if (!file_exists(filename)){n return 0n }n new text[256]n new a , pos = 0n while (g_soundNums < MAX_SOUND && read_file(filename,pos++,text,255,a)){n if (text[0] == ';'){n continuen }n if (parse(text,g_soundName[g_soundNums],31) < 1){n continuen }n format(soundPath,61,"%s/%s.wav",path,g_soundName[g_soundNums])n if (!file_exists(speechfile)){n return 0n }n format(soundToWrite,95,"^"%s^" ^"spk ^'%s^'^" ^"cd^" ^"u^"",g_soundName[g_soundNums],soundPath)n write_file ( speechfile, soundToWrite, 35 )n g_soundNums++n }n set_cvar_num("FunSounds_Remake",0)n }n return 1n}nnIn config dir th file dod_funsounds.cfgnalliesscorenaxisscorennthe sma compiled but not workposted here
Posts: 2,068Threads: 103
Joined: May 2005
06-17-2007, 09:28 PM
#2
not totally sure what that is supposed to even do lol.. looks a bit confusing..
H
Hell Phoenix
Threads: 17
Joined: Jan 2005
posted here
Posts: 201Threads: 17
Joined: Jan 2005
06-17-2007, 11:23 PM
#3
What is modifspeech? Also, how do you know its not precaching? It doesnt look like the plugin does anything besides precache some sounds.
N
nacrotic
Threads: 5
Joined: Aug 2006
started this thread
Posts: 16Threads: 5
Joined: Aug 2006
06-18-2007, 01:54 AM
#4
What is modifspeech?rnshort code to add new sound in speech.inirnrn
Also, how do you know its not precaching?rnany download at connexion ...rnrn
not totally sure what that is supposed to even do lol.. looks a bit confusing..rni would like precacheing sound specified in dod_funsounds.cfg for play ingame later ...
posted here
Posts: 2,068Threads: 103
Joined: May 2005
06-18-2007, 08:55 AM
#5
hmm seems kinda odd thing to do.. to use one config file.. to add stuff to another config file..nnif i get a chance this morning ill try looking into it (heh as in actually try running it :) heheh)
N
nacrotic
Threads: 5
Joined: Aug 2006
started this thread
Posts: 16Threads: 5
Joined: Aug 2006
06-18-2007, 09:32 AM
#6
ok thank diamond-optic
N
nacrotic
Threads: 5
Joined: Aug 2006
started this thread
Posts: 16Threads: 5
Joined: Aug 2006
06-19-2007, 07:25 AM
#7
My script work nownn
#include <amxmodx>n#include <amxmisc>nn#define PLUGIN "dod_FunSounds"n#define VERSION "2.0"n#define AUTHOR "N@CR0T!C"nn#define MAX_SOUND 64nnnew g_soundName[MAX_SOUND][32]nnew g_soundNumsnnew sndfile[128]nnew path[32]nnew filename[128]nnew soundPath [64]nnew text[256]nnew a , pos = 0nnpublic plugin_init() {n register_plugin(PLUGIN, VERSION, AUTHOR)n register_cvar("amx_funsounds_subfolder","FunSounds")n modifspeech()n n}nnpublic plugin_precache() {nn get_cvar_string("amx_funsounds_subfolder",path,31)n get_configsdir(sndfile,127)n format(filename,127,"%s/dod_funsounds.cfg",sndfile)n if (!file_exists(filename)){n return 0n }n elsen {n a=0n pos=0n g_soundNums=0n while (g_soundNums < MAX_SOUND && read_file(filename,pos++,text,255,a)){n if (text[0] == ';'){n continuen }n if (parse(text,g_soundName[g_soundNums],31) < 1){n continuen }n format(soundPath,63,"%s/%s.wav",path,g_soundName[g_soundNums])n log_amx("%s : precached ok",soundPath)n precache_sound(soundPath)n g_soundNums++n }n }n return PLUGIN_CONTINUEn}nnpublic modifspeech()n{n new speechfile[128]n new soundToWrite[96]n get_cvar_string("amx_funsounds_subfolder",path,31)n get_configsdir(sndfile,127)n format(filename,127,"%s/dod_funsounds.cfg",sndfile)n format(speechfile,127,"%s/speech.ini",sndfile)n if (!file_exists(filename)){n return 0n }n a=0n pos=0n while (g_soundNums < MAX_SOUND && read_file(filename,pos++,text,255,a)){n if (text[0] == ';'){n continuen }n if (parse(text,g_soundName[g_soundNums],31) < 1){n continuen }n format(soundPath,63,"%s/%s",path,g_soundName[g_soundNums])n if (!file_exists(speechfile)){n return 0n }n format(soundToWrite,95,"^"%s^" ^"spk ^'%s^'^" ^"cd^" ^"u^"",g_soundName[g_soundNums],soundPath)n log_amx("%s : write ok",g_soundName[g_soundNums])n write_file ( speechfile, soundToWrite, 35+g_soundNums )n g_soundNums++n }n set_cvar_num("amx_funsounds_speechremake",0)n return PLUGIN_CONTINUEn}
