SA-MP Forums Archive
Problem with deleting file - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Problem with deleting file (/showthread.php?tid=658284)



Problem with deleting file [NOT SOLVED]!!!!! - ShadowCoder - 31.08.2018

Код:
YCMD:deletebusiness(playerid, params[], help)
{
	#pragma unused help
	new id;
	if(sscanf(params, "i", id)) return SendClientMessage(playerid, 0xC0C0C0FF, "USAGE: /deletebusiness [id]");
	
	new ffile[40];
	format(ffile, sizeof(ffile), BUSINESS_PATH, id);
	
        if(!fexist(ffile)) return SendClientMessage(playerid, 0xC0C0C0FF, "That business doesn't exist.");

	DestroyDynamicPickup(BusinessInfo[id][EnterancePickup]);
	Delete3DTextLabel(BusinessInfo[id][Label]);

	fremove(ffile);
	
	new str1[40];
	for(new h = 1; h < sizeof(BusinessInfo); h++)
	{
		format(str1, sizeof(str1), BUSINESS_PATH, h);
		INI_ParseFile(str1, "LoadBusinesses_%s", .bExtra = true, .extra = h );
	}
	
	for(new j = 1; j < sizeof(BusinessInfo); j++)
	{
		if(BusinessInfo[j][Price] == 0) break;
		SaveBusiness(j);
	}
	
	new msg[128];
	format(msg,sizeof(msg),"You've successfully deleted Business (ID: %i)!",id);
	SendClientMessage(playerid,0xFCC937FF,msg);
	return 1;
}
It deletes pickup and label but it do not delete ini file what's a problem? i am struggling with it more then 1 hour!!!


Re: Problem with deleting file - ShadowCoder - 31.08.2018

Anyone? XD


Re: Problem with deleting file - solstice_ - 31.08.2018

Quote:

No Double Posting - There is a modify button , use it. However, bumping a topic in which you have or require further information is allowed after at least 24 hours.

Don't bump your topic in 10 minutes after posting your topic, just be patient and wait for a response from someone.


Re: Problem with deleting file - Shinja - 31.08.2018

How are you defining BUSINESS_PATH ?


Re: Problem with deleting file - ShadowCoder - 31.08.2018

Yes i did
#define BUSINESS_PATH "/Businesses/%i.ini"


Re: Problem with deleting file - Shinja - 31.08.2018

You must fclose before fremove


Re: Problem with deleting file - ShadowCoder - 31.08.2018

But i do not open it?