SA-MP Forums Archive
Textdraw not clickable - 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: Textdraw not clickable (/showthread.php?tid=550833)



Textdraw not clickable - marwanalramahi - 15.12.2014

Hello i was trying to make a clickable textdraw yesterday and i made cmds and stuff but when i click the textdraws nothing happens I don't know what did i do wrong here are the codes:
cmds:
Код:
if (strcmp("/health", cmdtext, true, 10) == 0)
	{
		TextDrawShowForPlayer(playerid, Test);
		SelectTextDraw(playerid, 0xA3B4C5FF);
		return 1;
	}
	if (strcmp("/hidetext", cmdtext, true, 10) == 0)
	{
	     TextDrawHideForPlayer(playerid, Test);
		 TextDrawShowForPlayer(playerid, Cancel);
	     SendClientMessage(playerid, -1, "{FFFF00}*** {FFCC00}You have succesfully hidden the {FF0000}Textdraws{FFFF00} ***");
	     return 1;
	}
OnPlayerClickTextDraw:
Код:
public OnPlayerClickTextDraw(playerid, Text:clickedid)
{
        if(clickedid == Test)
                {
                SetPlayerHealth(playerid, 100);
                SendClientMessage(playerid, -1, "You have filled your hp");
                }
        else if(clickedid == Cancel)
                {
                TextDrawHideForPlayer(playerid, Test);
                TextDrawHideForPlayer(playerid, Cancel);
				SendClientMessage(playerid, -1, "{FFFF00}*** {FFCC00}You have cancelled {FF0000}Textdraws{FFFF00}!***");
                CancelSelectTextDraw(playerid);
 		 		}
    	return 1;
}]
OnFilterScriptInit:
Код:
Test = Text:TextDrawCreate(320.0,240.0,"Health~n~");
	TextDrawAlignment(Test, 2);
	TextDrawLetterSize(Test, 0.900000, 1.922222);
    TextDrawColor(Test, -1);
 	TextDrawSetOutline(Test, 0);
 	TextDrawSetProportional(Test, 1);
	Cancel = TextDrawCreate(320.000000, 180.000000, "Cancel~n~");
 	TextDrawAlignment(Cancel, 2);
	TextDrawLetterSize(Cancel, 0.900000, 1.922222);
 	TextDrawColor(Cancel, -1);
  	TextDrawSetOutline(Cancel, 0);
   	TextDrawSetProportional(Cancel, 1);



Re: Textdraw not clickable - Divergent - 15.12.2014

Since this is a filterscript, make sure that the OnPlayerClickTextDraw function is returning 0 in your gamemode otherwise the function isn't passed on to the filterscript.


Re: Textdraw not clickable - Ryz - 15.12.2014

Are u sure u done this?

pawn Код:
TextDrawSetSelectable(Cancel, true);



Re: Textdraw not clickable - marwanalramahi - 15.12.2014

I changed it to return 0 but still didn't work.


Re: Textdraw not clickable - marwanalramahi - 15.12.2014

@Ryz Thank you, i added the code and it worked +rep.