Raised This Month: $ Target: $400
 0% 

Problem precaching + reading file.


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
hlstriker
Green Gaben
Join Date: Mar 2006
Location: OH-IO!
Old 01-14-2007 , 22:55   Problem precaching + reading file.
Reply With Quote #1

Hi, I am trying to have my plugin read a sound filename from a file, then precache that sound.

Here is the code:
Code:
new saveFile[128]; new configsDir[128]; public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR);     get_configsdir(configsDir, 127);     format(saveFile, 127, "%s/mpn.ini", configsDir); } public plugin_precache() {     new file = fopen(saveFile, "r");     new data[256];         if(file) {         while(!feof(file)) {             fgets(file, data, 255); // Get the current line                         // Break the line into 2 parts, get the 2nd part and rem quotes             new left[128], right[128];             strbreak(data, left, 127, right, 127);             remove_quotes(right);                         new output[128];             if(containi(right, ".wav") > -1) {                 // Precache wav file                 format(output, 127, "themes/%s", right);                 precache_sound(output);             } else if(containi(right, ".mp3") > -1) {                 // Precache mp3 file                 format(output, 127, "sound/themes/%s", right);                 precache_generic(output);             }         }     }     fclose(file); }

Here is the file it's reading from (note the steam ids are for other parts of the plugin):
Quote:
"STEAM_xxxxxxx" "testwav.wav"
"STEAM_xxxxx" "testmp3.mp3"
hlstriker is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 22:29.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode