02.08.2013, 14:29
I'm making some position saving system(a filterscript), in which a player can save multiple positions and teleport back to them.
Well, they are saving fine in the files, and if I quit the server and come back, the file is also loaded and I can teleport to my saved positions.
The problem is - if I close the server(After I quit), and re-open it, the file can no longer be read. The file hasn't changed, but the server doesn't read it and I can't teleport to the positions I've saved.
What could this be all about?
Saving the position:
Reading:
Well, they are saving fine in the files, and if I quit the server and come back, the file is also loaded and I can teleport to my saved positions.
The problem is - if I close the server(After I quit), and re-open it, the file can no longer be read. The file hasn't changed, but the server doesn't read it and I can't teleport to the positions I've saved.
What could this be all about?
Saving the position:
pawn Код:
new INI:File = INI_Open(PlayerPath(playerid));
INI_SetTag(File, "data");
format(str_tmp, sizeof(str_tmp), "X_%d", tmp2[playerid]);
INI_WriteFloat(File, str_tmp, pos_ACTUAL[playerid][tmp2[playerid]][0]);
format(str_tmp, sizeof(str_tmp), "Y_%d", tmp2[playerid]);
INI_WriteFloat(File, str_tmp, pos_ACTUAL[playerid][tmp2[playerid]][1]);
format(str_tmp, sizeof(str_tmp), "Z_%d", tmp2[playerid]);
INI_WriteFloat(File, str_tmp, pos_ACTUAL[playerid][tmp2[playerid]][2]);
format(str_tmp, sizeof(str_tmp), "A_%d", tmp2[playerid]);
INI_WriteFloat(File, str_tmp, pos_ACTUAL[playerid][tmp2[playerid]][3]);
format(str_tmp, sizeof(str_tmp), "Counter_%d", tmp2[playerid]);
INI_WriteInt(File, str_tmp, pos_COUNTER[playerid]);
format(str_tmp, sizeof(str_tmp), "Interior_%d", tmp2[playerid]);
INI_WriteInt(File, str_tmp, pos_INT[playerid][tmp2[playerid]]);
format(str_tmp, sizeof(str_tmp), "VirtualWorld_%d", tmp2[playerid]);
INI_WriteInt(File, str_tmp, pos_INT[playerid][tmp2[playerid]]);
format(str_tmp, sizeof(str_tmp), "Name_%d", tmp2[playerid]);
INI_WriteString(File, str_tmp, pos_NAME[playerid][tmp2[playerid]]);
format(str_tmp, sizeof(str_tmp), "Handler_%d", tmp2[playerid]);
INI_WriteInt(File, str_tmp, pos_Handler[playerid][tmp2[playerid]]);
INI_Close(File);
tmp2[playerid] = 0;
pawn Код:
public LoadPlayerPos_data(playerid,name[],value[])
{
new str_tmp[21];
for(new i = 0; i < MAX_SAVED_POSITIONS_PER_PLAYER; i++)
{
format(str_tmp, sizeof(str_tmp), "X_%d", i);
INI_Float(str_tmp, pos_ACTUAL[playerid][i][0]);
format(str_tmp, sizeof(str_tmp), "Y_%d", i);
INI_Float(str_tmp, pos_ACTUAL[playerid][i][1]);
format(str_tmp, sizeof(str_tmp), "Z_%d", i);
INI_Float(str_tmp, pos_ACTUAL[playerid][i][2]);
format(str_tmp, sizeof(str_tmp), "A_%d", i);
INI_Float(str_tmp, pos_ACTUAL[playerid][i][3]);
format(str_tmp, sizeof(str_tmp), "Counter_%d", i);
INI_Int(str_tmp, pos_COUNTER[playerid]);
format(str_tmp, sizeof(str_tmp), "Interior_%d", i);
INI_Int(str_tmp, pos_INT[playerid][i]);
format(str_tmp, sizeof(str_tmp), "VirtualWorld_%d", i);
INI_Int(str_tmp, pos_VW[playerid][i]);
format(str_tmp, sizeof(str_tmp), "Name_%d", i);
INI_String(str_tmp, pos_NAME[playerid][i], MAX_SAVE_POSITION_NAME_LENGTH);
format(str_tmp, sizeof(str_tmp), "Handler_%d", i);
INI_Int(str_tmp, pos_Handler[playerid][i]);
}
return 1;
}