Textdraw Issue (Selectable)
#1

Hi,
I'm facing a problem with textdraws (selectable once)... I have added a screen of how it should like - that's how it looks in TDE... If I although add it to a filterscript (completely empty gamemode without any textdraws or so at all and no other filterscripts that have any textdraw) it looks like the other screens... I have hovered above different positions to make you show how it reacts when hovering over an item (it should highlight only one item though)

(the boxes on the "Item 1" textdraws have a size of the length of the text and a bit more and an invisible color)

pawn Код:
public OnPlayerConnect(playerid)
{
    PartSelP[playerid][0] = CreatePlayerTextDraw(playerid, 319.048461, 142.749938, "~n~");
    PlayerTextDrawLetterSize(playerid, PartSelP[playerid][0], 0.400000, 1.600000);
    PlayerTextDrawTextSize(playerid, PartSelP[playerid][0], 0.000000, 219.428955);
    PlayerTextDrawAlignment(playerid, PartSelP[playerid][0], 2);
    PlayerTextDrawColor(playerid, PartSelP[playerid][0], -1);
    PlayerTextDrawUseBox(playerid, PartSelP[playerid][0], 1);
    PlayerTextDrawBoxColor(playerid, PartSelP[playerid][0], 842150500);
    PlayerTextDrawSetShadow(playerid, PartSelP[playerid][0], 0);
    PlayerTextDrawSetOutline(playerid, PartSelP[playerid][0], 0);
    PlayerTextDrawBackgroundColor(playerid, PartSelP[playerid][0], 255);
    PlayerTextDrawFont(playerid, PartSelP[playerid][0], 1);
    PlayerTextDrawSetProportional(playerid, PartSelP[playerid][0], 1);
    PlayerTextDrawSetShadow(playerid, PartSelP[playerid][0], 0);

    PartSelP[playerid][1] = CreatePlayerTextDraw(playerid, 209.882827, 164.916687, "~n~~n~~n~~n~~n~~n~~n~~n~~n~");
    PlayerTextDrawLetterSize(playerid, PartSelP[playerid][1], 0.400000, 1.600000);
    PlayerTextDrawTextSize(playerid, PartSelP[playerid][1], 315.146423, 0.000000);
    PlayerTextDrawAlignment(playerid, PartSelP[playerid][1], 1);
    PlayerTextDrawColor(playerid, PartSelP[playerid][1], -1);
    PlayerTextDrawUseBox(playerid, PartSelP[playerid][1], 1);
    PlayerTextDrawBoxColor(playerid, PartSelP[playerid][1], 842150500);
    PlayerTextDrawSetShadow(playerid, PartSelP[playerid][1], 0);
    PlayerTextDrawSetOutline(playerid, PartSelP[playerid][1], 0);
    PlayerTextDrawBackgroundColor(playerid, PartSelP[playerid][1], 255);
    PlayerTextDrawFont(playerid, PartSelP[playerid][1], 1);
    PlayerTextDrawSetProportional(playerid, PartSelP[playerid][1], 1);
    PlayerTextDrawSetShadow(playerid, PartSelP[playerid][1], 0);

    PartSelP[playerid][2] = CreatePlayerTextDraw(playerid, 320.137145, 162.216613, "");
    PlayerTextDrawLetterSize(playerid, PartSelP[playerid][2], 0.000000, 0.000000);
    PlayerTextDrawTextSize(playerid, PartSelP[playerid][2], 110.614929, 134.333343);
    PlayerTextDrawAlignment(playerid, PartSelP[playerid][2], 1);
    PlayerTextDrawColor(playerid, PartSelP[playerid][2], -1);
    PlayerTextDrawSetShadow(playerid, PartSelP[playerid][2], 0);
    PlayerTextDrawSetOutline(playerid, PartSelP[playerid][2], 0);
    PlayerTextDrawBackgroundColor(playerid, PartSelP[playerid][2], 842150500);
    PlayerTextDrawFont(playerid, PartSelP[playerid][2], 5);
    PlayerTextDrawSetProportional(playerid, PartSelP[playerid][2], 1);
    PlayerTextDrawSetShadow(playerid, PartSelP[playerid][2], 0);
    PlayerTextDrawSetSelectable(playerid, PartSelP[playerid][2], true);
    PlayerTextDrawSetPreviewModel(playerid, PartSelP[playerid][2], 400);
    PlayerTextDrawSetPreviewRot(playerid, PartSelP[playerid][2], 0.000000, 0.000000, 0.000000, 1.000000);
    PlayerTextDrawSetPreviewVehCol(playerid, PartSelP[playerid][2], 1, 1);

    PartSelP[playerid][3] = CreatePlayerTextDraw(playerid, 319.048461, 302.349853, "Add_Object_to_Vehicle");
    PlayerTextDrawLetterSize(playerid, PartSelP[playerid][3], 0.405153, 2.060833);
    PlayerTextDrawTextSize(playerid, PartSelP[playerid][3], 0.000000, 219.428955);
    PlayerTextDrawAlignment(playerid, PartSelP[playerid][3], 2);
    PlayerTextDrawColor(playerid, PartSelP[playerid][3], 168430335);
    PlayerTextDrawUseBox(playerid, PartSelP[playerid][3], 1);
    PlayerTextDrawBoxColor(playerid, PartSelP[playerid][3], 842150500);
    PlayerTextDrawSetShadow(playerid, PartSelP[playerid][3], 0);
    PlayerTextDrawSetOutline(playerid, PartSelP[playerid][3], 0);
    PlayerTextDrawBackgroundColor(playerid, PartSelP[playerid][3], 255);
    PlayerTextDrawFont(playerid, PartSelP[playerid][3], 1);
    PlayerTextDrawSetProportional(playerid, PartSelP[playerid][3], 1);
    PlayerTextDrawSetShadow(playerid, PartSelP[playerid][3], 0);

    PartSelP[playerid][4] = CreatePlayerTextDraw(playerid, 320.922576, 141.583358, "Page_1");
    PlayerTextDrawLetterSize(playerid, PartSelP[playerid][4], 0.400000, 1.600000);
    PlayerTextDrawAlignment(playerid, PartSelP[playerid][4], 2);
    PlayerTextDrawColor(playerid, PartSelP[playerid][4], 84215240);
    PlayerTextDrawSetShadow(playerid, PartSelP[playerid][4], 0);
    PlayerTextDrawSetOutline(playerid, PartSelP[playerid][4], 0);
    PlayerTextDrawBackgroundColor(playerid, PartSelP[playerid][4], 255);
    PlayerTextDrawFont(playerid, PartSelP[playerid][4], 1);
    PlayerTextDrawSetProportional(playerid, PartSelP[playerid][4], 1);
    PlayerTextDrawSetShadow(playerid, PartSelP[playerid][4], 0);

    PartSelP[playerid][5] = CreatePlayerTextDraw(playerid, 416.032409, 142.166656, "~>~");
    PlayerTextDrawLetterSize(playerid, PartSelP[playerid][5], 0.403279, 1.664166);
    PlayerTextDrawAlignment(playerid, PartSelP[playerid][5], 1);
    PlayerTextDrawColor(playerid, PartSelP[playerid][5], -1);
    PlayerTextDrawSetShadow(playerid, PartSelP[playerid][5], 0);
    PlayerTextDrawSetOutline(playerid, PartSelP[playerid][5], 0);
    PlayerTextDrawBackgroundColor(playerid, PartSelP[playerid][5], 255);
    PlayerTextDrawFont(playerid, PartSelP[playerid][5], 1);
    PlayerTextDrawSetProportional(playerid, PartSelP[playerid][5], 1);
    PlayerTextDrawSetShadow(playerid, PartSelP[playerid][5], 0);
    PlayerTextDrawSetSelectable(playerid, PartSelP[playerid][5], true);

    PartSelP[playerid][6] = CreatePlayerTextDraw(playerid, 209.882827, 141.000030, "~<~");
    PlayerTextDrawLetterSize(playerid, PartSelP[playerid][6], 0.403279, 1.664166);
    PlayerTextDrawAlignment(playerid, PartSelP[playerid][6], 1);
    PlayerTextDrawColor(playerid, PartSelP[playerid][6], -1);
    PlayerTextDrawSetShadow(playerid, PartSelP[playerid][6], 0);
    PlayerTextDrawSetOutline(playerid, PartSelP[playerid][6], 0);
    PlayerTextDrawBackgroundColor(playerid, PartSelP[playerid][6], 255);
    PlayerTextDrawFont(playerid, PartSelP[playerid][6], 1);
    PlayerTextDrawSetProportional(playerid, PartSelP[playerid][6], 1);
    PlayerTextDrawSetShadow(playerid, PartSelP[playerid][6], 0);
    PlayerTextDrawSetSelectable(playerid, PartSelP[playerid][6], true);

    PartSelP[playerid][7] = CreatePlayerTextDraw(playerid, 215.505096, 170.166671, "Item_1");
    PlayerTextDrawLetterSize(playerid, PartSelP[playerid][7], 0.400000, 1.600000);
    PlayerTextDrawTextSize(playerid, PartSelP[playerid][7], 308.587310, 20.000000);
    PlayerTextDrawAlignment(playerid, PartSelP[playerid][7], 2);
    PlayerTextDrawColor(playerid, PartSelP[playerid][7], 84215240);
    PlayerTextDrawSetShadow(playerid, PartSelP[playerid][7], 0);
    PlayerTextDrawSetOutline(playerid, PartSelP[playerid][7], 0);
    PlayerTextDrawBackgroundColor(playerid, PartSelP[playerid][7], 255);
    PlayerTextDrawUseBox(playerid, PartSelP[playerid][7], 1);
    PlayerTextDrawBoxColor(playerid, PartSelP[playerid][7], 0);
    PlayerTextDrawFont(playerid, PartSelP[playerid][7], 1);
    PlayerTextDrawSetProportional(playerid, PartSelP[playerid][7], 1);
    PlayerTextDrawSetShadow(playerid, PartSelP[playerid][7], 0);
    PlayerTextDrawSetSelectable(playerid, PartSelP[playerid][7], true);

    PartSelP[playerid][8] = CreatePlayerTextDraw(playerid, 215.505096, 184.166671, "Item_1");
    PlayerTextDrawLetterSize(playerid, PartSelP[playerid][8], 0.400000, 1.600000);
    PlayerTextDrawTextSize(playerid, PartSelP[playerid][8], 308.587310, 20.000000);
    PlayerTextDrawAlignment(playerid, PartSelP[playerid][8], 2);
    PlayerTextDrawColor(playerid, PartSelP[playerid][8], 84215240);
    PlayerTextDrawSetShadow(playerid, PartSelP[playerid][8], 0);
    PlayerTextDrawSetOutline(playerid, PartSelP[playerid][8], 0);
    PlayerTextDrawBackgroundColor(playerid, PartSelP[playerid][8], 255);
    PlayerTextDrawUseBox(playerid, PartSelP[playerid][8], 1);
    PlayerTextDrawBoxColor(playerid, PartSelP[playerid][8], 0);
    PlayerTextDrawFont(playerid, PartSelP[playerid][8], 1);
    PlayerTextDrawSetProportional(playerid, PartSelP[playerid][8], 1);
    PlayerTextDrawSetShadow(playerid, PartSelP[playerid][8], 0);
    PlayerTextDrawSetSelectable(playerid, PartSelP[playerid][8], true);

    PartSelP[playerid][9] = CreatePlayerTextDraw(playerid, 215.505096, 198.166671, "Item_1");
    PlayerTextDrawLetterSize(playerid, PartSelP[playerid][9], 0.400000, 1.600000);
    PlayerTextDrawTextSize(playerid, PartSelP[playerid][9], 308.587310, 20.000000);
    PlayerTextDrawAlignment(playerid, PartSelP[playerid][9], 2);
    PlayerTextDrawColor(playerid, PartSelP[playerid][9], 84215240);
    PlayerTextDrawSetShadow(playerid, PartSelP[playerid][9], 0);
    PlayerTextDrawSetOutline(playerid, PartSelP[playerid][9], 0);
    PlayerTextDrawBackgroundColor(playerid, PartSelP[playerid][9], 255);
    PlayerTextDrawUseBox(playerid, PartSelP[playerid][9], 1);
    PlayerTextDrawBoxColor(playerid, PartSelP[playerid][9], 0);
    PlayerTextDrawFont(playerid, PartSelP[playerid][9], 1);
    PlayerTextDrawSetProportional(playerid, PartSelP[playerid][9], 1);
    PlayerTextDrawSetShadow(playerid, PartSelP[playerid][9], 0);
    PlayerTextDrawSetSelectable(playerid, PartSelP[playerid][9], true);

    PartSelP[playerid][10] = CreatePlayerTextDraw(playerid, 215.505096, 212.166671, "Item_1");
    PlayerTextDrawLetterSize(playerid, PartSelP[playerid][10], 0.400000, 1.600000);
    PlayerTextDrawTextSize(playerid, PartSelP[playerid][10], 308.587310, 20.000000);
    PlayerTextDrawAlignment(playerid, PartSelP[playerid][10], 2);
    PlayerTextDrawColor(playerid, PartSelP[playerid][10], 84215240);
    PlayerTextDrawSetShadow(playerid, PartSelP[playerid][10], 0);
    PlayerTextDrawSetOutline(playerid, PartSelP[playerid][10], 0);
    PlayerTextDrawBackgroundColor(playerid, PartSelP[playerid][10], 255);
    PlayerTextDrawUseBox(playerid, PartSelP[playerid][10], 1);
    PlayerTextDrawBoxColor(playerid, PartSelP[playerid][10], 0);
    PlayerTextDrawFont(playerid, PartSelP[playerid][10], 1);
    PlayerTextDrawSetProportional(playerid, PartSelP[playerid][10], 1);
    PlayerTextDrawSetShadow(playerid, PartSelP[playerid][10], 0);
    PlayerTextDrawSetSelectable(playerid, PartSelP[playerid][10], true);

    PartSelP[playerid][11] = CreatePlayerTextDraw(playerid, 215.505096, 226.166671, "Item_1");
    PlayerTextDrawLetterSize(playerid, PartSelP[playerid][11], 0.400000, 1.600000);
    PlayerTextDrawTextSize(playerid, PartSelP[playerid][11], 308.587310, 20.000000);
    PlayerTextDrawAlignment(playerid, PartSelP[playerid][11], 2);
    PlayerTextDrawColor(playerid, PartSelP[playerid][11], 84215240);
    PlayerTextDrawSetShadow(playerid, PartSelP[playerid][11], 0);
    PlayerTextDrawSetOutline(playerid, PartSelP[playerid][11], 0);
    PlayerTextDrawBackgroundColor(playerid, PartSelP[playerid][11], 255);
    PlayerTextDrawUseBox(playerid, PartSelP[playerid][11], 1);
    PlayerTextDrawBoxColor(playerid, PartSelP[playerid][1], 0);
    PlayerTextDrawFont(playerid, PartSelP[playerid][11], 1);
    PlayerTextDrawSetProportional(playerid, PartSelP[playerid][11], 1);
    PlayerTextDrawSetShadow(playerid, PartSelP[playerid][11], 0);
    PlayerTextDrawSetSelectable(playerid, PartSelP[playerid][11], true);

    PartSelP[playerid][12] = CreatePlayerTextDraw(playerid, 215.505096, 240.166671, "Item_1");
    PlayerTextDrawLetterSize(playerid, PartSelP[playerid][12], 0.400000, 1.600000);
    PlayerTextDrawTextSize(playerid, PartSelP[playerid][12], 308.587310, 20.000000);
    PlayerTextDrawAlignment(playerid, PartSelP[playerid][12], 2);
    PlayerTextDrawColor(playerid, PartSelP[playerid][12], 84215240);
    PlayerTextDrawSetShadow(playerid, PartSelP[playerid][12], 0);
    PlayerTextDrawSetOutline(playerid, PartSelP[playerid][12], 0);
    PlayerTextDrawBackgroundColor(playerid, PartSelP[playerid][12], 255);
    PlayerTextDrawUseBox(playerid, PartSelP[playerid][12], 1);
    PlayerTextDrawBoxColor(playerid, PartSelP[playerid][12], 0);
    PlayerTextDrawFont(playerid, PartSelP[playerid][12], 1);
    PlayerTextDrawSetProportional(playerid, PartSelP[playerid][12], 1);
    PlayerTextDrawSetShadow(playerid, PartSelP[playerid][12], 0);
    PlayerTextDrawSetSelectable(playerid, PartSelP[playerid][12], true);

    PartSelP[playerid][13] = CreatePlayerTextDraw(playerid, 215.505096, 254.166671, "Item_1");
    PlayerTextDrawLetterSize(playerid, PartSelP[playerid][13], 0.400000, 1.600000);
    PlayerTextDrawTextSize(playerid, PartSelP[playerid][13], 308.587310, 20.000000);
    PlayerTextDrawAlignment(playerid, PartSelP[playerid][13], 2);
    PlayerTextDrawColor(playerid, PartSelP[playerid][13], 84215240);
    PlayerTextDrawSetShadow(playerid, PartSelP[playerid][13], 0);
    PlayerTextDrawSetOutline(playerid, PartSelP[playerid][13], 0);
    PlayerTextDrawBackgroundColor(playerid, PartSelP[playerid][13], 255);
    PlayerTextDrawUseBox(playerid, PartSelP[playerid][13], 1);
    PlayerTextDrawBoxColor(playerid, PartSelP[playerid][13], 0);
    PlayerTextDrawFont(playerid, PartSelP[playerid][13], 1);
    PlayerTextDrawSetProportional(playerid, PartSelP[playerid][13], 1);
    PlayerTextDrawSetShadow(playerid, PartSelP[playerid][13], 0);
    PlayerTextDrawSetSelectable(playerid, PartSelP[playerid][13], true);

    PartSelP[playerid][14] = CreatePlayerTextDraw(playerid, 215.505096, 268.166671, "Item_1");
    PlayerTextDrawLetterSize(playerid, PartSelP[playerid][14], 0.400000, 1.600000);
    PlayerTextDrawTextSize(playerid, PartSelP[playerid][14], 308.587310, 20.000000);
    PlayerTextDrawAlignment(playerid, PartSelP[playerid][14], 2);
    PlayerTextDrawColor(playerid, PartSelP[playerid][14], 84215240);
    PlayerTextDrawSetShadow(playerid, PartSelP[playerid][14], 0);
    PlayerTextDrawSetOutline(playerid, PartSelP[playerid][14], 0);
    PlayerTextDrawBackgroundColor(playerid, PartSelP[playerid][14], 255);
    PlayerTextDrawUseBox(playerid, PartSelP[playerid][14], 1);
    PlayerTextDrawBoxColor(playerid, PartSelP[playerid][14], 0);
    PlayerTextDrawFont(playerid, PartSelP[playerid][14], 1);
    PlayerTextDrawSetProportional(playerid, PartSelP[playerid][14], 1);
    PlayerTextDrawSetShadow(playerid, PartSelP[playerid][14], 0);
    PlayerTextDrawSetSelectable(playerid, PartSelP[playerid][14], true);
    return 1;
}

