08.08.2012, 18:29
I'm trying to create 2 buttons with textdraws but it seems like I'm unable to click them. I got everything set up like it's supposed to but somehow I can't seem to click them.
I created my textdraws correctly;
AS you can see I did set "TextDrawSetSelectable" to "1". I also enable "SelectTextDraw(playerid, color)" The following callback gets called when I press exit (so I assume thats working) but it won't work for either of my textdraws.
Could anyone see what I'm doing wrong?
I created my textdraws correctly;
pawn Код:
// On top of script
enum some_enum {
Text:TD_gametype,
Text:TD_leftbutton,
Text:TD_rightbutton,
Text:TD_bottomline,
Text:TD_topline,
Text:TD_leftline,
Text:TD_rightline,
};
new GT[MAX_PLAYERS][some_enum];
// Under ongamemodeinit (this works)
GT[playerid][TD_leftbutton] = TextDrawCreate(204.000000, 365.000000, "<");
TextDrawAlignment(GT[playerid][TD_leftbutton], 2);
TextDrawBackgroundColor(GT[playerid][TD_leftbutton], 255);
TextDrawFont(GT[playerid][TD_leftbutton], 1);
TextDrawLetterSize(GT[playerid][TD_leftbutton], 0.469999, 3.699998);
TextDrawColor(GT[playerid][TD_leftbutton], -1);
TextDrawSetOutline(GT[playerid][TD_leftbutton], 1);
TextDrawSetProportional(GT[playerid][TD_leftbutton], 1);
TextDrawUseBox(GT[playerid][TD_leftbutton], 1);
TextDrawBoxColor(GT[playerid][TD_leftbutton], 255);
TextDrawTextSize(GT[playerid][TD_leftbutton], 0.000000, 34.000000);
TextDrawSetSelectable(GT[playerid][TD_leftbutton], 1);
GT[playerid][TD_rightbutton] = TextDrawCreate(434.000000, 365.000000, ">");
TextDrawAlignment(GT[playerid][TD_rightbutton], 2);
TextDrawBackgroundColor(GT[playerid][TD_rightbutton], 255);
TextDrawFont(GT[playerid][TD_rightbutton], 1);
TextDrawLetterSize(GT[playerid][TD_rightbutton], 0.469999, 3.699998);
TextDrawColor(GT[playerid][TD_rightbutton], -1);
TextDrawSetOutline(GT[playerid][TD_rightbutton], 1);
TextDrawSetProportional(GT[playerid][TD_rightbutton], 1);
TextDrawUseBox(GT[playerid][TD_rightbutton], 1);
TextDrawBoxColor(GT[playerid][TD_rightbutton], 255);
TextDrawTextSize(GT[playerid][TD_rightbutton], 0.000000, 34.000000);
TextDrawSetSelectable(GT[playerid][TD_rightbutton], 1);
pawn Код:
public OnPlayerClickTextDraw(playerid, Text:clickedid) {
// This DOES get called when I press exit (as it's supposed to)
if(clickedid == GT[playerid][TD_leftbutton]) {
// This isnt working
}
else if(clickedid == GT[playerid][TD_rightbutton]) {
// this isnt working either
}
}