y_ini - How to load created map
#5

Quote:
Originally Posted by Jefff
Посмотреть сообщение
save
pawn Код:
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);
load
pawn Код:
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);
It works, but when I restart a server the objects aren't loading.

Output in file is normal.


Here my code:
Код:
		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);
When I print the variables (Red = string, Green = stringg):
Reply


Messages In This Thread
y_ini - How to load created map - by Professional_Programmer - 28.03.2015, 02:37
Re: y_ini - How to load created map - by Jefff - 28.03.2015, 02:56
Re: y_ini - How to load created map - by Professional_Programmer - 28.03.2015, 03:00
Re: y_ini - How to load created map - by Jefff - 28.03.2015, 03:04
Re: y_ini - How to load created map - by Professional_Programmer - 28.03.2015, 19:20
Re: y_ini - How to load created map - by Jefff - 28.03.2015, 21:51
Re: y_ini - How to load created map - by Professional_Programmer - 28.03.2015, 21:59
Re: y_ini - How to load created map - by Jefff - 28.03.2015, 22:18
Re: y_ini - How to load created map - by Professional_Programmer - 29.03.2015, 04:01

Forum Jump:


Users browsing this thread: 1 Guest(s)