SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 30/09/2019, 03:44 PM   #1
Blake95
Little Clucker
 
Join Date: Nov 2016
Posts: 27
Reputation: 2
Default Clickable textdraw problem

Hi all!

I have a problem with clickable textdraws. I click textdraw, but don't react...

Code:
PhoneBtnMenu[playerid] = CreatePlayerTextDraw(playerid, 490.995941, 399.416625, "Menu");
	PlayerTextDrawLetterSize(playerid, PhoneBtnMenu[playerid], 0.156368, 0.929166);
	PlayerTextDrawTextSize(playerid, PhoneBtnMenu[playerid], 10.000000, 6.8827);
	PlayerTextDrawAlignment(playerid, PhoneBtnMenu[playerid], 2);
	PlayerTextDrawColor(playerid, PhoneBtnMenu[playerid], 255);
	//PlayerTextDrawUseBox(playerid, PhoneBtnMenu[playerid], 1);
	//PlayerTextDrawBoxColor(playerid, PhoneBtnMenu[playerid], 0);
	PlayerTextDrawSetShadow(playerid, PhoneBtnMenu[playerid], 0);
	PlayerTextDrawSetOutline(playerid, PhoneBtnMenu[playerid], 0);
	PlayerTextDrawBackgroundColor(playerid, PhoneBtnMenu[playerid], 255);
	PlayerTextDrawFont(playerid, PhoneBtnMenu[playerid], 1);
	PlayerTextDrawSetProportional(playerid, PhoneBtnMenu[playerid], 1);
	PlayerTextDrawSetShadow(playerid, PhoneBtnMenu[playerid], 0);
	PlayerTextDrawSetSelectable(playerid, PhoneBtnMenu[playerid], 1);
	

	PhoneBtnBack[playerid] = CreatePlayerTextDraw(playerid, 543.470092, 399.416625, "Back");
	PlayerTextDrawLetterSize(playerid, PhoneBtnBack[playerid], 0.156368, 0.929166);
	PlayerTextDrawTextSize(playerid, PhoneBtnBack[playerid], 10.000000, 6.8827);
	PlayerTextDrawAlignment(playerid, PhoneBtnBack[playerid], 2);
	PlayerTextDrawColor(playerid, PhoneBtnBack[playerid], 255);
	//PlayerTextDrawUseBox(playerid, PhoneBtnBack[playerid], 1);
	//PlayerTextDrawBoxColor(playerid, PhoneBtnBack[playerid], 0);
	PlayerTextDrawSetShadow(playerid, PhoneBtnBack[playerid], 0);
	PlayerTextDrawSetOutline(playerid, PhoneBtnBack[playerid], 0);
	PlayerTextDrawBackgroundColor(playerid, PhoneBtnBack[playerid], 255);
	PlayerTextDrawFont(playerid, PhoneBtnBack[playerid], 1);
	PlayerTextDrawSetProportional(playerid, PhoneBtnBack[playerid], 1);
	PlayerTextDrawSetShadow(playerid, PhoneBtnBack[playerid], 0);
What's the problem? Thanks
Blake95 is offline   Reply With Quote
Old 30/09/2019, 04:13 PM   #2
Kwarde
High-roller
 
Kwarde's Avatar
 
Join Date: Nov 2009
Location: The Netherlands
Posts: 2,634
Reputation: 1653
Default Re: Clickable textdraw problem

May I assume you actually used the OnPlayerClickPlayerTextDraw() callback? Since you only showed the creation.. The PhoneBtnBack is now selectable, PhoneBtnMenu is. And the ...DrawTextSize looks good (neither negative nor zero).

If you need the PhoneBtnBack to be selectable, you forgot to include the ...SetSelectable function there
Kwarde is online now   Reply With Quote
Old 30/09/2019, 04:35 PM   #3
Blake95
Little Clucker
 
Join Date: Nov 2016
Posts: 27
Reputation: 2
Default Re: Clickable textdraw problem

Quote:
Originally Posted by Kwarde View Post
May I assume you actually used the OnPlayerClickPlayerTextDraw() callback? Since you only showed the creation.. The PhoneBtnBack is now selectable, PhoneBtnMenu is. And the ...DrawTextSize looks good (neither negative nor zero).

If you need the PhoneBtnBack to be selectable, you forgot to include the ...SetSelectable function there
Doesn't work.
Code:
if(playertextid == PhoneBtnMenu[playerid])
		{
		    showPhoneMenu(playerid, true, cache_phone[playerid][current_page]);
		}
BUT THIS WORK:

