SA-MP Forums Archive
Selectable Text Draw's - 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 Text Draw's (/showthread.php?tid=660428)



Selectable Text Draw's - ApolloScripter - 03.11.2018

Can someone help me? I have a problem with Selectable Text Draw's, I searched a lot for the internet and in wiki's, I followed the tutorials, but I'm still facing the same problem.

My case is as follows, Text Draw was supposed to change color when the mouse cursor is on top of it, however it changes color when the mouse is in another position away from TXD, I tried to alter the PlayerTextDrawTextSize but I still can not make work

My declaration:
pawn Code:
new PlayerText:MN_BotaoIR[MAX_PLAYERS];
My TXD:
pawn Code:
MN_BotaoIR[playerid] = CreatePlayerTextDraw(playerid, 375.500000, 238.933288, ">");
    PlayerTextDrawLetterSize(playerid, MN_BotaoIR[playerid], 0.715499, 3.740442);
    PlayerTextDrawAlignment(playerid, MN_BotaoIR[playerid], 1);
    PlayerTextDrawColor(playerid, MN_BotaoIR[playerid], -1);
    PlayerTextDrawSetShadow(playerid, MN_BotaoIR[playerid], 0);
    PlayerTextDrawSetOutline(playerid, MN_BotaoIR[playerid], 1);
    PlayerTextDrawBackgroundColor(playerid, MN_BotaoIR[playerid], 51);
    PlayerTextDrawFont(playerid, MN_BotaoIR[playerid], 1);
    PlayerTextDrawSetProportional(playerid, MN_BotaoIR[playerid], 1);
    PlayerTextDrawTextSize(playerid, MN_BotaoIR[playerid], 10.000000, 10.000000);
    PlayerTextDrawSetSelectable(playerid, MN_BotaoIR[playerid], true);



Re: Selectable Text Draw's - khRamin78 - 03.11.2018

Quote:
Originally Posted by ApolloScripter
View Post
Can someone help me? I have a problem with Selectable Text Draw's, I searched a lot for the internet and in wiki's, I followed the tutorials, but I'm still facing the same problem.

My case is as follows, Text Draw was supposed to change color when the mouse cursor is on top of it, however it changes color when the mouse is in another position away from TXD, I tried to alter the PlayerTextDrawTextSize but I still can not make work

My declaration:
pawn Code:
new PlayerText:MN_BotaoIR[MAX_PLAYERS];
My TXD:
pawn Code:
MN_BotaoIR[playerid] = CreatePlayerTextDraw(playerid, 375.500000, 238.933288, ">");
    PlayerTextDrawLetterSize(playerid, MN_BotaoIR[playerid], 0.715499, 3.740442);
    PlayerTextDrawAlignment(playerid, MN_BotaoIR[playerid], 1);
    PlayerTextDrawColor(playerid, MN_BotaoIR[playerid], -1);
    PlayerTextDrawSetShadow(playerid, MN_BotaoIR[playerid], 0);
    PlayerTextDrawSetOutline(playerid, MN_BotaoIR[playerid], 1);
    PlayerTextDrawBackgroundColor(playerid, MN_BotaoIR[playerid], 51);
    PlayerTextDrawFont(playerid, MN_BotaoIR[playerid], 1);
    PlayerTextDrawSetProportional(playerid, MN_BotaoIR[playerid], 1);
    PlayerTextDrawTextSize(playerid, MN_BotaoIR[playerid], 10.000000, 10.000000);
    PlayerTextDrawSetSelectable(playerid, MN_BotaoIR[playerid], true);
if you are using a textdraw editor simply enable usebox for textdraw and the resize the use box of textdraw in which you want to fit with your clickable area


Re: Selectable Text Draw's - ApolloScripter - 03.11.2018

And how do I change the size of the UseBox?


Re: Selectable Text Draw's - GTLS - 03.11.2018

Which TDEditor are you using?


Re: Selectable Text Draw's - TheToretto - 03.11.2018

Let me guess you're using iPleomax's TDEditor? If not just use it, it's by far the most user friendly ever. And there is an icon "size" to play with the size.


Re: Selectable Text Draw's - ApolloScripter - 03.11.2018

Quote:
Originally Posted by TheToretto
View Post
Let me guess you're using iPleomax's TDEditor? If not just use it, it's by far the most user friendly ever. And there is an icon "size" to play with the size.
Yes man, i just do it, but when i go to check if works in server, still the same thing, i pass the mouse away from the button and he change the color, but the cursor isn't over it.

The TXD that doesn't work (with TextSize)
pawn Code:
MN_BotaoSAIR[playerid] = CreatePlayerTextDraw(playerid, 360.500000, 383.044464, "SAIR");
    PlayerTextDrawLetterSize(playerid, MN_BotaoSAIR[playerid], 0.324999, 1.245332);
    PlayerTextDrawTextSize(playerid, MN_BotaoSAIR[playerid], 345.000000, 15.000000);
    PlayerTextDrawAlignment(playerid, MN_BotaoSAIR[playerid], 1);
    PlayerTextDrawColor(playerid, MN_BotaoSAIR[playerid], -1);
    PlayerTextDrawSetShadow(playerid, MN_BotaoSAIR[playerid], 0);
    PlayerTextDrawSetOutline(playerid, MN_BotaoSAIR[playerid], 1);
    PlayerTextDrawBackgroundColor(playerid, MN_BotaoSAIR[playerid], 51);
    PlayerTextDrawFont(playerid, MN_BotaoSAIR[playerid], 2);
    PlayerTextDrawSetProportional(playerid, MN_BotaoSAIR[playerid], 1);
    PlayerTextDrawSetSelectable(playerid, MN_BotaoSAIR[playerid], true);
My specific function
pawn Code:
FecharMN_Tudo(playerid)
{
    PlayerTextDrawHide(playerid, MN_BotaoSAIR[playerid]);  
}
The command, to check if was clicked
pawn Code:
public OnPlayerClickPlayerTextDraw(playerid, PlayerText:playertextid)
{
    if(playertextid == MN_BotaoSAIR[playerid])
    {
        FecharMN_Tudo(playerid);
    }
    return 1;
}



Re: Selectable Text Draw's - lollypap54 - 03.11.2018

Change this line:
Code:
PlayerTextDrawTextSize(playerid, MN_BotaoSAIR[playerid], 345.000000, 15.000000);
To:
Code:
PlayerTextDrawTextSize(playerid, MN_BotaoSAIR[playerid], 390.000000, 10.000000);
This size is somewhat good, if you want to make it perfect, add/subtract those numbers little bit.
Also, TextDrawSize X parameter has to be higher than textdraw's X position (So 345 is not correct)


Re: Selectable Text Draw's - ApolloScripter - 03.11.2018

Quote:
Originally Posted by lollypap54
View Post
Change this line:
Code:
PlayerTextDrawTextSize(playerid, MN_BotaoSAIR[playerid], 345.000000, 15.000000);
To:
Code:
PlayerTextDrawTextSize(playerid, MN_BotaoSAIR[playerid], 390.000000, 10.000000);
This size is somewhat good, if you want to make it perfect, add/subtract those numbers little bit.
Also, TextDrawSize X parameter has to be higher than textdraw's X position (So 345 is not correct)
Thank you very much, it works!.