Selectable textdraw
#1

Hello, so with a friend of mine we've decided to script a small race server, and we have decided to do the registration/login system with textdraws, as we have created the textdraws and made the needed ones selectable we've noticed that, the selections are very bugged!
So here's a picture of the textdraws:


So the arrows should be selectable and are actually the only ones that work correctly, the "Enter password here" should work but it's not, and same goes for the Register box and the Cancel box, so here's our code:

pawn Код:
// Arrows

    Register_PTD[playerid][5] = CreatePlayerTextDraw(playerid, 272.033508, 274.051879, "LD_BEAT:right");
    PlayerTextDrawLetterSize(playerid, Register_PTD[playerid][5], 0.000000, 0.000000);
    PlayerTextDrawTextSize(playerid, Register_PTD[playerid][5], 13.000000, 13.000000);
    PlayerTextDrawAlignment(playerid, Register_PTD[playerid][5], 1);
    PlayerTextDrawColor(playerid, Register_PTD[playerid][5], -1);
    PlayerTextDrawSetShadow(playerid, Register_PTD[playerid][5], 0);
    PlayerTextDrawSetOutline(playerid, Register_PTD[playerid][5], 0);
    PlayerTextDrawBackgroundColor(playerid, Register_PTD[playerid][5], 255);
    PlayerTextDrawFont(playerid, Register_PTD[playerid][5], 4);
    PlayerTextDrawSetProportional(playerid, Register_PTD[playerid][5], 0);
    PlayerTextDrawSetShadow(playerid, Register_PTD[playerid][5], 0);
    PlayerTextDrawSetSelectable(playerid, Register_PTD[playerid][5], true);

    Register_PTD[playerid][6] = CreatePlayerTextDraw(playerid, 216.530120, 274.051879, "LD_BEAT:left");
    PlayerTextDrawLetterSize(playerid, Register_PTD[playerid][6], 0.000000, 0.000000);
    PlayerTextDrawTextSize(playerid, Register_PTD[playerid][6], 13.000000, 13.000000);
    PlayerTextDrawAlignment(playerid, Register_PTD[playerid][6], 1);
    PlayerTextDrawColor(playerid, Register_PTD[playerid][6], -1);
    PlayerTextDrawSetShadow(playerid, Register_PTD[playerid][6], 0);
    PlayerTextDrawSetOutline(playerid, Register_PTD[playerid][6], 0);
    PlayerTextDrawBackgroundColor(playerid, Register_PTD[playerid][6], 255);
    PlayerTextDrawFont(playerid, Register_PTD[playerid][6], 4);
    PlayerTextDrawSetProportional(playerid, Register_PTD[playerid][6], 0);
    PlayerTextDrawSetShadow(playerid, Register_PTD[playerid][6], 0);
    PlayerTextDrawSetSelectable(playerid, Register_PTD[playerid][6], true);

// Enter Pass..
    Register_PTD[playerid][17] = CreatePlayerTextDraw(playerid, 299.933441, 202.217575, "Enter_password_here");
    PlayerTextDrawLetterSize(playerid, Register_PTD[playerid][17], 0.160999, 0.815999);
    PlayerTextDrawTextSize(playerid, Register_PTD[playerid][17], 410.000000, 0.079998);
    PlayerTextDrawAlignment(playerid, Register_PTD[playerid][17], 1);
    PlayerTextDrawColor(playerid, Register_PTD[playerid][17], -1);
    PlayerTextDrawUseBox(playerid, Register_PTD[playerid][17], 1);
    PlayerTextDrawBoxColor(playerid, Register_PTD[playerid][17], 0);
    PlayerTextDrawSetShadow(playerid, Register_PTD[playerid][17], 0);
    PlayerTextDrawSetOutline(playerid, Register_PTD[playerid][17], 1);
    PlayerTextDrawBackgroundColor(playerid, Register_PTD[playerid][17], 255);
    PlayerTextDrawFont(playerid, Register_PTD[playerid][17], 2);
    PlayerTextDrawSetProportional(playerid, Register_PTD[playerid][17], 1);
    PlayerTextDrawSetShadow(playerid, Register_PTD[playerid][17], 0);
    PlayerTextDrawSetSelectable(playerid, Register_PTD[playerid][17], true);       

// Register box

    Register_PTD[playerid][18] = CreatePlayerTextDraw(playerid, 304.366119, 247.205764, "box");
    PlayerTextDrawLetterSize(playerid, Register_PTD[playerid][18], 0.000000, 1.917999);
    PlayerTextDrawTextSize(playerid, Register_PTD[playerid][18], 343.999816, 0.000000);
    PlayerTextDrawAlignment(playerid, Register_PTD[playerid][18], 1);
    PlayerTextDrawColor(playerid, Register_PTD[playerid][18], -1);
    PlayerTextDrawUseBox(playerid, Register_PTD[playerid][18], 1);
    PlayerTextDrawBoxColor(playerid, Register_PTD[playerid][18], -1061109505);
    PlayerTextDrawSetShadow(playerid, Register_PTD[playerid][18], 0);
    PlayerTextDrawSetOutline(playerid, Register_PTD[playerid][18], 0);
    PlayerTextDrawBackgroundColor(playerid, Register_PTD[playerid][18], 255);
    PlayerTextDrawFont(playerid, Register_PTD[playerid][18], 1);
    PlayerTextDrawSetProportional(playerid, Register_PTD[playerid][18], 1);
    PlayerTextDrawSetShadow(playerid, Register_PTD[playerid][18], 0);
    PlayerTextDrawSetSelectable(playerid, Register_PTD[playerid][18], true);

