Example on hw to precache .mp3 files :
PHP Code:
public plugin_precache() {
new configfile[64]
get_configsdir(configfile, 63)
format(configfile, 63, "%s/loadingsongs.ini", configfile)
// should be useless
// if(!file_exists(configfile))
// return
// g_Sounds = ArrayCreate(128)
new File = fopen(configfile, "rt")
if(!File)
return
new Text[256], Sound[128]
while(!feof(File))
{
fgets(File, Text, 255)
trim(Text)
if(!Text[0] || Text[0] == ';' || (Text[0] == '/' && Text[1] == '/'))
continue
parse(Text, Sound, 127)
if(!equali( Sound[strlen(Sound)-4], ".mp3"))
{
// log_amx("Fichier %s ne porte pas l'extension ^".mp3^"", Sound)
continue
}
if(!file_exists(Sound))
{
// log_amx("Fichier %s inexistant", Sound)
continue
}
// ArrayPushString(g_Sounds, Sound)
precache_generic(Sound)
}
fclose(File)
}
__________________