Ich habe versucht anklickbare Textdraws in mein Script mit einzubinden, allerdings will der/die/das Textdraw nicht so richtig bzw. man kann es nicht anklicken.
Was habe ich falsch gemacht.
Hier mein Code:
(Ich habe das zu Test zwecken nur in einem FS)
new Text:Textdraw0;
new Text:Textdraw1;
new Text:Textdraw2;
public OnFilterScriptInit()
{
print("|========[Textdraw Selection Test]========|");
Textdraw0 = TextDrawCreate(418.000000, 157.739990, "usebox");
TextDrawLetterSize(Textdraw0, 0.000000, 15.052223);
TextDrawTextSize(Textdraw0, 256.500000, 0.000000);
TextDrawAlignment(Textdraw0, 1);
TextDrawColor(Textdraw0, 0);
TextDrawUseBox(Textdraw0, true);
TextDrawBoxColor(Textdraw0, -1);
TextDrawSetShadow(Textdraw0, 0);
TextDrawSetOutline(Textdraw0, 0);
TextDrawBackgroundColor(Textdraw0, -2139062017);
TextDrawFont(Textdraw0, 0);
Textdraw1 = TextDrawCreate(283.000000, 158.480072, "Teleport Menu");
TextDrawLetterSize(Textdraw1, 0.449999, 1.600000);
TextDrawAlignment(Textdraw1, 1);
TextDrawColor(Textdraw1, -1);
TextDrawSetShadow(Textdraw1, 0);
TextDrawSetOutline(Textdraw1, 1);
TextDrawBackgroundColor(Textdraw1, 51);
TextDrawFont(Textdraw1, 1);
TextDrawSetProportional(Textdraw1, 1);
Textdraw2 = TextDrawCreate(303.000000, 182.560073, "Irgendwo");
TextDrawLetterSize(Textdraw2, 0.260500, 0.849600);
TextDrawTextSize(Textdraw2, 342.500000, 343.000000);
TextDrawAlignment(Textdraw2, 1);
TextDrawColor(Textdraw2, -1);
TextDrawSetShadow(Textdraw2, 0);
TextDrawSetOutline(Textdraw2, -1);
TextDrawBackgroundColor(Textdraw2, 51);
TextDrawFont(Textdraw2, 3);
TextDrawSetProportional(Textdraw2, 0);
TextDrawSetSelectable(Textdraw2, true);
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/cars", cmdtext, true, 10) == 0)
{
TextDrawShowForPlayer(playerid,Textdraw0);
TextDrawShowForPlayer(playerid,Textdraw1);
TextDrawShowForPlayer(playerid,Textdraw2);
SelectTextDraw(playerid, 0x00FFB4FF);
return 1;
}
return 0;
}
public OnPlayerClickTextDraw(playerid, Text:clickedid)
{
if(clickedid == Textdraw2)
{
CancelSelectTextDraw(playerid);
TextDrawHideForPlayer(playerid, Textdraw0);
TextDrawHideForPlayer(playerid, Textdraw1);
TextDrawHideForPlayer(playerid, Textdraw2);
SetPlayerPos(playerid,333,333,11111);
return 1;
}
return 1;
}