// Cancel box

    Register_PTD[playerid][19] = CreatePlayerTextDraw(playerid, 367.534179, 247.205764, "box");
    PlayerTextDrawLetterSize(playerid, Register_PTD[playerid][19], 0.000000, 1.917999);
    PlayerTextDrawTextSize(playerid, Register_PTD[playerid][19], 406.000000, 0.000000);
    PlayerTextDrawAlignment(playerid, Register_PTD[playerid][19], 1);
    PlayerTextDrawColor(playerid, Register_PTD[playerid][19], -1);
    PlayerTextDrawUseBox(playerid, Register_PTD[playerid][19], 1);
    PlayerTextDrawBoxColor(playerid, Register_PTD[playerid][19], -1061109505);
    PlayerTextDrawSetShadow(playerid, Register_PTD[playerid][19], 0);
    PlayerTextDrawSetOutline(playerid, Register_PTD[playerid][19], 0);
    PlayerTextDrawBackgroundColor(playerid, Register_PTD[playerid][19], 255);
    PlayerTextDrawFont(playerid, Register_PTD[playerid][19], 1);
    PlayerTextDrawSetProportional(playerid, Register_PTD[playerid][19], 1);
    PlayerTextDrawSetShadow(playerid, Register_PTD[playerid][19], 0);
    PlayerTextDrawSetSelectable(playerid, Register_PTD[playerid][19], true);
So the deal is that if I add PlayerTextDrawTextSize, the textdraw is no longer selectable, while when I remove it the textdraw is selectable BUT in all of the bottom right part of the textdraw that should be selectable..

I have ******d everything "textdraw offset bug" , "PlayerTextDrawTextSize problem", "textdraw selection problem", went on the samp wiki but I simply can't find the solution to this problem and so with that I would like to ask you, if you would help us out with this problem!

Thank you

EDIT: We have fixed it, the problem was that we had 0.0 on PlayerTextDrawSize
Reply
#2

PlayerTextDrawTextSize is definitely the way to go. However, it depends on how you adjust the code for it to fit your textdraw. Work around with it, example;

PlayerTextDrawTextSize(playerid, Register_PTD[playerid][17], 50, 10);

50 is for the X (left/right size)
10 is for the Y (up/down size)

Those coordinations might not be correct, but they will definitely be what you are looking for. And uh, do not work on the selectable login/register textdraws without having a stable gamemode. Those are mostly decorations and they should be done last (at least, that's what I think it's good doing)
Reply
#3

Quote:
Originally Posted by Private200
Посмотреть сообщение
PlayerTextDrawTextSize is definitely the way to go. However, it depends on how you adjust the code for it to fit your textdraw. Work around with it, example;

PlayerTextDrawTextSize(playerid, Register_PTD[playerid][17], 50, 10);

50 is for the X (left/right size)
10 is for the Y (up/down size)

Those coordinations might not be correct, but they will definitely be what you are looking for. And uh, do not work on the selectable login/register textdraws without having a stable gamemode. Those are mostly decorations and they should be done last (at least, that's what I think it's good doing)
Thanks for your reply but I fixed it(Added an EDIT: at the end of the topic), it was kinda simple tbh haha, something I didn't expect, I simply decided to change some coodinates in PlayerTextDrawTextSize, and it was because the 2nd coord was at 0.0, I randomly added a 1 and it worked haha
Reply
#4

Next time you can just refer to wiki. As I didn't invent that myself;

https://sampwiki.blast.hk/wiki/PlayerTextDrawTextSize

Quote:

y - The size on the Y axis (up/down) following the same 640x480 grid as TextDrawCreate.

1. When used with PlayerTextDrawAlignment of alignment 3 (right), the x and y are the coordinates of the left most corner of the box. For alignment 2 (center) the x and y values need to inverted (switch the two) and the x value is the overall width of the box. For all other alignments the x and y coordinates are for the right most corner of the box.

And this second PlayerTextDrawAlignment related stuff is really important as I have had problem regarding it myself. Having your Y axis on 0, meant having no selectable space at all. Box min Y is 5 (as wiki says: The TextDraw box starts 10.0 units up and 5.0 to the left as the origin (TextDrawCreate coordinate) ) and therefore it looks like there's no problem at all. But yeah-..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)