file load D:
#1

hey guys^^
i want to load my races in lines

example: 343.4324,4353.2345,2342.4234
345.3244,2131.5435,43565.213
.
.
.

But i dunno how to do that =/

heres the loadcode:

Код:
public LoadRace(playerid,name[])
{
	new arrCoords[37][64];
	new racename[64];
	new strFromFile2[512];
	new strFromFile3[512];
	strmid(CurrentRace, name, 0, strlen(name), 255);
	format(racename, sizeof(racename), "Rennen/%s.race",name);
	new File: file = fopen(racename, io_read);
	if (file)
	{
		fread(file, strFromFile2);
		split(strFromFile2, arrCoords, ',');
		RaceInfo[r1][0] = floatstr(arrCoords[0]);
		RaceInfo[r1][1] = floatstr(arrCoords[1]);
		RaceInfo[r1][2] = floatstr(arrCoords[2]);
		RaceInfo[r2][0] = floatstr(arrCoords[3]);
		RaceInfo[r2][1] = floatstr(arrCoords[4]);
		RaceInfo[r2][2] = floatstr(arrCoords[5]);
		RaceInfo[r3][0] = floatstr(arrCoords[6]);
		RaceInfo[r3][1] = floatstr(arrCoords[7]);
		RaceInfo[r3][2] = floatstr(arrCoords[8]);
		RaceInfo[r4][0] = floatstr(arrCoords[9]);
		RaceInfo[r4][1] = floatstr(arrCoords[10]);
		RaceInfo[r4][2] = floatstr(arrCoords[11]);
		RaceInfo[r5][0] = floatstr(arrCoords[12]);
		RaceInfo[r5][1] = floatstr(arrCoords[13]);
		RaceInfo[r5][2] = floatstr(arrCoords[14]);
		RaceInfo[r6][0] = floatstr(arrCoords[15]);
		RaceInfo[r6][1] = floatstr(arrCoords[16]);
		RaceInfo[r6][2] = floatstr(arrCoords[17]);
		RaceInfo[r7][0] = floatstr(arrCoords[18]);
		RaceInfo[r7][1] = floatstr(arrCoords[19]);
		RaceInfo[r7][2] = floatstr(arrCoords[20]);
		RaceInfo[r8][0] = floatstr(arrCoords[21]);
		RaceInfo[r8][1] = floatstr(arrCoords[22]);
		RaceInfo[r8][2] = floatstr(arrCoords[23]);
		RaceInfo[r9][0] = floatstr(arrCoords[24]);
		RaceInfo[r9][1] = floatstr(arrCoords[25]);
		RaceInfo[r9][2] = floatstr(arrCoords[26]);
		RaceInfo[r10][0] = floatstr(arrCoords[27]);
		RaceInfo[r10][1] = floatstr(arrCoords[28]);
		RaceInfo[r10][2] = floatstr(arrCoords[29]);
		RaceInfo[r11][0] = floatstr(arrCoords[30]);
		RaceInfo[r11][1] = floatstr(arrCoords[31]);
		RaceInfo[r11][2] = floatstr(arrCoords[32]);
		strmid(RaceInfo[rName], arrCoords[33], 0, strlen(arrCoords[33]), 255);
		RaceInfo[rAngle] = floatstr(arrCoords[34]);
		RaceInfo[rBestms] = strval(arrCoords[35]);
		RaceInfo[rLaps] = strval(arrCoords[36]);
		fclose(file);
		format(strFromFile2, 512, "%s Rennen geladen!", name);
		format(strFromFile3, 512, "%s Race loaded!", name);
		ConvertTicks(RaceInfo[rBestms]);
		format(strFromFile2, 512, "RENNINFO: Rennen '%s' gestartet! (Highscore: %s | Zeit: %d:%02d.%02d0)",name,RaceInfo[rName],cmins,csecs,cmils);
		//
		format(strFromFile3, 512, "RACENEWS: Race '%s' has started! (Highscore: %s | Time: %d:%02d.%02d0)",name,RaceInfo[rName],cmins,csecs,cmils);
		SendLanguageMessageToAll(ORANGE, strFromFile2,strFromFile3);
	}
	else
	{
		if(playerid != 255)
		{
			print("RENNEN: Datei nicht gefunden!");
		}
	}
	return 1;
	}
its veryy important for me so plz help =/

cheerz
Reply
#2

nobody? D:
Reply
#3

Instead of
pawn Код:
format(racename, sizeof(racename), "Rennen/%s.race",name);
i think you have to use:
pawn Код:
format(racename, sizeof(racename), "\\Rennen\\%s.race", name);
Reply
#4

nah wrong i dont want another directory i want to load the race out of lines
ggg
rrrr
rrrrr
rrrrr
rrrrr
etc
Reply
#5

noone? Dx
Reply
#6

Maybe you should explain the problem?
Reply
#7

the only problem is that i want load the race out of lines so that every thing is on a new line :S
example:

435345.345345,345345.345345,345345.34545,
435345.345345,345345.345345,345345.34545,
435345.345345,345345.345345,345345.34545,
435345.345345,345345.345345,345345.34545,
435345.345345,345345.345345,345345.34545,
435345.345345,345345.345345,345345.34545,
435345.345345,345345.345345,345345.34545,
435345.345345,345345.345345,345345.34545,
435345.345345,345345.345345,345345.34545,
435345.345345,345345.345345,345345.34545,
435345.345345,345345.345345,345345.34545,
NoOne,
1223.5435,
0,

(only example)

but i dunno why i shall make it :S
Reply
#8

No you didn't get me.. what is the problem with your LoadRace function ?
Reply
#9

there is no problem outta that i can only add 11cps :/
Reply
#10

Quote:
Originally Posted by PawNFoX
there is no problem outta that i can only add 11cps :/
Copy and paste the
pawn Код:
RaceInfo[r11][0] = floatstr(arrCoords[30]);
RaceInfo[r11][1] = floatstr(arrCoords[31]);
RaceInfo[r11][2] = floatstr(arrCoords[32]);
Then rename it as neccisary, Then for every 1 CP you add, add 3 to this variable
pawn Код:
new arrCoords[37][64];
e.g. to add one checkpoint i would need to change it to this
pawn Код:
new arrCoords[40][64];
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)