SA-MP Forums Archive
Need help with TextDrawTextSize - 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: Need help with TextDrawTextSize (/showthread.php?tid=332935)



Need help with TextDrawTextSize | A problem with selectable textdraws. - WooTFTW - 09.04.2012

pawn Код:
cCharacter1[playerid] = CreatePlayerTextDraw(playerid, 547.000000, 170.000000, charName[0]);
                    PlayerTextDrawAlignment(playerid, cCharacter1[playerid], 2);
                    PlayerTextDrawBackgroundColor(playerid, cCharacter1[playerid], 255);
                    PlayerTextDrawFont(playerid, cCharacter1[playerid], 2);
                    PlayerTextDrawLetterSize(playerid, cCharacter1[playerid], 0.220000, 1.200000);
                    PlayerTextDrawColor(playerid, cCharacter1[playerid], -1);
                    PlayerTextDrawSetOutline(playerid, cCharacter1[playerid], 0);
                    PlayerTextDrawSetProportional(playerid, cCharacter1[playerid], 1);
                    PlayerTextDrawSetShadow(playerid, cCharacter1[playerid], 0);

                    PlayerTextDrawSetSelectable(playerid, cCharacter1[playerid], 1);
                    PlayerTextDrawShow(playerid, cCharacter1[playerid]);
                    PlayerTextDrawTextSize(playerid, cCharacter1[playerid], 23.0, 23.0);
I know that the problem is in PlayerTextDrawTextSize, i don't get what coords I should put in there, I have looked at other scripts, which uses the same function, I just don't get how I am supposed to get the coords. When I hover the mouse over this text, it's ok, but if I hover it under the text, it sets the hover color.


Re: Need help with TextDrawTextSize - Hiddos - 09.04.2012

Basically, it means how many points to the right/down on the screen from the top-left corner of the textdraw the size of the overlay part is for clickable textdraws.

For example:
pawn Код:
new Text:td = TextDrawCreate(120.0, 24.0, "herro");
TextDrawTextSize(td, 20.0, 80.0);
This means that the textdraw lights up in the area of x(120.0 - 140.0) and y(24.0 - 104.0).


Re: Need help with TextDrawTextSize - WooTFTW - 09.04.2012

Quote:
Originally Posted by Hiddos
Посмотреть сообщение
Basically, it means how many points to the right/down on the screen from the top-left corner of the textdraw the size of the overlay part is for clickable textdraws.

For example:
pawn Код:
new Text:td = TextDrawCreate(120.0, 24.0, "herro");
TextDrawTextSize(td, 20.0, 80.0);
This means that the textdraw lights up in the area of x(120.0 - 140.0) and y(24.0 - 104.0).
Thanks, I'll try to play around with it.
Anyways, it isn't possible to use with boxes with text in it? Because the box uses the info for the box sizes of TextDrawTextSize.
And how do you personally get the coords of x,y?


Re: Need help with TextDrawTextSize - CyNiC - 09.04.2012

Use a textdraw text like "_", this way the box textdraw will not be coloured when hover over but will work.


Re: Need help with TextDrawTextSize - WooTFTW - 09.04.2012

Yellow is the hover color.
NOTE: It didn't take screenshot of the cursor, don't know why, render problems? So i drew it myself.

1. The mouse is out of the 'hover zone'.
2. The mouse is in the 'hover zone'.
3. The mouse is under the box and in the box's 'hover zone'
(See attachments.)

Someone, please, help me fix this problem.

The box:
pawn Код:
CharacterButton[playerid] = CreatePlayerTextDraw(playerid, 319.000000, 390.000000, "Spelet ar:~g~ Izvelieties telu");
PlayerTextDrawTextSize(playerid, CharacterButton[playerid], 390.000000, 140.000000);
The names:
pawn Код:
cCharacter1[playerid] = CreatePlayerTextDraw(playerid, 547.000000, 170.000000, charName[0]);
PlayerTextDrawTextSize(playerid, cCharacter1[playerid], 15.0, 15.0);



Re: Need help with TextDrawTextSize - CyNiC - 09.04.2012

2. The mouse is in the 'hover zone'.
3. The mouse is under the box and in the box's 'hover zone'


Try to decrease the Y size.


Re: Need help with TextDrawTextSize - WooTFTW - 10.04.2012

Quote:
Originally Posted by CyNiC
Посмотреть сообщение
2. The mouse is in the 'hover zone'.
3. The mouse is under the box and in the box's 'hover zone'


Try to decrease the Y size.
Thanks, I fixed the Box size, but I don't know how to fix the other textdraw.
EDIT: OMG, I fixed this.
I had PlayerTextDrawTextSize after PlayerTextDrawSetSelectable, it needed to be vice versa!!