Doesn't want to read arenas.cfg from scriptfiles.
#1

Hi, i have Paintball arena system in my old script, and i copyed it into the my new gamemode, i did everything and it doesn't want to from read saved file (arenas.cfg).
I have everything, and in my old script it's working, and in one more script, but on these script it doesn't work, I dont know why.

codes for reading and saving:
Code:
 
LoadPaintballArenas()
{
	new arrCoords[53][64];
	new strFromFile[2048];
	new File: file = fopen("arenas.cfg", io_read);
	if(file)
	{
	    new idx;
	    while (idx < sizeof(PaintBallArena))
	    {
	        fread(file, strFromFile);
	        splits(strFromFile, arrCoords, '|');
	        strmid(PaintBallArena[idx][pbArenaName], arrCoords[0], 0, strlen(arrCoords[0]), 64);
			PaintBallArena[idx][pbVirtual] = strval(arrCoords[1]);
			PaintBallArena[idx][pbInterior] = strval(arrCoords[2]);
			PaintBallArena[idx][pbDeathmatch1][0] = floatstr(arrCoords[3]);
			PaintBallArena[idx][pbDeathmatch1][1] = floatstr(arrCoords[4]);
			PaintBallArena[idx][pbDeathmatch1][2] = floatstr(arrCoords[5]);
			PaintBallArena[idx][pbDeathmatch1][3] = floatstr(arrCoords[6]);
			PaintBallArena[idx][pbDeathmatch2][0] = floatstr(arrCoords[7]);
			PaintBallArena[idx][pbDeathmatch2][1] = floatstr(arrCoords[8]);
			PaintBallArena[idx][pbDeathmatch2][2] = floatstr(arrCoords[9]);
			PaintBallArena[idx][pbDeathmatch2][3] = floatstr(arrCoords[10]);
			PaintBallArena[idx][pbDeathmatch3][0] = floatstr(arrCoords[11]);
			PaintBallArena[idx][pbDeathmatch3][1] = floatstr(arrCoords[12]);
			PaintBallArena[idx][pbDeathmatch3][2] = floatstr(arrCoords[13]);
			PaintBallArena[idx][pbDeathmatch3][3] = floatstr(arrCoords[14]);
            PaintBallArena[idx][pbDeathmatch4][0] = floatstr(arrCoords[15]);
			PaintBallArena[idx][pbDeathmatch4][1] = floatstr(arrCoords[16]);
			PaintBallArena[idx][pbDeathmatch4][2] = floatstr(arrCoords[17]);
			PaintBallArena[idx][pbDeathmatch4][3] = floatstr(arrCoords[18]);
			PaintBallArena[idx][pbTeamRed1][0] = floatstr(arrCoords[19]);
			PaintBallArena[idx][pbTeamRed1][1] = floatstr(arrCoords[20]);
			PaintBallArena[idx][pbTeamRed1][2] = floatstr(arrCoords[21]);
			PaintBallArena[idx][pbTeamRed1][3] = floatstr(arrCoords[22]);
			PaintBallArena[idx][pbTeamRed2][0] = floatstr(arrCoords[23]);
			PaintBallArena[idx][pbTeamRed2][1] = floatstr(arrCoords[24]);
			PaintBallArena[idx][pbTeamRed2][2] = floatstr(arrCoords[25]);
			PaintBallArena[idx][pbTeamRed2][3] = floatstr(arrCoords[26]);
			PaintBallArena[idx][pbTeamRed3][0] = floatstr(arrCoords[27]);
			PaintBallArena[idx][pbTeamRed3][1] = floatstr(arrCoords[28]);
			PaintBallArena[idx][pbTeamRed3][2] = floatstr(arrCoords[29]);
			PaintBallArena[idx][pbTeamRed3][3] = floatstr(arrCoords[30]);
			PaintBallArena[idx][pbTeamBlue1][0] = floatstr(arrCoords[31]);
			PaintBallArena[idx][pbTeamBlue1][1] = floatstr(arrCoords[32]);
			PaintBallArena[idx][pbTeamBlue1][2] = floatstr(arrCoords[33]);
			PaintBallArena[idx][pbTeamBlue1][3] = floatstr(arrCoords[34]);
			PaintBallArena[idx][pbTeamBlue2][0] = floatstr(arrCoords[35]);
			PaintBallArena[idx][pbTeamBlue2][1] = floatstr(arrCoords[36]);
			PaintBallArena[idx][pbTeamBlue2][2] = floatstr(arrCoords[37]);
   			PaintBallArena[idx][pbTeamBlue2][3] = floatstr(arrCoords[38]);
   			PaintBallArena[idx][pbTeamBlue3][0] = floatstr(arrCoords[39]);
   			PaintBallArena[idx][pbTeamBlue3][1] = floatstr(arrCoords[40]);
   			PaintBallArena[idx][pbTeamBlue3][2] = floatstr(arrCoords[41]);
   			PaintBallArena[idx][pbTeamBlue3][3] = floatstr(arrCoords[42]);
   			PaintBallArena[idx][pbFlagRedSpawn][0] = floatstr(arrCoords[43]);
			PaintBallArena[idx][pbFlagRedSpawn][1] = floatstr(arrCoords[44]);
			PaintBallArena[idx][pbFlagRedSpawn][2] = floatstr(arrCoords[45]);
			PaintBallArena[idx][pbFlagBlueSpawn][0] = floatstr(arrCoords[46]);
			PaintBallArena[idx][pbFlagBlueSpawn][1] = floatstr(arrCoords[47]);
			PaintBallArena[idx][pbFlagBlueSpawn][2] = floatstr(arrCoords[48]);
			PaintBallArena[idx][pbHillX] = floatstr(arrCoords[49]);
			PaintBallArena[idx][pbHillY] = floatstr(arrCoords[50]);
			PaintBallArena[idx][pbHillZ] = floatstr(arrCoords[51]);
			PaintBallArena[idx][pbHillRadius] = floatstr(arrCoords[52]);

	        printf( "Paintball Arena %d ucitana", idx+1);
	        idx++;
		}
		fclose(file);
	}
	return 1;
}
InitPaintballArenas()
{
    new string[64];
	for(new i = 0; i < MAX_ARENAS; i++)
	{
	    format(string, sizeof(string), "Slobodna");
		strmid(PaintBallArena[i][pbOwner], string, 0, strlen(string), 64);

		format(string, sizeof(string), "Nema");
		strmid(PaintBallArena[i][pbPassword], string, 0, strlen(string), 64);

	    PaintBallArena[i][pbGameType] = 1;
  		PaintBallArena[i][pbActive] = 0;
  		PaintBallArena[i][pbExploitPerm] = 0;
  		PaintBallArena[i][pbFlagInstagib] = 0;
  		PaintBallArena[i][pbFlagNoWeapons] = 0;
  		PaintBallArena[i][pbTimeLeft] = 900;
  		PaintBallArena[i][pbHealth] = 100;
   		PaintBallArena[i][pbArmor] = 0;
   		PaintBallArena[i][pbLocked] = 0;
		PaintBallArena[i][pbLimit] = 16;
		PaintBallArena[i][pbPlayers] = 0;
		PaintBallArena[i][pbTeamRed] = 0;
		PaintBallArena[i][pbTeamBlue] = 0;
		PaintBallArena[i][pbBidMoney] = 0;
		PaintBallArena[i][pbMoneyPool] = 0;
		PaintBallArena[i][pbWeapons][0] = 24;
		PaintBallArena[i][pbWeapons][1] = 29;
		PaintBallArena[i][pbWeapons][2] = 31;
		PaintBallArena[i][pbHillX] = 0.0;
		PaintBallArena[i][pbHillY] = 0.0;
		PaintBallArena[i][pbHillZ] = 0.0;
		PaintBallArena[i][pbHillRadius] = 0.0;
	}
	return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)