Stock Save objects, displays some errors. - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Stock Save objects, displays some errors. (
/showthread.php?tid=415125)
Stock Save objects, displays some errors. -
faff - 11.02.2013
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+
Re: Stock Save objects, displays some errors. - T0pAz - 11.02.2013
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;
}
Re: Stock Save objects, displays some errors. -
faff - 11.02.2013
Thanks.
Repped.