Okay so i use this to load up my knifes in my ini.
And sometimes i use the same knife 2 times and the server crashes becuse of that.
Now to my question how can i check if the knife is already precached?
Code:
public plugin_precache( )
{
new cfgdir[64]
get_localinfo("amxx_configsdir", cfgdir, charsmax(cfgdir))
format(cfgdir, charsmax(cfgdir), "%s/levelmod.ini", cfgdir)
new file = fopen(cfgdir, "rt");
if( file )
{
new i = 0;
new szLevel[5], sfLineData[128];
while( !feof(file) && i < MaxLevels )
{
fgets(file, sfLineData, charsmax(sfLineData));
if( !sfLineData[0] || sfLineData[0] == ';' || sfLineData[0] == '/' && sfLineData[1] == '/' ) continue;
parse(sfLineData, szLevel, charsmax(szLevel), iLevelNames[i], charsmax(iLevelNames[]), iKnife[i][0], charsmax(iKnife[][]), iKnife[i][1], charsmax(iKnife[][]));
iLevels[i] = str_to_num(szLevel);
precache_model(iKnife[i][0]);
precache_model(iKnife[i][1]);
i++;
}
fclose(file);
}
else
{
set_fail_state("LevelMod configuration file does not exist");
}
}
__________________