SA-MP Forums Archive
Problem with loading buissnes - 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 loading buissnes (/showthread.php?tid=449406)



Problem with loading buissnes - Remba031 - 08.07.2013

So i have my business system and i need help with loading the stuff i scripted a function for saving the business to a text file but then i can't load them pickup's don't even create and there is no 3D Label!

This is what I have done to read the info about business:
Код:
stock LoadBiz()
{
		
		new File:file = fopen("biznisi.txt",io_read);
		new
  		line[512],
    	parts[16][32],
    	commentpos = -1,
  		count;
		while(fread(file,line) && count < sizeof(BiznisInfo))
		{
           	commentpos = strfind(line,"//",true);
            if(commentpos != 0)
            {
                if(commentpos != -1) strmid(line,line,0,commentpos);
                split(line,parts,',');
                BiznisInfo[count][BizX] = floatstr(parts[0]);
		        BiznisInfo[count][BizY] = floatstr(parts[1]);
		        BiznisInfo[count][BizZ] = floatstr(parts[2]);
		        strmid(BiznisInfo[count][bOwner],parts[3],1,strlen(parts[3]),128);
		        BiznisInfo[count][bPrice] = strval(parts[4]);
		        BiznisInfo[count][bID] = strval(parts[5]);
		        CreatePickup(1272,1,BiznisInfo[count][BizX],BiznisInfo[count][BizY],BiznisInfo[count][BizZ],BiznisInfo[count][bID]);
				new ownertxt[128];
				format(ownertxt,sizeof(ownertxt),"Biznis ID [ %d ] Vlasnik: %s",BiznisInfo[count][bID],BiznisInfo[count][bOwner]);
			 	Create3DTextLabel(ownertxt,0x008080FF,
			 	BiznisInfo[count][BizX],BiznisInfo[count][BizY], BiznisInfo[count][BizZ]+1,
			 	40.0, BiznisInfo[count][bID],0);
				count++;
				fclose(file);
			}
		}
		return 1;
}