Code:
if(playertextid == PhoneSwitch[playerid])
		{
		        showPhoneMenu(playerid, true, cache_phone[playerid][current_page]);
		}
Code:
PhoneSwitch[playerid] = CreatePlayerTextDraw(playerid, 546.581420, 347.499877, "LD_BEAT:circle");
	PlayerTextDrawLetterSize(playerid, PhoneSwitch[playerid], 0.000000, 0.000000);
	PlayerTextDrawTextSize(playerid, PhoneSwitch[playerid], 12.000000, 13.000000);
	PlayerTextDrawAlignment(playerid, PhoneSwitch[playerid], 1);
	PlayerTextDrawColor(playerid, PhoneSwitch[playerid], -1);
	PlayerTextDrawSetShadow(playerid, PhoneSwitch[playerid], 0);
	PlayerTextDrawSetOutline(playerid, PhoneSwitch[playerid], 0);
	PlayerTextDrawBackgroundColor(playerid, PhoneSwitch[playerid], 255);
	PlayerTextDrawFont(playerid, PhoneSwitch[playerid], 4);
	PlayerTextDrawSetProportional(playerid, PhoneSwitch[playerid], 0);
	PlayerTextDrawSetShadow(playerid, PhoneSwitch[playerid], 0);
	PlayerTextDrawSetSelectable(playerid, PhoneSwitch[playerid], true);
Blake95 is offline   Reply With Quote
Old 30/09/2019, 04:45 PM   #4
xRadical3
Huge Clucker
 
xRadical3's Avatar
 
Join Date: May 2017
Location: Iran
Posts: 458
Reputation: 17
Default Re: Clickable textdraw problem

I've had this problem before. But I used .txd images (Sprite) for selectable textdraws and my problem was fixed.
Use `ld_drv:blkdot` or https://forum.sa-mp.com/showthread.php?t=601401

