SA-MP Forums Archive
Problems with selecting textdraws? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Problems with selecting textdraws? (/showthread.php?tid=334677)



Problems with selecting textdraws? - 2KY - 15.04.2012

pawn Код:
stock CreateTextdraws ( )
{
    startup1 = TextDrawCreate(0.000000, -2.000000, "_~n~_~n~_~n~_~n~_~n~_~n~_~n~");
    TextDrawBackgroundColor(startup1, 255);
    TextDrawFont(startup1, 1);
    TextDrawLetterSize(startup1, 0.500000, 1.000000);
    TextDrawColor(startup1, -1);
    TextDrawSetOutline(startup1, 0);
    TextDrawSetProportional(startup1, 1);
    TextDrawSetShadow(startup1, 1);
    TextDrawUseBox(startup1, 1);
    TextDrawBoxColor(startup1, -1777463553);
    TextDrawTextSize(startup1, 680.000000, 0.000000);
    TextDrawSetSelectable(startup1, false);

    startup2 = TextDrawCreate(0.000000, 388.000000, "_~n~_~n~_~n~_~n~_~n~_~n~_~n~");
    TextDrawBackgroundColor(startup2, 255);
    TextDrawFont(startup2, 1);
    TextDrawLetterSize(startup2, 0.500000, 1.000000);
    TextDrawColor(startup2, -1);
    TextDrawSetOutline(startup2, 0);
    TextDrawSetProportional(startup2, 1);
    TextDrawSetShadow(startup2, 1);
    TextDrawUseBox(startup2, 1);
    TextDrawBoxColor(startup2, -1777463553);
    TextDrawTextSize(startup2, 680.000000, 0.000000);
    TextDrawSetSelectable(startup2, false);
   
    startup3 = TextDrawCreate(648.000000, 65.000000, "_~n~_~n~_~n~_~n~_~n~_~n~_~n~_~n~_~n~_~n~_~n~_~n~_~n~_~n~_~n~_~n~_~n~_~n~_~n~_~n~_~n~_~n~_~n~_~n~_~n~_~n~_~n~_~n~_~n~_~n~_~n~_~n~");
    TextDrawBackgroundColor(startup3, 255);
    TextDrawFont(startup3, 1);
    TextDrawLetterSize(startup3, 0.500000, 1.000000);
    TextDrawColor(startup3, -1);
    TextDrawSetOutline(startup3, 0);
    TextDrawSetProportional(startup3, 1);
    TextDrawSetShadow(startup3, 1);
    TextDrawUseBox(startup3, 1);
    TextDrawBoxColor(startup3, 255);
    TextDrawTextSize(startup3, 490.000000, -23.000000);
    TextDrawSetSelectable(startup3, false);
   
    startup4 = TextDrawCreate(648.000000, 96.000000, "_~n~_~n~_~n~_~n~_~n~_~n~_~n~_~n~_~n~_~n~_~n~_~n~_~n~_~n~_~n~_~n~_~n~_~n~_~n~_~n~_~n~_~n~_~n~_~n~_~n~_~n~_~n~_~n~_~n~_~n~_~n~_~n~");
    TextDrawBackgroundColor(startup4, 255);
    TextDrawFont(startup4, 1);
    TextDrawLetterSize(startup4, 0.500000, 1.000000);
    TextDrawColor(startup4, -1);
    TextDrawSetOutline(startup4, 0);
    TextDrawSetProportional(startup4, 1);
    TextDrawSetShadow(startup4, 1);
    TextDrawUseBox(startup4, 1);
    TextDrawBoxColor(startup4, 255);
    TextDrawTextSize(startup4, 490.000000, -23.000000);
    TextDrawSetSelectable(startup4, false);
   
    startup5 = TextDrawCreate(430.000000, 20.000000, "Welcome to");
    TextDrawBackgroundColor(startup5, 255);
    TextDrawFont(startup5, 2);
    TextDrawLetterSize(startup5, 0.500000, 1.000000);
    TextDrawColor(startup5, -1);
    TextDrawSetOutline(startup5, 0);
    TextDrawSetProportional(startup5, 1);
    TextDrawSetShadow(startup5, 1);
    TextDrawSetSelectable(startup5, false);
   
    startup6 = TextDrawCreate(532.000000, 32.000000, "newmode!");
    TextDrawBackgroundColor(startup6, 255);
    TextDrawFont(startup6, 2);
    TextDrawLetterSize(startup6, 0.500000, 1.000000);
    TextDrawColor(startup6, -1);
    TextDrawSetOutline(startup6, 0);
    TextDrawSetProportional(startup6, 1);
    TextDrawSetShadow(startup6, 1);
    TextDrawSetSelectable(startup6, false);
   
    startup7 = TextDrawCreate(548.000000, 74.000000, "Menu");
    TextDrawBackgroundColor(startup7, 255);
    TextDrawFont(startup7, 1);
    TextDrawLetterSize(startup7, 0.500000, 1.000000);
    TextDrawColor(startup7, -1);
    TextDrawSetOutline(startup7, 0);
    TextDrawSetProportional(startup7, 1);
    TextDrawSetShadow(startup7, 1);
    TextDrawSetSelectable(startup7, false);
   
    startup8 = TextDrawCreate(508.000000, 104.000000, "Create an account");
    TextDrawBackgroundColor(startup8, 255);
    TextDrawFont(startup8, 1);
    TextDrawLetterSize(startup8, 0.400000, 2.000000);
    TextDrawColor(startup8, -1);
    TextDrawSetOutline(startup8, 0);
    TextDrawSetProportional(startup8, 1);
    TextDrawSetShadow(startup8, 1);
    TextDrawSetSelectable(startup8, true);
   
    startup9 = TextDrawCreate(508.000000, 156.000000, "Login");
    TextDrawBackgroundColor(startup9, 255);
    TextDrawFont(startup9, 1);
    TextDrawLetterSize(startup9, 0.500000, 2.000000);
    TextDrawColor(startup9, -1);
    TextDrawSetOutline(startup9, 0);
    TextDrawSetProportional(startup9, 1);
    TextDrawSetShadow(startup9, 1);
    TextDrawSetSelectable(startup9, true);
   
    startup10 = TextDrawCreate(508.000000, 204.000000, "Information");
    TextDrawBackgroundColor(startup10, 255);
    TextDrawFont(startup10, 1);
    TextDrawLetterSize(startup10, 0.500000, 2.000000);
    TextDrawColor(startup10, -1);
    TextDrawSetOutline(startup10, 0);
    TextDrawSetProportional(startup10, 1);
    TextDrawSetShadow(startup10, 1);
    TextDrawSetSelectable(startup10, true);
   
    startup11 = TextDrawCreate(549.000000, 79.000000, "------");
    TextDrawBackgroundColor(startup11, 255);
    TextDrawFont(startup11, 1);
    TextDrawLetterSize(startup11, 0.500000, 1.000000);
    TextDrawColor(startup11, -1);
    TextDrawSetOutline(startup11, 0);
    TextDrawSetProportional(startup11, 1);
    TextDrawSetShadow(startup11, 1);
    TextDrawSetSelectable(startup11, false);
   
    startup12 = TextDrawCreate(10.000000, 407.000000, "Build: R1");
    TextDrawBackgroundColor(startup12, 255);
    TextDrawFont(startup12, 2);
    TextDrawLetterSize(startup12, 0.500000, 2.000000);
    TextDrawColor(startup12, -1);
    TextDrawSetOutline(startup12, 0);
    TextDrawSetProportional(startup12, 1);
    TextDrawSetShadow(startup12, 1);
    TextDrawSetSelectable(startup12, false);
   
    startup13 = TextDrawCreate(437.000000, 397.000000, "Players online");
    TextDrawBackgroundColor(startup13, 255);
    TextDrawFont(startup13, 2);
    TextDrawLetterSize(startup13, 0.400000, 2.000000);
    TextDrawColor(startup13, -1);
    TextDrawSetOutline(startup13, 0);
    TextDrawSetProportional(startup13, 1);
    TextDrawSetShadow(startup13, 1);
    TextDrawSetSelectable(startup13, false);
   
    startup14 = TextDrawCreate(579.000000, 409.000000, "~y~-~w~/-");
    TextDrawBackgroundColor(startup14, 255);
    TextDrawFont(startup14, 2);
    TextDrawLetterSize(startup14, 0.400000, 2.000000);
    TextDrawColor(startup14, -1);
    TextDrawSetOutline(startup14, 0);
    TextDrawSetProportional(startup14, 1);
    TextDrawSetShadow(startup14, 1);
    TextDrawSetSelectable(startup14, false);
   
    startup15 = TextDrawCreate(501.000000, 375.000000, "[c] SKYMOD");
    TextDrawBackgroundColor(startup15, 255);
    TextDrawFont(startup15, 3);
    TextDrawLetterSize(startup15, 0.600000, 1.000000);
    TextDrawColor(startup15, 16777215);
    TextDrawSetOutline(startup15, 0);
    TextDrawSetProportional(startup15, 1);
    TextDrawSetShadow(startup15, 1);
    TextDrawSetSelectable(startup15, false);
    return true;
}
This is how I show the textdraws, and allow them to be selectable