CMD:test(playerid, params[])
{
    for(new n=0; n<15; n++)
        PlayerTextDrawShow(playerid, PartSelP[playerid][n]);
    SelectTextDraw(playerid, 0x00FF00FF);
    return 1;
}
should be like


Is like:


Reply
#2

pawn Код:
PlayerTextDrawTextSize(playerid, PartSelP[playerid][8], 308.587310, 20.000000);
This row is generating the issue. Looking on the wiki page (https://sampwiki.blast.hk/wiki/PlayerTextDrawTextSize), you can see that this function is responsible for defining the clickable area of the text. Also, it says that if you align the text to the center (alignment 2), you should invert X and Y. In your case, making the X parameter equal to ~10 instead of 308 should fix the problem. Try different values until you find the one that fits best.
Reply
#3

Quote:
Originally Posted by HazardouS
Посмотреть сообщение
pawn Код:
PlayerTextDrawTextSize(playerid, PartSelP[playerid][8], 308.587310, 20.000000);
This row is generating the issue. Looking on the wiki page (https://sampwiki.blast.hk/wiki/PlayerTextDrawTextSize), you can see that this function is responsible for defining the clickable area of the text. Also, it says that if you align the text to the center (alignment 2), you should invert X and Y. In your case, making the X parameter equal to ~10 instead of 308 should fix the problem. Try different values until you find the one that fits best.
bro thanks a lot for that, have been struggling with it for hours and didn't though of that -.-
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)