Selectable textdraws
#1

solved
Reply
#2

Any code? -_-
Reply
#3

Bump i added code too sorry for forgeting it
Reply
#4

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
Reply
#5

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

Solved thanks Threshold
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)