17.11.2013, 10:01
Hey all! I got a really big problem with saving my businesses. I've created 2 businesses while I was on local host, and here they are in scriptfiles:
After I have restarted server 2 times using gmx as rcon command, I got this:
Now the same 2 businesses are duplicated. I think my savebiz stock is bugged, so can someone please help me. This is the stock:
Код:
1|0|The State|-2530.523193|1378.588745|7.039062|0|0|0|1|200000|0|0| 2|0|The State|-2523.382324|1377.741455|7.039062|0|0|0|1|200000|0|0| 0|0||0.000000|0.000000|0.000000|0|0|0|0|0|0|0| 0|0||0.000000|0.000000|0.000000|0|0|0|0|0|0|0| 0|0||0.000000|0.000000|0.000000|0|0|0|0|0|0|0| . . .
Код:
1|0|The State|-2530.523193|1378.588745|7.039062|0|0|0|1|200000|0|0| 0|0|The State|-2530.523193|1378.588745|7.039062|0|0|0|1|200000|0|0| 2|0|The State|-2523.382324|1377.741455|7.039062|0|0|0|1|200000|0|0| 0|0|The State|-2523.382324|1377.741455|7.039062|0|0|0|1|200000|0|0| 0|0||0.000000|0.000000|0.000000|0|0|0|0|0|0|0| 0|0||0.000000|0.000000|0.000000|0|0|0|0|0|0|0|
pawn Код:
stock SaveBiz()
{
if(!fexist("biz.cfg")) fcreate("biz.cfg");
new idx = 1, File:file;
new string[256];
while(idx < MAX_BIZ)
{
format(string, sizeof(string), "%d|%d|%s|%f|%f|%f|%d|%d|%d|%d|%d|%d|%d|%s\r\n", BizInfo[idx][bType], BizInfo[idx][bStatus], BizInfo[idx][bOwner], BizInfo[idx][bX], BizInfo[idx][bY], BizInfo[idx][bZ], BizInfo[idx][bMoney], BizInfo[idx][bProducts], BizInfo[idx][bSold], BizInfo[idx][bLevel], BizInfo[idx][bPrice], BizInfo[idx][bAP], BizInfo[idx][bTake], BizInfo[idx][bName]);
if(idx == 1)
{
file = fopen("biz.cfg", io_write);
}
else
{
file = fopen("biz.cfg", io_append);
}
fwrite(file, string);
fclose(file);
idx++;
}
print("Businesses saved successfully.");
}