new INI:ini_doeMap = INI_Open(mapName); for(new i = 0; i < doe_Index + 1; i++) { new stringName[30], stringParams[256]; format(stringName, sizeof(stringName), "doe_Object[%i]", i); format(stringParams, sizeof(stringParams), "CreateObject(%i, %f, %f, %f, %f, %f, %f);", DOE[i][DOE_ModelID], DOE[i][DOE_X], DOE[i][DOE_Y], DOE[i][DOE_Z], DOE[i][DOE_rX], DOE[i][DOE_rY], DOE[i][DOE_rZ]); INI_WriteString(ini_doeMap, stringName, stringParams); } INI_Close(ini_doeMap);
doe_Object[1] = CreateObject(3035, -2003.729370, 433.925506, 35.015625, 0, 0, 0); doe_Object[2] = CreateObject(3035, -1998.181884, 438.433471, 35.637966, 0, 0, 0); doe_Object[3] = CreateObject(3034, -2005.000488, 444.294250, 35.015625, 0, 0, 0); doe_Object[4] = CreateObject(3036, -1997.110839, 444.868347, 35.015625, 0, 0, 0); doe_Object[5] = CreateObject(3034, -2005.863647, 449.276489, 35.015625, 0, 0, 0); doe_Object[6] = CreateObject(3034, -2005.863647, 449.276489, 35.015625, 0, 0, 0); doe_Object[7] = CreateObject(3034, -2005.863647, 449.276489, 35.015625, 0, 0, 0); doe_Object[8] = CreateObject(3034, -2000.441772, 454.467773, 35.015625, 0, 0, 0);
Show 'mapName', use standard file system and why you starts from 1 ?
new i = 1; |
new stringParams[150];
new File:ini_doeMap = fopen(mapName, io_write);
for(new i = 1; i < doe_Index + 1; i++)
{
format(stringParams, sizeof(stringParams), "CreateObject(%i,%.4f,%.4f,%.4f,%.4f,%.4f,%.4f);\r\n", DOE[i][DOE_ModelID], DOE[i][DOE_X], DOE[i][DOE_Y], DOE[i][DOE_Z], DOE[i][DOE_rX], DOE[i][DOE_rY], DOE[i][DOE_rZ]);
fwrite(ini_doeMap, stringParams);
}
fclose(ini_doeMap);
new string[128],i = 1;
new File:ini_doeMap = fopen(mapName, io_read);
while(i < sizeof(DOE) && fread(ini_doeMap, string))
{
sscanf(string,"'('p<,>ifffffp<)>f",DOE[i][DOE_ModelID], DOE[i][DOE_X], DOE[i][DOE_Y], DOE[i][DOE_Z], DOE[i][DOE_rX], DOE[i][DOE_rY], DOE[i][DOE_rZ]);
doe_Object[i] = CreateObject(DOE[i][DOE_ModelID], DOE[i][DOE_X], DOE[i][DOE_Y], DOE[i][DOE_Z], DOE[i][DOE_rX], DOE[i][DOE_rY], DOE[i][DOE_rZ]);
i++;
}
fclose(ini_doeMap);
save
pawn Код:
pawn Код:
|
new string[256],i = 0; if(!fexist(mapName)) return SendClientMessage(playerid, c_red, "Tento soubor neexistuje!"); new File:ini_doeMap = fopen(mapName, io_read); while(i < sizeof(DOE) && fread(ini_doeMap, string)) { sscanf(string,"'('p<,>iffffffp<)>f", DOE[i][DOE_ModelID], DOE[i][DOE_X], DOE[i][DOE_Y], DOE[i][DOE_Z], DOE[i][DOE_rX], DOE[i][DOE_rY], DOE[i][DOE_rZ]); doe_Object[doe_Index] = CreateObject(DOE[i][DOE_ModelID], DOE[i][DOE_X], DOE[i][DOE_Y], DOE[i][DOE_Z], DOE[i][DOE_rX], DOE[i][DOE_rY], DOE[i][DOE_rZ]); SendClientMessage(playerid, c_ltgreen, string); new stringg[256]; SendFormatMsg(playerid, c_red, stringg, "doe_Object[%i/%i] = %f, %f, %f, %f, %f, %f", doe_Index, i, DOE[i][DOE_ModelID], DOE[i][DOE_X], DOE[i][DOE_Y], DOE[i][DOE_Z], DOE[i][DOE_rX], DOE[i][DOE_rY], DOE[i][DOE_rZ]); i++; doe_Index++; } fclose(ini_doeMap);
sscanf(string,"'('p<,>ifffffp<)>f", DOE[i][DOE_ModelID], DOE[i][DOE_X], DOE[i][DOE_Y], DOE[i][DOE_Z], DOE[i][DOE_rX], DOE[i][DOE_rY], DOE[i][DOE_rZ]); doe_Object[doe_Index] = CreateObject(DOE[i][DOE_ModelID], DOE[i][DOE_X], DOE[i][DOE_Y], DOE[i][DOE_Z], DOE[i][DOE_rX], DOE[i][DOE_rY], DOE[i][DOE_rZ]);