SA-MP Forums Archive
How to make a family using the families.cfg? - 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: How to make a family using the families.cfg? (/showthread.php?tid=82235)



How to make a family using the families.cfg? - Donnie_Viper - 17.06.2009

I don't seem to understand this yet, so I am going to ask, how do I turn this:
Код:
0|None|None|0xFF000069|None|0|0.0|0.0|0.0|0.0|0
into a family? Thanks.


Re: How to make a family using the families.cfg? - Grim_ - 17.06.2009

Go into your script and look at the (i beleive it is this) LoadFamilies and SaveFamilies callback. You'll see how they save the different variables into the file using the %s|%d|%f...... format, hince it is quite popular.


Re: How to make a family using the families.cfg? - Donnie_Viper - 17.06.2009

This?:
Код:
forward LoadFamilies();
forward SaveFamilies();



Re: How to make a family using the families.cfg? - Grim_ - 17.06.2009

Search in the script (CTR+F) for "public LoadFamilies". When you get there, look through the code and study how the used it to save the variables into the file, as they did.


Re: How to make a family using the families.cfg? - Donnie_Viper - 17.06.2009

Код:
public LoadFamilies()
{
	new arrCoords[11][64];
	new strFromFile2[256];
	new File: file = fopen("families.cfg", io_read);
	if (file)
	{
		new idx;
		while (idx < sizeof(FamilyInfo))
		{
			fread(file, strFromFile2);
			split(strFromFile2, arrCoords, '|');
			FamilyInfo[idx][FamilyTaken] = strval(arrCoords[0]);
			strmid(FamilyInfo[idx][FamilyName], arrCoords[1], 0, strlen(arrCoords[1]), 255);
			strmid(FamilyInfo[idx][FamilyMOTD], arrCoords[2], 0, strlen(arrCoords[2]), 255);
			strmid(FamilyInfo[idx][FamilyColor], arrCoords[3], 0, strlen(arrCoords[3]), 255);
			strmid(FamilyInfo[idx][FamilyLeader], arrCoords[4], 0, strlen(arrCoords[4]), 255);
			FamilyInfo[idx][FamilyMembers] = strval(arrCoords[5]);
			FamilyInfo[idx][FamilySpawn][0] = floatstr(arrCoords[6]);
			FamilyInfo[idx][FamilySpawn][1] = floatstr(arrCoords[7]);
			FamilyInfo[idx][FamilySpawn][2] = floatstr(arrCoords[8]);
			FamilyInfo[idx][FamilySpawn][3] = floatstr(arrCoords[9]);
			FamilyInfo[idx][FamilyInterior] = strval(arrCoords[10]);
			printf("Family:%d Taken: %d Name:%s MOTD:%s Leader:%s Members:%d SpawnX:%f SpawnY:%f SpawnZ:%f Int:%d",
			idx,FamilyInfo[idx][FamilyTaken],FamilyInfo[idx][FamilyName],FamilyInfo[idx][FamilyMOTD],FamilyInfo[idx][FamilyLeader],FamilyInfo[idx][FamilyMembers],FamilyInfo[idx][FamilySpawn][0],FamilyInfo[idx][FamilySpawn][1],FamilyInfo[idx][FamilySpawn][2],FamilyInfo[idx][FamilyInterior]);
			idx++;
		}
		fclose(file);
	}
	return 1;



Re: How to make a family using the families.cfg? - WardenCS - 17.06.2009

Quote:

FamilyInfo[idx][FamilyTaken],
FamilyInfo[idx][FamilyName],
FamilyInfo[idx][FamilyMOTD],
FamilyInfo[idx][FamilyColor],
FamilyInfo[idx][FamilyLeader],
FamilyInfo[idx][FamilyMembers],
FamilyInfo[idx][FamilySpawn][0],
FamilyInfo[idx][FamilySpawn][1],
FamilyInfo[idx][FamilySpawn][2],
FamilyInfo[idx][FamilySpawn][3],
FamilyInfo[idx][FamilyInterior]);




Re: How to make a family using the families.cfg? - Donnie_Viper - 17.06.2009

Does it help any that I'm using the Godfather?


Re: How to make a family using the families.cfg? - Grim_ - 17.06.2009

If you are asking howto make a new family do the follwoing:
open the file to where they save,
copy the last line, press enter, and paste it
Replace the information from that line with the new informatoin you want.


Re: How to make a family using the families.cfg? - Donnie_Viper - 17.06.2009

Deleted


Re: How to make a family using the families.cfg? - Donnie_Viper - 21.06.2009

(what do I put here?)|example name|(what's MOTD?)|(what code if for light blue?)|example player|0|0.0|0.0|0.0|0.0|0 Plz help with questions.