_:clickedid
#1

I have a problem with pressing ESC during SelectTextdraw.

So i have done this exactly like i did with other GUI's made with tds.
The problem with selecting the amount the players want to drop, is that when the screen gets activated, it becomes stuck in a neverending loop thats calling HideDropAmountSelection()

I have added printf messages under the ==invalid_text_draw check and that one gets spammed into the console as well as it keeps hiding the drop amount selection.

If i remove the code i colored red, if(clickedid == InventorySDATD3) works fine.

How to fix this?

My code:

Code:
if(_:clickedid == INVALID_TEXT_DRAW)
	{
	    if(DailyGiftsMenu[playerid] == 1)
	    {
            ShowDaily(playerid);
	    }
	    if(usingitemdb[playerid] == 1)
	    {
      		HideItemDBTD(playerid);
	    	ItemDataBasePage[playerid] = 0;
	    }
	    if(usingpolicecomputer[playerid] == 1)
	    {
      		HidePoliceComputer(playerid);
	    }
	    if(usinginventory[playerid] == 1)
	    {
	    	HideInventory(playerid);
	    }
     	if(IsLogged[playerid]==0)
		{
	    	HideLoginScreen(playerid);
	    }
	    if(usingcharselection[playerid] == 1)
	    {
	    	HideCharacterSelection(playerid);
	    }
	    if(usingdropamountselection[playerid] == 1)
	    {
	        HideDropAmountSelection(playerid);
	    }
	    return 1;
	}
	if(clickedid == InventorySDATD3)
	{
	    HideDropAmountSelection(playerid);
	    return 1;
	}

