Turf Problem
#1

Hi I have a litle problem with the save system for the turfs wen I attack and take over a turf It is not saved in the config I configurated to save the coordonates and the family name.

I am using : https://sampforum.blast.hk/showthread.php?tid=276352

I tried to do someting like this , but no result , please help :

Код:
public LoadTurfs()
{
	new arrCoords[6][64];
	new strFromFile2[256];
	new File: file = fopen("turfs.cfg", io_read);
	if (file)
	{
		new idx;
		while (idx < sizeof(ZoneInfo))
		{
			fread(file, strFromFile2);
			split(strFromFile2, arrCoords, '|');
			strmid(ZoneInfo[idx][zTeam], arrCoords[0], 0, strlen(arrCoords[0]), 255);
			ZoneInfo[idx][zMinX] = floatstr(arrCoords[2]);
			ZoneInfo[idx][zMinY] = floatstr(arrCoords[3]);
			ZoneInfo[idx][zMaxX] = floatstr(arrCoords[4]);
			ZoneInfo[idx][zMaxY] = floatstr(arrCoords[5]);
			//printf("Turf:%d Name: %s Owner:%s MinX:%f MinY:%f MinZ:%f MaxX:%f MaxY:%f MaxZ:%f\n",
			//idx,TurfInfo[idx][zName],TurfInfo[idx][zOwner],TurfInfo[idx][zMinX],TurfInfo[idx][zMinY],TurfInfo[idx][zMinZ],TurfInfo[idx][zMaxX],TurfInfo[idx][zMaxY],TurfInfo[idx][zMaxZ]);
			idx++;
		}
		fclose(file);
	}
	return 1;
}

public SaveTurfs()
{
	new idx;
	new File: file2;
	while (idx < sizeof(ZoneInfo))
	{
		new coordsstring[256];
		format(coordsstring, sizeof(coordsstring), "%s|%f|%f|%f|%f|%f|%f\n",
		ZoneInfo[idx][zTeam],
		ZoneInfo[idx][zMinX],
		ZoneInfo[idx][zMinY],
		ZoneInfo[idx][zMaxX],
		ZoneInfo[idx][zMaxY]);
		if(idx == 0)
		{
			file2 = fopen("turfs.cfg", io_write);
		}
		else
		{
			file2 = fopen("Configs/turfs.cfg", io_append);
		}
		fwrite(file2, coordsstring);
		idx++;
		fclose(file2);
	}
	return 1;
}
Can someone please help ?
Reply
#2

sorry for 2x post but can someone help me ?
Reply
#3

just remember to Create A Gangzone During Loading the Zone System of yours.
pawn Код:
new gangzone;
gangzone = GangZoneCreate(ZoneInfo[idx][zMinX],ZoneInfo[idx][zMinY],ZoneInfo[idx][zMaxX]ZoneInfo[idx][zMaxY]);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)