SA-MP Forums Archive
Selectable 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: Selectable textdraws (/showthread.php?tid=557459)



Selectable textdraws - vassilis - 14.01.2015

solved


Re: Selectable textdraws - Threshold - 14.01.2015

Any code? -_-


Re: Selectable textdraws - vassilis - 14.01.2015

Bump i added code too sorry for forgeting it


Re: Selectable textdraws - Threshold - 14.01.2015

You need to use TextDrawUseBox and TextDrawTextSize.
Quote:
This function defines the clickable area for use with TextDrawSetSelectable, whether a box is shown or not.
I found that a good size for TextDrawTextSize is roughly:
Code:
190.0, 10.0
Although some of the boxes might overlap, so you have to mess around with this function a little bit.
Example:
pawn Code:
CarShop[4] = TextDrawCreate(70.666618, 178.702178, "Infernus");
    TextDrawLetterSize(CarShop[4], 0.201111, 1.425777);
    TextDrawAlignment(CarShop[4], 1);
    TextDrawColor(CarShop[4], -1);
    TextDrawUseBox(CarShop[4], 1); //Added
    TextDrawTextSize(CarShop[4], 190.0, 17.0); //Added
    TextDrawBoxColor(CarShop[4], 0xFFFFFF00); //Added
    TextDrawSetShadow(CarShop[4], 0);
    TextDrawSetOutline(CarShop[4], 1);
    TextDrawBackgroundColor(CarShop[4], 51);
    TextDrawFont(CarShop[4], 2);
    TextDrawSetProportional(CarShop[4], 1);
    TextDrawSetSelectable(CarShop[4], true);
pawn Code:
TextDrawUseBox(CarShop[4], 1); //Added
Use a box to define the clickable area of the textdraw.
pawn Code:
TextDrawTextSize(CarShop[4], 190.0, 17.0); //Added
Define the size of the clickable area/box. It's quite hard to get the right offsets for each individual textdraw, but you'll get it eventually.
pawn Code:
TextDrawBoxColor(CarShop[4], 0xFFFFFF00); //Added
Set the box to invisible, so players cannot see the box.

References:
https://sampwiki.blast.hk/wiki/TextDrawTextSize
https://sampwiki.blast.hk/wiki/TextDrawUseBox
https://sampwiki.blast.hk/wiki/TextDrawBoxColor


Re : Selectable textdraws - nicolaskettler - 14.01.2015

It's simple to solve, you have to edit your textdraws to center alignement and put the textdrawtextsize to 11, 11
or 9, 9


Re: Selectable textdraws - vassilis - 14.01.2015

Solved thanks Threshold