//==============================================================================
HideDropAmountSelection(playerid)
{
    TextDrawHideForPlayer(playerid, InventorySDATD0);
    TextDrawHideForPlayer(playerid, InventorySDATD1);
    TextDrawHideForPlayer(playerid, InventorySDATD2);
    TextDrawHideForPlayer(playerid, InventorySDATD3);
    PlayerTextDrawDestroy(playerid, InventorySDATD5[playerid]);
    PlayerTextDrawDestroy(playerid, InventorySDATD6[playerid]);
    PlayerTextDrawDestroy(playerid, InventorySDATD7[playerid]);
    PlayerTextDrawDestroy(playerid, InventorySDATD8[playerid]);
    PlayerTextDrawDestroy(playerid, InventorySDATD9[playerid]);
    PlayerTextDrawDestroy(playerid, InventorySDATD10[playerid]);
    PlayerTextDrawDestroy(playerid, InventorySDATD11[playerid]);
    CancelSelectTextDraw(playerid);
    usingdropamountselection[playerid] = 0;
    return 1;
}
//==============================================================================
ShowDropAmountSelection(playerid, amount, modelid, slot)
{
	if(amount == 1) return DropPlayerItem(playerid, amount, slot, modelid);
	usingdropamountselection[playerid] = 1;
  	new tstr[128];
	HideInventory(playerid);
    
    TempAmountInv[playerid] = amount;
	TempSlotInv[playerid] = slot;
	TempModelInv[playerid] = modelid;
    
    InventorySDATD5[playerid] = CreatePlayerTextDraw(playerid, 402.333129, 211.396316, "usebox");
	PlayerTextDrawLetterSize(playerid, InventorySDATD5[playerid], 0.000000, 1.218312);
	PlayerTextDrawTextSize(playerid, InventorySDATD5[playerid], 215.333419, 0.000000);
	PlayerTextDrawAlignment(playerid, InventorySDATD5[playerid], 1);
	PlayerTextDrawColor(playerid, InventorySDATD5[playerid], 0);
	PlayerTextDrawUseBox(playerid, InventorySDATD5[playerid], true);
	PlayerTextDrawBoxColor(playerid, InventorySDATD5[playerid], 102);
	PlayerTextDrawSetShadow(playerid, InventorySDATD5[playerid], 0);
	PlayerTextDrawSetOutline(playerid, InventorySDATD5[playerid], 0);
	PlayerTextDrawFont(playerid, InventorySDATD5[playerid], 0);

	InventorySDATD6[playerid] = CreatePlayerTextDraw(playerid, 402.666687, 226.744369, "usebox");
	PlayerTextDrawLetterSize(playerid, InventorySDATD6[playerid], 0.000000, 1.218312);
	PlayerTextDrawTextSize(playerid, InventorySDATD6[playerid], 215.666641, 0.000000);
	PlayerTextDrawAlignment(playerid, InventorySDATD6[playerid], 1);
	PlayerTextDrawColor(playerid, InventorySDATD6[playerid], 0);
	PlayerTextDrawUseBox(playerid, InventorySDATD6[playerid], true);
	PlayerTextDrawBoxColor(playerid, InventorySDATD6[playerid], 102);
	PlayerTextDrawSetShadow(playerid, InventorySDATD6[playerid], 0);
	PlayerTextDrawSetOutline(playerid, InventorySDATD6[playerid], 0);
	PlayerTextDrawFont(playerid, InventorySDATD6[playerid], 0);
	
	format(tstr, sizeof(tstr), "%s: %d", GetItemName(modelid), amount);
	InventorySDATD7[playerid] = CreatePlayerTextDraw(playerid, 222.000030, 176.711044, tstr);
	PlayerTextDrawLetterSize(playerid, InventorySDATD7[playerid], 0.213330, 0.917037);
	PlayerTextDrawAlignment(playerid, InventorySDATD7[playerid], 1);
	PlayerTextDrawColor(playerid, InventorySDATD7[playerid], -1);
	PlayerTextDrawSetShadow(playerid, InventorySDATD7[playerid], 0);
	PlayerTextDrawSetOutline(playerid, InventorySDATD7[playerid], 1);
	PlayerTextDrawBackgroundColor(playerid, InventorySDATD7[playerid], 51);
	PlayerTextDrawFont(playerid, InventorySDATD7[playerid], 1);
	PlayerTextDrawSetProportional(playerid, InventorySDATD7[playerid], 1);

    format(tstr, sizeof(tstr), "Drop 1 %s", GetItemName(modelid), amount);
	InventorySDATD8[playerid] = CreatePlayerTextDraw(playerid, 222.333526, 194.133331, tstr);
	PlayerTextDrawLetterSize(playerid, InventorySDATD8[playerid], 0.250000, 1.000000);
	PlayerTextDrawTextSize(playerid, InventorySDATD8[playerid], 344.800003, 10.0);
	PlayerTextDrawAlignment(playerid, InventorySDATD8[playerid], 1);
	PlayerTextDrawColor(playerid, InventorySDATD8[playerid], -1);
	PlayerTextDrawSetShadow(playerid, InventorySDATD8[playerid], 0);
	PlayerTextDrawSetOutline(playerid, InventorySDATD8[playerid], 1);
	PlayerTextDrawBackgroundColor(playerid, InventorySDATD8[playerid], 51);
	PlayerTextDrawFont(playerid, InventorySDATD8[playerid], 1);
	PlayerTextDrawSetProportional(playerid, InventorySDATD8[playerid], 1);
	PlayerTextDrawSetSelectable(playerid, InventorySDATD8[playerid], true);

    format(tstr, sizeof(tstr), "Drop 5 %s", GetItemName(modelid), amount);
	InventorySDATD9[playerid] = CreatePlayerTextDraw(playerid, 221.666534, 211.140762, tstr);
	PlayerTextDrawLetterSize(playerid, InventorySDATD9[playerid], 0.250000, 1.000000);
	PlayerTextDrawTextSize(playerid, InventorySDATD9[playerid], 344.800003, 10.0);
	PlayerTextDrawAlignment(playerid, InventorySDATD9[playerid], 1);
	PlayerTextDrawColor(playerid, InventorySDATD9[playerid], -1);
	PlayerTextDrawSetShadow(playerid, InventorySDATD9[playerid], 0);
	PlayerTextDrawSetOutline(playerid, InventorySDATD9[playerid], 1);
	PlayerTextDrawBackgroundColor(playerid, InventorySDATD9[playerid], 51);
	PlayerTextDrawFont(playerid, InventorySDATD9[playerid], 1);
	PlayerTextDrawSetProportional(playerid, InventorySDATD9[playerid], 1);
	PlayerTextDrawSetSelectable(playerid, InventorySDATD9[playerid], true);

	InventorySDATD10[playerid] = CreatePlayerTextDraw(playerid, 221.666717, 227.733245, "Drop All items");
	PlayerTextDrawLetterSize(playerid, InventorySDATD10[playerid], 0.250000, 1.000000);
	PlayerTextDrawTextSize(playerid, InventorySDATD10[playerid], 344.800003, 10.0);
	PlayerTextDrawAlignment(playerid, InventorySDATD10[playerid], 1);
	PlayerTextDrawColor(playerid, InventorySDATD10[playerid], -1);
	PlayerTextDrawSetShadow(playerid, InventorySDATD10[playerid], 0);
	PlayerTextDrawSetOutline(playerid, InventorySDATD10[playerid], 1);
	PlayerTextDrawBackgroundColor(playerid, InventorySDATD10[playerid], 51);
	PlayerTextDrawFont(playerid, InventorySDATD10[playerid], 1);
	PlayerTextDrawSetProportional(playerid, InventorySDATD10[playerid], 1);
	PlayerTextDrawSetSelectable(playerid, InventorySDATD10[playerid], true);

	InventorySDATD11[playerid] = CreatePlayerTextDraw(playerid, 221.666656, 243.081512, "Drop x items");
	PlayerTextDrawLetterSize(playerid, InventorySDATD11[playerid], 0.250000, 1.000000);
	PlayerTextDrawTextSize(playerid, InventorySDATD11[playerid], 344.800003, 10.0);
	PlayerTextDrawAlignment(playerid, InventorySDATD11[playerid], 1);
	PlayerTextDrawColor(playerid, InventorySDATD11[playerid], -1);
	PlayerTextDrawSetShadow(playerid, InventorySDATD11[playerid], 0);
	PlayerTextDrawSetOutline(playerid, InventorySDATD11[playerid], 1);
	PlayerTextDrawBackgroundColor(playerid, InventorySDATD11[playerid], 51);
	PlayerTextDrawFont(playerid, InventorySDATD11[playerid], 1);
	PlayerTextDrawSetProportional(playerid, InventorySDATD11[playerid], 1);
	PlayerTextDrawSetSelectable(playerid, InventorySDATD11[playerid], true);


	TextDrawShowForPlayer(playerid,InventorySDATD0);
	TextDrawShowForPlayer(playerid,InventorySDATD1);
	TextDrawShowForPlayer(playerid,InventorySDATD2);
	TextDrawShowForPlayer(playerid,InventorySDATD3);
	PlayerTextDrawShow(playerid, InventorySDATD5[playerid]);
	PlayerTextDrawShow(playerid, InventorySDATD6[playerid]);
	PlayerTextDrawShow(playerid, InventorySDATD7[playerid]);
	PlayerTextDrawShow(playerid, InventorySDATD8[playerid]);

	if(amount >= 5)
	{
	     PlayerTextDrawShow(playerid, InventorySDATD9[playerid]);
	}
	if(amount >= 2)
	{
	    PlayerTextDrawShow(playerid, InventorySDATD10[playerid]);
		PlayerTextDrawShow(playerid, InventorySDATD11[playerid]);
	}
	SelectTextDraw(playerid, 0x21A9D8FF);
	return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)