double click on textdraw
#1

I created a sales list and I want to put the players to give 2 click the product to buy, could someone help me? tried in various ways and can not

Код:
public OnPlayerClickTextDraw(playerid, Text:clickedid)
{
	for(new i = 3; i < 13; i++)
	{
		if(clickedid == TD_ListBox[i])
		{
      		TimeClickTD_List[playerid] = gettime() + 1;
   			IDClickTD_List[playerid] = i;

   			if(gettime() < TimeClickTD_List[playerid] && IDClickTD_List[playerid] == i)
   			{

				return 1;
			}
		}
	}
	return 1;
}
Reply
#2

Rather than get technical, keep it simple and simply track how many clicks they have done to get into that menu.

Like, why track the MS from GetTime, when all you need to do is do a simple step-gate, where if they click once, they need to click a second time.

I don't think you'd be able to get the level of 'double-clicking' that people would be expecting, so just make it count up, each click, and then do that if 2 in the same order are done, that is what's wanted.

If you do 1 click on each button then, your script should pick that up and ignore it.
Reply
#3

Sorry I'm a little new to the subject, can you give me some examples?
Reply
#4

Enum is likely to be better than the arrays below, PVar is likely to be too slow for this implementation.

Код:
new LastClickedDialog[MAX_PLAYERS], LastClickedEntry[MAX_PLAYERS];
One would be for tracking the dialog, the other would be checking the entry they clicked on.

I myself haven't worked with Dialogs much, but there'll definitely be a way of doing what you want.




Another random option, could be a simple 'confirm' dialog after those sort of dialogs, showing what they have chosen to receive and giving them the option to cancel it. (This would likely be a more simple option)
Reply
#5

Its because you set the new info before checking:
Код:
public OnPlayerClickTextDraw(playerid, Text:clickedid)
{
	for(new i = 3; i < 13; i++)
	{
		if(clickedid == TD_ListBox[i])
		{
      		TimeClickTD_List[playerid] = gettime() + 1;
   			IDClickTD_List[playerid] = i;

   			if(gettime() < TimeClickTD_List[playerid] && IDClickTD_List[playerid] == i)
   			{

				return 1;
			}
		}
	}
	return 1;
}
^ This way your if check will always work!



But this will work:
Код:
public OnPlayerClickTextDraw(playerid, Text:clickedid)
{
	for(new i = 3; i < 13; i++)
	{
		if(clickedid == TD_ListBox[i])
		{
   			if(gettime() < TimeClickTD_List[playerid] && IDClickTD_List[playerid] == i)
   			{

				return 1;
			}

      		TimeClickTD_List[playerid] = gettime() + 1;
   			IDClickTD_List[playerid] = i;

			break; // also add a break since one item can be clicked at a time
		}
	}
	return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)