pawn Код:
public OnPlayerConnect(playerid)
{
    ShowStartupTextdraws ( playerid );
   
    TogglePlayerSpectating( playerid, true );
   
    ConnectedPlayers ++;
   
    SendClientMessage( playerid, -1, .. );
   
    SelectTextDraw( playerid, 0xC90411FF );
    return 1;
}
When I hover over one option, it selects two or all of the options. How do I fix this?

A reply I got on an old thread (in the wrong section) was:

Quote:
Originally Posted by MP2
Посмотреть сообщение
Look at your TextDrawTextSize lines. That is what defines the 'clickable area'. Some are set to minus values and some 0.
Can someone assist me further? I have no idea what I'm doing in this area.


Re: Problems with selecting textdraws? - MP2 - 15.04.2012

Why have you made another topic?!


Re: Problems with selecting textdraws? - 2KY - 15.04.2012

Quote:
Originally Posted by MP2
Посмотреть сообщение
Why have you made another topic?!
It was in the wrong section. Nobody was going to answer me in the 0.3d discussion.


Re: Problems with selecting textdraws? - MP2 - 15.04.2012

You don't need to use TextDrawSetSelectable to set them to false. They're automatically false when they're created.


Re: Problems with selecting textdraws? - 2KY - 15.04.2012

Is that where my problem is located?


Re: Problems with selecting textdraws? - Hiddos - 15.04.2012

You'll need to screw around a bit with TextDrawTextSize, it indicates the 'box' in which you can select the textdraw


Re: Problems with selecting textdraws? - 2KY - 15.04.2012

Quote:
Originally Posted by Hiddos
Посмотреть сообщение
You'll need to screw around a bit with TextDrawTextSize, it indicates the 'box' in which you can select the textdraw
Alright, so it's like..

X ->
Y ^

So if I did (assuming 0,0 is the center of the screen, which I don't think it is..)

pawn Код:
TextDrawTextSize( TD, 100.0, 0.0 );
It would make it selectable 100 units to the side of 0.0?


Re: Problems with selecting textdraws? - kizla - 15.04.2012

you must add Y.. so try like this:

pawn Код:
TextDrawTextSize( TD, 100.0, 20.0 );



Re: Problems with selecting textdraws? - MP2 - 15.04.2012

Y is the height and X is the width (across). This is swapped on CENTER ALIGNED textdraws.