Hello everyone I was trying to make an apple tree using the model preview textdraws but it sometimes look fine sometimes it's messed up almost like it has a mind of its own.
Here are a couple of pictures:
Good tree:
Bad tree:
This is how I create the trees:
This is how I show the tree:
This is how I hide the tree:
I basically create the textdraws on demand then destroy them when I'm done to kind of "stream" them. I tried doing it the usual way (Creating it once then just show them and hide them without destroying them) and I had the same issue.
Here are a couple of pictures:
Good tree:
Bad tree:
This is how I create the trees:
Code:
AppleBGTD[playerid] = CreatePlayerTextDraw(playerid, 207.777770, 97.911125, "box");
PlayerTextDrawLetterSize(playerid, AppleBGTD[playerid], 0.000000, 25.869667);
PlayerTextDrawTextSize(playerid, AppleBGTD[playerid], 414.000000, 0.000000);
PlayerTextDrawColor(playerid, AppleBGTD[playerid], -1);
PlayerTextDrawUseBox(playerid, AppleBGTD[playerid], 1);
PlayerTextDrawBoxColor(playerid, AppleBGTD[playerid], 170);
PlayerTextDrawBackgroundColor(playerid, AppleBGTD[playerid], 85);
PlayerTextDrawFont(playerid, AppleBGTD[playerid], 1);
PlayerTextDrawSetProportional(playerid, AppleBGTD[playerid], 1);
AppleTreeTD[playerid] = CreatePlayerTextDraw(playerid, 121.444496, 92.777809, "");
PlayerTextDrawTextSize(playerid, AppleTreeTD[playerid], 366.000000, 228.000000);
PlayerTextDrawColor(playerid, AppleTreeTD[playerid], -1);
PlayerTextDrawBackgroundColor(playerid, AppleTreeTD[playerid], 0);
PlayerTextDrawFont(playerid, AppleTreeTD[playerid], 5);
PlayerTextDrawSetPreviewModel(playerid, AppleTreeTD[playerid], 673);
PlayerTextDrawSetPreviewRot(playerid, AppleTreeTD[playerid], 0.000000, 0.000000, 0.000000, 0.800000);
AppleTreeApplesTD[0][playerid] = CreatePlayerTextDraw(playerid, 323.666809, 101.737792, "");
PlayerTextDrawTextSize(playerid, AppleTreeApplesTD[0][playerid], 39.000000, 43.000000);
PlayerTextDrawAlignment(playerid, AppleTreeApplesTD[0][playerid], 1);
PlayerTextDrawColor(playerid, AppleTreeApplesTD[0][playerid], -1);
PlayerTextDrawBackgroundColor(playerid, AppleTreeApplesTD[0][playerid], 0);
PlayerTextDrawFont(playerid, AppleTreeApplesTD[0][playerid], 5);
PlayerTextDrawSetSelectable(playerid, AppleTreeApplesTD[0][playerid], true);
PlayerTextDrawSetPreviewModel(playerid, AppleTreeApplesTD[0][playerid], 19575);
AppleTreeApplesTD[1][playerid] = CreatePlayerTextDraw(playerid, 293.444488, 94.768913, "");
PlayerTextDrawTextSize(playerid, AppleTreeApplesTD[1][playerid], 39.000000, 43.000000);
PlayerTextDrawAlignment(playerid, AppleTreeApplesTD[1][playerid], 1);
PlayerTextDrawColor(playerid, AppleTreeApplesTD[1][playerid], -1);
PlayerTextDrawBackgroundColor(playerid, AppleTreeApplesTD[1][playerid], 0);
PlayerTextDrawFont(playerid, AppleTreeApplesTD[1][playerid], 5);
PlayerTextDrawSetSelectable(playerid, AppleTreeApplesTD[1][playerid], true);
PlayerTextDrawSetPreviewModel(playerid, AppleTreeApplesTD[1][playerid], 19575);
AppleTreeApplesTD[2][playerid] = CreatePlayerTextDraw(playerid, 297.000061, 130.608901, "");
PlayerTextDrawTextSize(playerid, AppleTreeApplesTD[2][playerid], 39.000000, 43.000000);
PlayerTextDrawAlignment(playerid, AppleTreeApplesTD[2][playerid], 1);
PlayerTextDrawColor(playerid, AppleTreeApplesTD[2][playerid], -1);
PlayerTextDrawBackgroundColor(playerid, AppleTreeApplesTD[2][playerid], 0);
PlayerTextDrawFont(playerid, AppleTreeApplesTD[2][playerid], 5);
PlayerTextDrawSetSelectable(playerid, AppleTreeApplesTD[2][playerid], true);
PlayerTextDrawSetPreviewModel(playerid, AppleTreeApplesTD[2][playerid], 19575);
AppleTreeApplesTD[3][playerid] = CreatePlayerTextDraw(playerid, 264.555603, 114.680046, "");
PlayerTextDrawTextSize(playerid, AppleTreeApplesTD[3][playerid], 39.000000, 43.000000);
PlayerTextDrawAlignment(playerid, AppleTreeApplesTD[3][playerid], 1);
PlayerTextDrawColor(playerid, AppleTreeApplesTD[3][playerid], -1);
PlayerTextDrawBackgroundColor(playerid, AppleTreeApplesTD[3][playerid], 0);
PlayerTextDrawFont(playerid, AppleTreeApplesTD[3][playerid], 5);
PlayerTextDrawSetSelectable(playerid, AppleTreeApplesTD[3][playerid], true);
PlayerTextDrawSetPreviewModel(playerid, AppleTreeApplesTD[3][playerid], 19575);
AppleTreeApplesTD[4][playerid] = CreatePlayerTextDraw(playerid, 226.777832, 151.431060, "");
PlayerTextDrawTextSize(playerid, AppleTreeApplesTD[4][playerid], 39.000000, 43.000000);
PlayerTextDrawAlignment(playerid, AppleTreeApplesTD[4][playerid], 1);
PlayerTextDrawColor(playerid, AppleTreeApplesTD[4][playerid], -1);
PlayerTextDrawBackgroundColor(playerid, AppleTreeApplesTD[4][playerid], 0);
PlayerTextDrawFont(playerid, AppleTreeApplesTD[4][playerid], 5);
PlayerTextDrawSetSelectable(playerid, AppleTreeApplesTD[4][playerid], true);
PlayerTextDrawSetPreviewModel(playerid, AppleTreeApplesTD[4][playerid], 19575);
AppleTreeApplesTD[5][playerid] = CreatePlayerTextDraw(playerid, 256.111145, 148.942153, "");
PlayerTextDrawTextSize(playerid, AppleTreeApplesTD[5][playerid], 39.000000, 43.000000);
PlayerTextDrawColor(playerid, AppleTreeApplesTD[5][playerid], -1);
PlayerTextDrawBackgroundColor(playerid, AppleTreeApplesTD[5][playerid], 0);
PlayerTextDrawFont(playerid, AppleTreeApplesTD[5][playerid], 5);
PlayerTextDrawSetSelectable(playerid, AppleTreeApplesTD[5][playerid], true);
PlayerTextDrawSetPreviewModel(playerid, AppleTreeApplesTD[5][playerid], 19575);
AppleTreeApplesTD[6][playerid] = CreatePlayerTextDraw(playerid, 334.777862, 147.946594, "");
PlayerTextDrawTextSize(playerid, AppleTreeApplesTD[6][playerid], 39.000000, 43.000000);
PlayerTextDrawColor(playerid, AppleTreeApplesTD[6][playerid], -1);
PlayerTextDrawBackgroundColor(playerid, AppleTreeApplesTD[6][playerid], 0);
PlayerTextDrawFont(playerid, AppleTreeApplesTD[6][playerid], 5);
PlayerTextDrawSetSelectable(playerid, AppleTreeApplesTD[6][playerid], true);
PlayerTextDrawSetPreviewModel(playerid, AppleTreeApplesTD[6][playerid], 19575);
AppleTreeApplesTD[7][playerid] = CreatePlayerTextDraw(playerid, 300.111175, 169.351013, "");
PlayerTextDrawTextSize(playerid, AppleTreeApplesTD[7][playerid], 39.000000, 43.000000);
PlayerTextDrawColor(playerid, AppleTreeApplesTD[7][playerid], -1);
PlayerTextDrawBackgroundColor(playerid, AppleTreeApplesTD[7][playerid], 0);
PlayerTextDrawFont(playerid, AppleTreeApplesTD[7][playerid], 5);
PlayerTextDrawSetSelectable(playerid, AppleTreeApplesTD[7][playerid], true);
PlayerTextDrawSetPreviewModel(playerid, AppleTreeApplesTD[7][playerid], 19575);
AppleTreeApplesTD[8][playerid] = CreatePlayerTextDraw(playerid, 265.888946, 177.315460, "");
PlayerTextDrawTextSize(playerid, AppleTreeApplesTD[8][playerid], 39.000000, 43.000000);
PlayerTextDrawColor(playerid, AppleTreeApplesTD[8][playerid], -1);
PlayerTextDrawBackgroundColor(playerid, AppleTreeApplesTD[8][playerid], 0);
PlayerTextDrawFont(playerid, AppleTreeApplesTD[8][playerid], 5);
PlayerTextDrawSetSelectable(playerid, AppleTreeApplesTD[8][playerid], true);
PlayerTextDrawSetPreviewModel(playerid, AppleTreeApplesTD[8][playerid], 19575);
AppleTreeApplesTD[9][playerid] = CreatePlayerTextDraw(playerid, 337.888977, 174.328796, "");
PlayerTextDrawTextSize(playerid, AppleTreeApplesTD[9][playerid], 39.000000, 43.000000);
PlayerTextDrawColor(playerid, AppleTreeApplesTD[9][playerid], -1);
PlayerTextDrawBackgroundColor(playerid, AppleTreeApplesTD[9][playerid], 0);
PlayerTextDrawFont(playerid, AppleTreeApplesTD[9][playerid], 5);
PlayerTextDrawSetSelectable(playerid, AppleTreeApplesTD[9][playerid], true);
PlayerTextDrawSetPreviewModel(playerid, AppleTreeApplesTD[9][playerid], 19575);
Code:
CreateAppleTreePTD(playerid); // Calls the above code
// Show tree
PlayerTextDrawShow(playerid, AppleBGTD[playerid]);
PlayerTextDrawShow(playerid, AppleTreeTD[playerid]);
// Show apples
for (new i = 0; i < MAX_APPLES; i++)
{
if (TreeVar[tree][AppleTreeApples][i])
PlayerTextDrawShow(playerid, AppleTreeApplesTD[i][playerid]);
}
SelectTextDraw(playerid, 0xFFFFFFAA);
Code:
PlayerTextDrawHide(playerid, AppleBGTD[playerid]);
PlayerTextDrawHide(playerid, AppleTreeTD[playerid]);
PlayerTextDrawDestroy(playerid, AppleBGTD[playerid]);
PlayerTextDrawDestroy(playerid, AppleTreeTD[playerid]);
for (new i = 0; i < MAX_APPLES; i++)
{
PlayerTextDrawHide(playerid, AppleTreeApplesTD[i][playerid]);
PlayerTextDrawDestroy(playerid, AppleTreeApplesTD[i][playerid]);
}