Textdraw not clickable
#1

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);
Reply
#2

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.
Reply
#3

Are u sure u done this?

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

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)