SA-MP Forums Archive
Points Config Loading Error. - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Points Config Loading Error. (/showthread.php?tid=217354)



Points Config Loading Error. - MrScott - 27.01.2011

What's up?

Right, we put this Point system into our script the problem is, that the .cfg isn't right. We've tried to make our own, but honestly as dumb as it sounds; I've got no idea.
Anyway; We get no error in the actually script, it's like in-game it should say "The Materials Factory #1 is now available to capture" But it doesn't, it doesn't say the name of the capture point.

Here is the LoadPoints();
Код:
public LoadPoints()
{
	new arrCoords[8][64];
	new strFromFile2[256];
	new File: file = fopen("points.cfg", io_read);
	if (file)
	{
		new idx;
		while (idx < sizeof(Points))
		{
			fread(file, strFromFile2);
			split(strFromFile2, arrCoords, '|');
			Points[idx][Pointx] = floatstr(arrCoords[0]);
			Points[idx][Pointy] = floatstr(arrCoords[1]);
			Points[idx][Pointz] = floatstr(arrCoords[2]);
			Points[idx][Type] = strval(arrCoords[3]);
			Points[idx][Vulnerable] = strval(arrCoords[4]);
			strmid(Points[idx][Owner], arrCoords[5], 0, strlen(arrCoords[5]), 255);
			strmid(Points[idx][Name], arrCoords[6], 0, strlen(arrCoords[6]), 255);
			Points[idx][MatPoint] = strval(arrCoords[7]);
			printf("%s | Type:%d Owner:%s",Points[idx][Name],Points[idx][Type],Points[idx][Owner]);
			idx++;
		}
		fclose(file);
	}
	return 1;
}
Basically I need a configuration file based on that, but I have no idea on how to-do it.


Re: Points Config Loading Error. - MrScott - 29.01.2011

Bump - 48 Hours have gone.


Re: Points Config Loading Error. - iMonk3y - 29.01.2011

I'm not sure if I understood correctly what you're after.. but you could try this alternative:

pawn Код:
format(Points[idx][Owner], MAX_PLAYER_NAME, "%s", arrCoords[5]);
format(Points[idx][Name], 64, "%s", arrCoords[6]);
And maybe instead of .cfg use something like .txt .ini .sav etc..


Re: Points Config Loading Error. - MrScott - 30.01.2011

I'm sorry if I never put it well, believe me it's hard to explain. I will try again;
Right, when your in-game okay, and Paycheck comes along. Each point becomes available (within given time obvs). The problem is, say for example; Fossil Fuels is available it would say: "The Fossil Fuels has become available to capture".
Right, but the problem is, because I cannot make conf files it has not name so every paycheck and everytime you attempt to capture the point it says "The has become available to capture".

I hope this helps you understand a little.