18.12.2017, 14:36
I have a problem with the objects
I made a mapper system in-game
the problem is when i load the objects it won't load
its save but it won't load ingame
I add LoadObjects OnGameModeInit
And I add CheckFiles also on gamemodeinit
I am using the latest version of streamer & sscanf.
Here is the code
I made a mapper system in-game
the problem is when i load the objects it won't load
its save but it won't load ingame
I add LoadObjects OnGameModeInit
And I add CheckFiles also on gamemodeinit
I am using the latest version of streamer & sscanf.
Here is the code
pawn Код:
stock LoadObjects()
{
new dinfo[15][128];
new string[256];
new File:file = fopen("objects.cfg", io_read);
if(file)
{
new idx = 1;
while(idx < MAX_OBJ)
{
fread(file, string);
split(string, dinfo, '|');
ObjInfo[idx][oModel] = strval(dinfo[0]);
ObjInfo[idx][oX] = floatstr(dinfo[1]);
ObjInfo[idx][oY] = floatstr(dinfo[2]);
ObjInfo[idx][oZ] = floatstr(dinfo[3]);
ObjInfo[idx][oRX] = floatstr(dinfo[4]);
ObjInfo[idx][oRY] = floatstr(dinfo[5]);
ObjInfo[idx][oRZ] = floatstr(dinfo[6]);
if(ObjInfo[idx][oModel]) // If gate exists
{
ObjInfo[idx][obj] = CreateDynamicObject(ObjInfo[idx][oModel], ObjInfo[idx][oX], ObjInfo[idx][oY], ObjInfo[idx][oZ], ObjInfo[idx][oRX], ObjInfo[idx][oRY], ObjInfo[idx][oRZ]);
format(string, sizeof(string), "Object ID: %d (Model ID: %d)", idx, ObjInfo[idx][oModel]);
ObjInfo[idx][oText] = CreateDynamic3DTextLabel(string, COLOR_WHITE, ObjInfo[idx][oX], ObjInfo[idx][oY], ObjInfo[idx][oZ], 10);
}
idx++;
}
}
print("Objects loaded successfully.");
return 1;
}
stock CheckFiles()
{
if(!dini_Exists("objects.cfg")) dini_Create("objects.cfg");
return 1;
}