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



Clickable textdraws. - AfikAtashga - 09.05.2014

Hey everyone,
When i created the TD, and make him a clickable, it's not work.

Код:
	GLOBAL_TD[14] = TextDrawCreate(550.000000, 136.000000, "YES");
	TextDrawBackgroundColor(GLOBAL_TD[14], 255);
	TextDrawFont(GLOBAL_TD[14], 3);
	TextDrawLetterSize(GLOBAL_TD[14], 0.340000, 1.300000);
	TextDrawColor(GLOBAL_TD[14], 65535);
	TextDrawSetOutline(GLOBAL_TD[14], 0);
	TextDrawSetProportional(GLOBAL_TD[14], 0);
	TextDrawSetShadow(GLOBAL_TD[14], 1);
	TextDrawSetSelectable(GLOBAL_TD[14], true);

	GLOBAL_TD[15] = TextDrawCreate(589.000000, 136.000000, "NO");
	TextDrawBackgroundColor(GLOBAL_TD[15], 255);
	TextDrawFont(GLOBAL_TD[15], 3);
	TextDrawLetterSize(GLOBAL_TD[15], 0.340000, 1.300000);
	TextDrawColor(GLOBAL_TD[15], -16776961);
	TextDrawSetOutline(GLOBAL_TD[15], 0);
	TextDrawSetProportional(GLOBAL_TD[15], 0);
	TextDrawSetShadow(GLOBAL_TD[15], 1);
	TextDrawSetSelectable(GLOBAL_TD[15], true);
I make a little search, and i saw that i need to make TextDrawTextSize, but i don't know the coordinates.
Thanks for helping.


Re: Clickable textdraws. - AfikAtashga - 10.05.2014

UP! Please,
I Think i got a problem with TextDrawTextSize.

Код:
	GLOBAL_TD[14] = TextDrawCreate(550.000000, 136.000000, "YES");
	TextDrawBackgroundColor(GLOBAL_TD[14], 255);
	TextDrawFont(GLOBAL_TD[14], 3);
	TextDrawLetterSize(GLOBAL_TD[14], 0.340000, 1.299999);
	TextDrawColor(GLOBAL_TD[14], 65535);
	TextDrawSetOutline(GLOBAL_TD[14], 0);
	TextDrawSetProportional(GLOBAL_TD[14], 0);
	TextDrawSetShadow(GLOBAL_TD[14], 1);
	TextDrawUseBox(GLOBAL_TD[14], 1);
	TextDrawBoxColor(GLOBAL_TD[14], 0);
	TextDrawTextSize(GLOBAL_TD[14], 570.000000, 0.000000);
	TextDrawAlignment(GLOBAL_TD[14], 0);
	TextDrawSetSelectable(Text:GLOBAL_TD[14], true);

	GLOBAL_TD[15] = TextDrawCreate(589.000000, 136.000000, "NO");
	TextDrawBackgroundColor(GLOBAL_TD[15], 255);
	TextDrawFont(GLOBAL_TD[15], 3);
	TextDrawLetterSize(GLOBAL_TD[15], 0.340000, 1.299999);
	TextDrawColor(GLOBAL_TD[15], -16776961);
	TextDrawSetOutline(GLOBAL_TD[15], 0);
	TextDrawSetProportional(GLOBAL_TD[15], 0);
	TextDrawSetShadow(GLOBAL_TD[15], 1);
	TextDrawUseBox(GLOBAL_TD[15], 1);
	TextDrawBoxColor(GLOBAL_TD[15], 0);
	TextDrawTextSize(GLOBAL_TD[15], 602.000000, 0.000000);
	TextDrawAlignment(GLOBAL_TD[15], 0);
	TextDrawSetSelectable(Text:GLOBAL_TD[15], true);
I did this, but it still doesn't work. It's not able to click.


Re: Clickable textdraws. - AfikAtashga - 13.05.2014

UP..


Re: Clickable textdraws. - Madd92 - 13.05.2014

TextDrawSetSelectable is key here. You need to use that on the textdraws you want to be able to select.
pawn Код:
TextDrawSetSelectable(Text:i, 1);
The first parameter is the id of the textdraw and the second is the set value so 1 or 0.


Re: Clickable textdraws. - AfikAtashga - 14.05.2014

Quote:
Originally Posted by Madd92
Посмотреть сообщение
TextDrawSetSelectable is key here. You need to use that on the textdraws you want to be able to select.
pawn Код:
TextDrawSetSelectable(Text:i, 1);
The first parameter is the id of the textdraw and the second is the set value so 1 or 0.
I already did this.
Код:
TextDrawSetSelectable(Text:GLOBAL_TD[15], true);



Re: Clickable textdraws. - AfikAtashga - 16.05.2014

UP..


Re: Clickable textdraws. - xConnor - 16.05.2014

pawn Код:
public OnPlayerClickTextDraw(playerid, Text:clickedid)
{
    if(clickedid == GLOBAL_TD[15])
    {
         //your functions
         CancelSelectTextDraw(playerid);
    }
    return 1;
}



Re: Clickable textdraws. - AfikAtashga - 16.05.2014

Quote:
Originally Posted by xConnor
Посмотреть сообщение
pawn Код:
public OnPlayerClickTextDraw(playerid, Text:clickedid)
{
    if(clickedid == GLOBAL_TD[15])
    {
         //your functions
         CancelSelectTextDraw(playerid);
    }
    return 1;
}
WTF? i telling you i cannot to click on the TD, so you send me this code?!
Read again my FIRST message.


Re: Clickable textdraws. - edzis84 - 16.05.2014

I'm always using player textdraw for clickable textdraws.

In your case I think you don't need that Text:

Код:
TextDrawSetSelectable(GLOBAL_TD[14], 1);
This is how i'm creating them

Код:
Name[playerid] = CreatePlayerTextDraw(playerid, 550.000000, 136.000000, "YES");
PlayerTextDrawSetSelectable(playerid, Name[playerid], 1);



Re: Clickable textdraws. - AfikAtashga - 18.05.2014

Quote:
Originally Posted by edzis84
Посмотреть сообщение
I'm always using player textdraw for clickable textdraws.

In your case I think you don't need that Text:

Код:
TextDrawSetSelectable(GLOBAL_TD[14], 1);
This is how i'm creating them

Код:
Name[playerid] = CreatePlayerTextDraw(playerid, 550.000000, 136.000000, "YES");
PlayerTextDrawSetSelectable(playerid, Name[playerid], 1);
Thanks for the trying, but it isn't helping me. I need help in my case.
I'm sure in 100 precent that the problem is:
Код:
TextDrawTextSize(GLOBAL_TD[15], 602.000000, 0.000000);
I dont know which X&Y to write.