Stock Save objects, displays some errors.
#1

Hello, i'm working on a ingame mapping tool.


I wanted to create a stock, to save the objects.
This is what i have.

Код:
stock SaveObjects()
{
	new idx = 1, File:file;
	new string[256];
	while(idx < MAX_OBJ)
	{
	    format(string, sizeof(string), "%d|%f|%f|%f|%f|%f|%f|%f|%f|%f|%f|%f|%f\r\n",
		ObjInfo[idx][oModel],
		ObjInfo[idx][oCX],
		ObjInfo[idx][oCY],
		ObjInfo[idx][oCZ],
		ObjInfo[idx][oCRX],
		ObjInfo[idx][oCRY],
		ObjInfo[idx][oCRZ],
		ObjInfo[idx][oOX],
		ObjInfo[idx][oOY],
		ObjInfo[idx][oOZ],
		ObjInfo[idx][oORX],
		ObjInfo[idx][oORY],
		ObjInfo[idx][oORZ],

	    if(idx == 1)
	    {
	        file = fopen("objects.cfg", io_write);
	    }
	    else
	    {
	    	file = fopen("objects.cfg", io_append);
	    }
		fwrite(file, string);
		fclose(file);
		idx++;
	}
	print("Objects saved successfully.");
	return 1;
}
But then i got these errors.
Код:
(2160 -- 2175) : error 029: invalid expression, assumed zero
(2175 -- 2176) : error 029: invalid expression, assumed zero
(2179) : error 029: invalid expression, assumed zero
I should love it if someone could tell me the problem, or even could fix it!

Rep+
Reply
#2

You forgot to close the statement.

pawn Код:
stock SaveObjects()
{
    new idx = 1, File:file;
    new string[256];
    while(idx < MAX_OBJ)
    {
        format(string, sizeof(string), "%d|%f|%f|%f|%f|%f|%f|%f|%f|%f|%f|%f|%f\r\n",
        ObjInfo[idx][oModel],
        ObjInfo[idx][oCX],
        ObjInfo[idx][oCY],
        ObjInfo[idx][oCZ],
        ObjInfo[idx][oCRX],
        ObjInfo[idx][oCRY],
        ObjInfo[idx][oCRZ],
        ObjInfo[idx][oOX],
        ObjInfo[idx][oOY],
        ObjInfo[idx][oOZ],
        ObjInfo[idx][oORX],
        ObjInfo[idx][oORY],
        ObjInfo[idx][oORZ]);

        if(idx == 1)
        {
            file = fopen("objects.cfg", io_write);
        }
        else
        {
            file = fopen("objects.cfg", io_append);
        }
        fwrite(file, string);
        fclose(file);
        idx++;
    }
    print("Objects saved successfully.");
    return 1;
}
Reply
#3

Thanks.
Repped.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)