24.01.2019, 14:54
The 3d label of the first index is not shown while it woks fine with other indices.
the 3d label of tree id 1 is not shown while it's fine with {2,...,max_trees} ( the object of tree id 1 is created )
I gave it a try and changed the function to:
( I created a custom 3d text label for the first index but i'm not satisfied by this solution :v)
-Thanks
PHP код:
public loadtrees()
{
print("Loading trees");
for(new g = 1; g < MAX_TREES; g++)
{
new LoadString[256];
format(LoadString, sizeof(LoadString), "/Trees/%d.dini.save", g);
if(dini_Exists(LoadString))
{
treeData[g][tID] = g;
treeData[g][tX] = dini_Float(LoadString,"tX");
treeData[g][tY] = dini_Float(LoadString,"tY");
treeData[g][tZ] = dini_Float(LoadString,"tZ");
treeData[g][tObject] = CreateObject(617, treeData[g][tX], treeData[g][tY], treeData[g][tZ], 0.0000, 0.0000, 0.0000); // tree
treeData[g][woodReady] = false;
treeData[g][tHealth] = 100;
new string2[80];
format(string2, sizeof(string2), "{ffff00}Tree\n/cuttree\nHealth: %i", treeData[g][tHealth]);
treeData[g][tLabel] = Create3DTextLabel(string2, COLOR_YELLOW, treeData[g][tX], treeData[g][tY], treeData[g][tZ] + 0.2 + 3.1117, 7.5, 0, 0);
treeData[g][tStatus] = true;
}
}
return 1;
}
I gave it a try and changed the function to:
PHP код:
forward loadtrees();
public loadtrees()
{
print("Loading trees");
for(new g = 1; g < MAX_TREES; g++)
{
new LoadString[256];
format(LoadString, sizeof(LoadString), "/Trees/%d.dini.save", g);
if(dini_Exists(LoadString))
{
treeData[g][tID] = g;
treeData[g][tX] = dini_Float(LoadString,"tX");
treeData[g][tY] = dini_Float(LoadString,"tY");
treeData[g][tZ] = dini_Float(LoadString,"tZ");
treeData[g][tObject] = CreateObject(617, treeData[g][tX], treeData[g][tY], treeData[g][tZ], 0.0000, 0.0000, 0.0000); // tree
treeData[g][woodReady] = false;
treeData[g][tHealth] = 100;
new string2[40];
format(string2, sizeof(string2), "{ffff00}Tree\n/cuttree\nHealth: %i", treeData[g][tHealth]);
treeData[g][tLabel] = Create3DTextLabel(string2, COLOR_YELLOW, treeData[g][tX], treeData[g][tY], treeData[g][tZ] + 0.2 + 3.1117, 7.5, 0, 0);
treeData[g][tStatus] = true;
}
}
new str[40];
format(str, sizeof(str), "{ffff00}Tree\n/cuttree\nHealth: %i", treeData[1][tHealth]);
treeData[1][tLabel] = Create3DTextLabel(str, COLOR_YELLOW, treeData[1][tX], treeData[1][tY], treeData[1][tZ] + 0.2 + 3.1117, 7.5, 0, 0);
return 1;
}
-Thanks