[help] Using Scriptfiles?
#1

can someone help with because on my new script im trying to make it so i can have a scoreboard type thign, but for this im gonna need either a database thing for my server or scriptfiles, so im gonna try to use scriptfiles.

i am looking at the GOdfather Families system and i need help on how i change these so there is just like 2 sections ' Name Of Gang / Kills '

This is what i put into my script as a base:

Код:
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;
}

public SaveFamilies()
{
	new idx;
	new File: file2;
	while (idx < sizeof(FamilyInfo))
	{
		new coordsstring[256];
		format(coordsstring, sizeof(coordsstring), "%d|%s|%s|%s|%s|%d|%f|%f|%f|%f|%d\n",
		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]);
		if(idx == 0)
		{
			file2 = fopen("families.cfg", io_write);
		}
		else
		{
			file2 = fopen("families.cfg", io_append);
		}
		fwrite(file2, coordsstring);
		idx++;
		fclose(file2);
	}
	return 1;
}
Код:
enum fInfo
{
	FamilyTaken,
	FamilyName[20],
	FamilyMOTD[128],
	FamilyColor[20],
	FamilyLeader[MAX_PLAYER_NAME],
	FamilyMembers,
	Float:FamilySpawn[4],
	FamilyInterior,
};
new FamilyInfo[10][fInfo];
Reply
#2

-> GF topic.
Reply
#3

How is it GF topic? its got nothing to do with GF, im just using code from it as a base
Reply
#4

Quote:
Originally Posted by Mowgli
How is it GF topic? its got nothing to do with GF, im just using code from it as a base
The code is from GF script and you are asking the question which is regarding to the GF.
Reply
#5

No, its regarding to the code which just happens to be in the GF script....Why are u saying 'go to gf topic' when u can just help me with this code when it doesnt really matter....If i ask how do i convert .map files to .pwn code, do u say 'Go ask in MTA forums?' no.

so if ur not gonna be helpful , just dont event comment..
Reply
#6

http://forum.sa-mp.com/index.php?topic=67900.0
Reply
#7

this scripting is not related to GF though... just the base of the code is, the thing i need help with Has nothing to do with GF
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)