28.07.2013, 10:41
Hi all,
I have a problem with my selectable textdraws.
Problem 1:
I can click on the textdraw if the mouse is on the same line as the textdraw
Example:
Problem 2:
When i click on the second textdraw its selecting the first textdraw to.
Example:
Problem 3:
When i click on the textdraw nothing happends.
Code:
How can i fix those problems?
Admigo
I have a problem with my selectable textdraws.
Problem 1:
I can click on the textdraw if the mouse is on the same line as the textdraw
Example:
pawn Код:
x Textdraw1//x is my mouse, when i have it there it selects the textdraw.
Textdraw2
When i click on the second textdraw its selecting the first textdraw to.
Example:
pawn Код:
Textdraw1//this textdraw is also selected
Textdraw2//when i have my mouse on this textdraw
When i click on the textdraw nothing happends.
Code:
pawn Код:
//ongamemodeinit
for(new line = 0; line < MAX_MAPS; line++)
{
TextDraw141[0] = TextDrawCreate(540.000000, 241.250000, MessageStr[0]);
TextDraw141[1] = TextDrawCreate(540.000000, 248.250000, MessageStr[1]);
/*TextDraw141[3] = TextDrawCreate(265.000000, 255.250000, MessageStr[2]);
TextDraw141[4] = TextDrawCreate(265.000000, 262.250000, MessageStr[3]);
TextDraw141[5] = TextDrawCreate(265.000000, 269.250000, MessageStr[4]);
TextDraw141[6] = TextDrawCreate(265.000000, 276.250000, MessageStr[5]);
TextDraw141[7] = TextDrawCreate(265.000000, 283.250000, MessageStr[6]);
TextDraw141[8] = TextDrawCreate(265.000000, 290.250000, MessageStr[7]);
TextDraw141[9] = TextDrawCreate(265.000000, 297.250000, MessageStr[8]);
TextDraw141[10] = TextDrawCreate(265.000000, 304.250000, MessageStr[9]);*/
}
for(new line = 0; line < MAX_MAPS; line++)
{
TextDrawLetterSize(TextDraw141[line], 0.299999,0.700000);
TextDrawSetShadow(TextDraw141[line], 0);
//TextDrawTextSize(TextDraw141[line], 265.000000+100, 510.000000);
TextDrawFont(TextDraw141[line], 1);
TextDrawSetOutline(TextDraw141[line], 1);
TextDrawAlignment(TextDraw141[line], 2);
TextDrawSetSelectable(TextDraw141[line], true);
}
//showing the textdraw and make it selectable
stock VoteMap()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
SelectTextDraw(i, COLOR_RED);
}
}
for(new m = 0; m != MAX_MAPS; m++)
{
format(MessageStr[m], 128, "~y~[%d]~W~%s~n~",m+1,GetMapName(m+1));
TextDrawSetString(TextDraw141[m],MessageStr[m]);
TextDrawShowForAll(TextDraw141[m]);
}
}
public OnPlayerClickTextDraw(playerid, Text:clickedid)
{
new string[250];
if(_:clickedid != INVALID_TEXT_DRAW) // If the player clicked a valid textdraw, continue with the coding. (_:var removes the Text: tag, to avoid tag mismatch)
{
if(clickedid == TextDraw141[0])
{
format(string,sizeof(string),"You have voted for the map %s ",GetMapName(1));
SendClientMessage(playerid,-1,string);
}
else if(clickedid == TextDraw141[1]) // Same as above, but for SF
{
format(string,sizeof(string),"You have voted for the map %s ",GetMapName(2));
SendClientMessage(playerid,-1,string);
}
}
CancelSelectTextDraw(playerid);
return 1;
}
Admigo