29.07.2012, 11:48
You had a break in the saving loop and you were trying to parse every objects' data from 1 object file.
I tried to fix it:
I tried to fix it:
pawn Код:
stock SaveObjects()
{
for(new i = 0, INI:Objects; i < MAX_CREATED_OBJECTS; i++)
{
Objects = INI_Open(ObjectFile(i));
INI_WriteFloat (Objects, "oX", ObjectInfo[i][oX]);
INI_WriteFloat (Objects, "oY", ObjectInfo[i][oY]);
INI_WriteFloat (Objects, "oZ", ObjectInfo[i][oZ]);
INI_WriteFloat (Objects, "rX", ObjectInfo[i][oRX]);
INI_WriteFloat (Objects, "rY", ObjectInfo[i][oRY]);
INI_WriteFloat (Objects, "rZ", ObjectInfo[i][oRZ]);
INI_Close(Objects);
}
return true;
}
stock LoadObjects()
{
for(new i = 0; i < MAX_CREATED_OBJECTS; i++)
{
INI_ParseFile(ObjectFile(i), "LoadCreatedObjects", .bExtra = true, .extra = i);
ObjectInfo[i][oObjectID] = CreateObjectEx(ObjectInfo[i][oModelID], ObjectInfo[i][oX], ObjectInfo[i][oY], ObjectInfo[i][oZ]);
ObjectInfo[i][oDescriptionLabel] = Create3DTextLabel(ObjectInfo[i][oDescription], COLOR_NICK, ObjectInfo[i][oX], ObjectInfo[i][oY], ObjectInfo[i][oZ], 100.0, 0);
}
return true;
}
forward LoadCreatedObjects(i, name[], value[]);
public LoadCreatedObjects(i, name[], value[])
{
if(!strcmp(name, "ModelID")) ObjectInfo[i][oModelID] = strval(value);
if(!strcmp(name, "oX")) ObjectInfo[i][oX] = floatstr(value);
if(!strcmp(name, "oY")) ObjectInfo[i][oY] = floatstr(value);
if(!strcmp(name, "oZ")) ObjectInfo[i][oZ] = floatstr(value);
if(!strcmp(name, "rX")) ObjectInfo[i][oRX] = floatstr(value);
if(!strcmp(name, "rY")) ObjectInfo[i][oRY] = floatstr(value);
if(!strcmp(name, "rZ")) ObjectInfo[i][oRZ] = floatstr(value);
return true;
}