SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 05/07/2018, 11:49 AM   #1
jasperschellekens
High-roller
 
jasperschellekens's Avatar
 
Join Date: Dec 2016
Location: Holland
Posts: 1,082
Reputation: 126
Default _:clickedid

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;
}
__________________
If you want to have your own custom script, or even want to have one of our already released scripts, join our SCRIPTING SERVICES DISCORD, or send me a private message!


Undead Wasteland Roleplay - The year is 1996. San Andreas is a wasteland ruled by the undead. the once so glorius landscape of San Andreas, is now a shattered decayed place that is only a vague memory of the world as we used to know it.
Discord - Website
jasperschellekens is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Ajuda] Clickedid << Eiffel Português/Portuguese 7 04/03/2017 07:47 PM
[Ajuda] clickedid Eiffel Português/Portuguese 6 03/03/2017 01:55 AM
Question about Text: clickedid vasyok28 Scripting Help 8 28/10/2016 03:44 PM


All times are GMT. The time now is 04:50 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.