Invalid function or declaration?
#1

I'm trying to add a new part of code to OnPropUpdate(), however I keep getting an error saying



This is my OnPropUpdate()

Код:
 public OnPropUpdate()
{

	new idx;
	new File: file2;
	while (idx < sizeof(BizzInfo))
	{
		new coordsstring[256];
		format(coordsstring, sizeof(coordsstring), "%d|%s|%s|%s|%f|%f|%f|%f|%f|%f|%d|%d|%d|%d|%d|%d|%d|%d|%d\n",
		BizzInfo[idx][bOwned],
		BizzInfo[idx][bOwner],
		BizzInfo[idx][bMessage],
		BizzInfo[idx][bExtortion],
		BizzInfo[idx][bEntranceX],
		BizzInfo[idx][bEntranceY],
		BizzInfo[idx][bEntranceZ],
		BizzInfo[idx][bExitX],
		BizzInfo[idx][bExitY],
		BizzInfo[idx][bExitZ],
		BizzInfo[idx][bLevelNeeded],
		BizzInfo[idx][bBuyPrice],
		BizzInfo[idx][bEntranceCost],
		BizzInfo[idx][bTill],
		BizzInfo[idx][bLocked],
		BizzInfo[idx][bInterior],
		BizzInfo[idx][bProducts],
		BizzInfo[idx][bMaxProducts],
		BizzInfo[idx][bPriceProd]);
		if(idx == 0)
		{
			file2 = fopen("bizz.cfg", io_write);
		}
		else
		{
			file2 = fopen("bizz.cfg", io_append);
		}
		fwrite(file2, coordsstring);
		idx++;
		fclose(file2);
	}
	return 1;
	}
	idx = 184;
 	while (idx < sizeof(CarInfo))
	{
		format(coordsstring, sizeof(coordsstring), "%d,%f,%f,%f,%f,%d,%d,%s,%s,%d,%s,%d,%d\n",
		CarInfo[idx][cModel],//
		CarInfo[idx][cLocationx],//
		CarInfo[idx][cLocationy],//
		CarInfo[idx][cLocationz],//
		CarInfo[idx][cAngle],//
		CarInfo[idx][cColorOne],//
		CarInfo[idx][cColorTwo],//
		CarInfo[idx][cOwner],//
		CarInfo[idx][cDescription],//
		CarInfo[idx][cValue],//
		CarInfo[idx][cLicense],//
		CarInfo[idx][cOwned],//
		CarInfo[idx][cLock]);
		if(idx == 184)
		{
			file2 = fopen("cars.cfg", io_write);
		}
		else
		{
			file2 = fopen("cars.cfg", io_append);
		}
		fwrite(file2, coordsstring);
		idx++;
		fclose(file2);
	}
	return 1;
 }
I'm trying to add the part, however I keep getting the errors above.
Код:
     
//17353 idx = 184;
 //17354 while (idx < sizeof(CarInfo))
	{
		format(coordsstring, sizeof(coordsstring), "%d,%f,%f,%f,%f,%d,%d,%s,%s,%d,%s,%d,%d\n",
		CarInfo[idx][cModel],//
		CarInfo[idx][cLocationx],//
		CarInfo[idx][cLocationy],//
		CarInfo[idx][cLocationz],//
		CarInfo[idx][cAngle],//
		CarInfo[idx][cColorOne],//
		CarInfo[idx][cColorTwo],//
		CarInfo[idx][cOwner],//
		CarInfo[idx][cDescription],//
		CarInfo[idx][cValue],//
		CarInfo[idx][cLicense],//
		CarInfo[idx][cOwned],//
		CarInfo[idx][cLock]); 
//17370	        if(idx == 184)
		{
			file2 = fopen("cars.cfg", io_write);
		}
//17374		else
		{
			file2 = fopen("cars.cfg", io_append);
		}
		fwrite(file2, coordsstring);
		idx++;
		fclose(file2);
	}
//17382	return 1;
}
Reply
#2

Helping you would be so much easier if you would mark the error lines in any way, e.g. adding
// <line number>
behind them.

1 more min of work for you can reduce the time that others need to spot the problem by 10 minutes.


Edit: Hm, looks like a bracket problem to me. Check if you set all brackets { } correctly. The invalid function errors can occur if you place code out of a function body.
Reply
#3

Hm, looks like a bracket problem to me. Check if you set all brackets { } correctly. The invalid function errors can occur if you place code out of a function body.

Edit: Sorry for doublepost, i forgot that I was the last poster. Please delete this post, i will edit the previous one.
Reply
#4

Sorry for my first post it was wrong, Mauzen wrote problem:
Код:
            fclose(file2);
	} //remove this
	return 1;
	}
	idx = 184;
 	while (idx < sizeof(CarInfo))
	{
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)