Raised This Month: $51 Target: $400
 12% 

Check if file already precached


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ironskillz1
AlliedModders Donor
Join Date: Jul 2012
Location: Sweden
Old 06-19-2014 , 20:30   Check if file already precached
Reply With Quote #1

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");
	}
}
__________________
I have many private and unique plugins for Jailbreak and Hide'N'Seek. PM me for more info.

Pm me.

Check out my roulette site.
ironskillz1 is offline
Send a message via Skype™ to ironskillz1
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 06-19-2014 , 20:33   Re: Check if file already precached
Reply With Quote #2

Each item can only be precached once, so if you try to do it twice, nothing will happen the second time
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
ironskillz1
AlliedModders Donor
Join Date: Jul 2012
Location: Sweden
Old 06-19-2014 , 20:52   Re: Check if file already precached
Reply With Quote #3

Okay good to know.
I misstake was the ini something wrong there.

Solved
__________________
I have many private and unique plugins for Jailbreak and Hide'N'Seek. PM me for more info.

Pm me.

Check out my roulette site.
ironskillz1 is offline
Send a message via Skype™ to ironskillz1
Reply



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 15:59.


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