(Don't forget to set selectable true)

EDIT:
Quote:
Originally Posted by Blake95 View Post
BUT THIS WORK:

Code:
if(playertextid == PhoneSwitch[playerid])
		{
		        showPhoneMenu(playerid, true, cache_phone[playerid][current_page]);
		}
Code:
PhoneSwitch[playerid] = CreatePlayerTextDraw(playerid, 546.581420, 347.499877, "LD_BEAT:circle");
	PlayerTextDrawLetterSize(playerid, PhoneSwitch[playerid], 0.000000, 0.000000);
	PlayerTextDrawTextSize(playerid, PhoneSwitch[playerid], 12.000000, 13.000000);
	PlayerTextDrawAlignment(playerid, PhoneSwitch[playerid], 1);
	PlayerTextDrawColor(playerid, PhoneSwitch[playerid], -1);
	PlayerTextDrawSetShadow(playerid, PhoneSwitch[playerid], 0);
	PlayerTextDrawSetOutline(playerid, PhoneSwitch[playerid], 0);
	PlayerTextDrawBackgroundColor(playerid, PhoneSwitch[playerid], 255);
	PlayerTextDrawFont(playerid, PhoneSwitch[playerid], 4);
	PlayerTextDrawSetProportional(playerid, PhoneSwitch[playerid], 0);
	PlayerTextDrawSetShadow(playerid, PhoneSwitch[playerid], 0);
	PlayerTextDrawSetSelectable(playerid, PhoneSwitch[playerid], true);
Because this textdraw is sprite.
xRadical3 is online now   Reply With Quote
Old 30/09/2019, 04:53 PM   #5
Blake95
Little Clucker
 
Join Date: Nov 2016
Posts: 27
Reputation: 2
Default Re: Clickable textdraw problem

Quote:
Originally Posted by Vizi10 View Post
I've had this problem before. But I used .txd images (Sprite) for selectable textdraws and my problem was fixed.
Use `ld_drv:blkdot` or https://forum.sa-mp.com/showthread.php?t=601401

(Don't forget to set selectable true)

EDIT:


Because this textdraw is sprite.
Why? I need only letters.. not image
Blake95 is offline   Reply With Quote
Old 30/09/2019, 04:57 PM   #6
Kwarde
High-roller
 
Kwarde's Avatar
 
Join Date: Nov 2009
Location: The Netherlands
Posts: 2,634
Reputation: 1653
Default Re: Clickable textdraw problem

EDIT:
The point is that it has to be a menu text/button that needs to be clicked, not an image.
- No longer need to say that since OP replied while I was typing this message

Years ago I managed that. I know that I had problems too. I am not sure anymore how I fixed it but I think I can slightly remember that I used a box for the menu button (except not by using PlayerTextDrawUseBox, but creating a block behind the text that was clickable.
Either that or I díd use the ..UseBox. I think the text was hard to select because only the middle part of the letters could be selected (even with SetProportional).
Perhaps trying to make the letters bigger to see what it does. If if then works you either need the letters bigger, or create a box behind the text that is selectable.

Since I am not 100% anymore this might not work, but then again it also might. I would test it myself but I don't have GTA:SA installed at the moment
Kwarde is online now   Reply With Quote
Old 30/09/2019, 05:07 PM   #7
xRadical3
Huge Clucker
 
xRadical3's Avatar
 
Join Date: May 2017
Location: Iran
Posts: 458
Reputation: 17
Default Re: Clickable textdraw problem

https://imgur.com/a/xIxTk9s
Ok. Look at my textdraw, cancel and next and previous buttons. These are not selectable but the boxes behind them are selectable.

I couldn't find a way to fix the selectable letter texts,
but I used this method and it worked.
You can also use this method...
xRadical3 is online now   Reply With Quote
Old 30/09/2019, 05:10 PM   #8
Kwarde
High-roller
 
Kwarde's Avatar
 
Join Date: Nov 2009
Location: The Netherlands
Posts: 2,634
Reputation: 1653
Default Re: Clickable textdraw problem

Good. Then atleast you can move forward now and eventually fix it later.
What about the ...UseBox()?
Kwarde is online now   Reply With Quote
Old 02/10/2019, 02:42 PM   #9
Blake95
Little Clucker
 
Join Date: Nov 2016
Posts: 27
Reputation: 2
Default Re: Clickable textdraw problem

Quote:
Originally Posted by Vizi10 View Post
https://imgur.com/a/xIxTk9s
Ok. Look at my textdraw, cancel and next and previous buttons. These are not selectable but the boxes behind them are selectable.

I couldn't find a way to fix the selectable letter texts,
but I used this method and it worked.
You can also use this method...
Code:
PhoneBtnL[playerid] = CreatePlayerTextDraw(playerid, 480.988555, 412.833404, "");
	PlayerTextDrawLetterSize(playerid, PhoneBtnL[playerid], 0.000000, 0.000000);
	PlayerTextDrawTextSize(playerid, PhoneBtnL[playerid], 19.000000, 10.000000);
	PlayerTextDrawAlignment(playerid, PhoneBtnL[playerid], 1);
	PlayerTextDrawColor(playerid, PhoneBtnL[playerid], -1717986817);
	PlayerTextDrawSetShadow(playerid, PhoneBtnL[playerid], 0);
	PlayerTextDrawUseBox(playerid, PhoneBtnR[playerid], 1);
	PlayerTextDrawBoxColor(playerid, PhoneBtnR[playerid], -1717986817);
	PlayerTextDrawSetOutline(playerid, PhoneBtnL[playerid], 0);
	PlayerTextDrawBackgroundColor(playerid, PhoneBtnL[playerid], -1717986817);
	PlayerTextDrawFont(playerid, PhoneBtnL[playerid], 5);
	PlayerTextDrawSetProportional(playerid, PhoneBtnL[playerid], 1);
	PlayerTextDrawSetShadow(playerid, PhoneBtnL[playerid], 0);
	PlayerTextDrawSetSelectable(playerid, PhoneBtnL[playerid], true);
	PlayerTextDrawSetPreviewModel(playerid, PhoneBtnL[playerid], 0);
	PlayerTextDrawSetPreviewRot(playerid, PhoneBtnL[playerid], 0.000000, 0.000000, 0.000000, -1.000000);
Why doesnt click this box textdraw
Blake95 is offline   Reply With Quote
Old 02/10/2019, 04:05 PM   #10
Pottus
High-roller
 
Pottus's Avatar
 
Join Date: Jun 2012
Posts: 4,883
Reputation: 1321
Default Re: Clickable textdraw problem

Adjust the textsize always the same thing with this. You are also using the wrong kind of textdraws these shouldn't be player textdraws.
Pottus is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Clickable TextDraw Problem adri[4]Life Scripting Help 2 05/06/2017 05:41 PM
Clickable TextDraw problem GGRPSkripter Scripting Help 3 09/08/2015 01:28 PM
Problem with clickable textdraw TonyII Scripting Help 1 27/01/2014 02:35 PM
Clickable textdraw problem 2K9CON Scripting Help 3 19/03/2013 09:27 PM
Clickable textdraw problem Tamer Scripting Help 0 03/02/2013 10:17 AM


All times are GMT. The time now is 08:31 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.