SA-MP Forums Archive
Dialog not showing - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Dialog not showing (/showthread.php?tid=651239)



Dialog not showing - TrueThing - 16.03.2018

Hello i am trying to make a dialog which will show the businesses i own but whenever i try to open the dialog nothing happens i tried crashdetect but not showing any errors this is my code:

Код:
case 2:
{
	new string4[128], string5[228];
	if(PlayerInfo[playerid][pBusinessID][0] > 0)
	{
		format(string4, sizeof(string4), "BusinessID\tBusiness Name\tBusiness Earnings\n%d\t%s\t$%d", PlayerInfo[playerid][pBusinessID][0], BusInfo[PlayerInfo[playerid][pBusinessID][0]][bName], BusInfo[PlayerInfo[playerid][pBusinessID][0]][bEarning]);
	}
	if(PlayerInfo[playerid][pBusinessID][0] == 0)
	{
		format(string4, sizeof(string4), "BusinessID\tBusiness Name\tBusiness Earnings\n-1\tNone\t$0");
	}
	if(PlayerInfo[playerid][pBusinessID][1] > 0)
	{
		format(string5, sizeof(string5), "%s\n%d\t%s\t%d", string4, PlayerInfo[playerid][pBusinessID][1], BusInfo[PlayerInfo[playerid][pBusinessID][1]][bName],BusInfo[PlayerInfo[playerid][pBusinessID][1]][bEarning]);
	}
	if(PlayerInfo[playerid][pBusinessID][1] == 0)
	{
		format(string5, sizeof(string5), "%s\n-1\tNone\t$0", string4);
	}

	ShowPlayerDialog(playerid, DIALOG_MY_BUSINESSES, DIALOG_STYLE_TABLIST_HEADERS, "My Businesses", string5, "Locate", "Back");
}



Re: Dialog not showing - Maximun - 16.03.2018

PHP код:
case 2:
{
    new 
string4[128], string5[228];
    if(
PlayerInfo[playerid][pBusinessID][0] > 0)
    {
        
format(string4sizeof(string4), "BusinessID\tBusiness Name\tBusiness Earnings\n%d\t%s\t$%d"PlayerInfo[playerid][pBusinessID][0], BusInfo[PlayerInfo[playerid][pBusinessID][0]][bName], BusInfo[PlayerInfo[playerid][pBusinessID][0]][bEarning]);
    }
    else if(
PlayerInfo[playerid][pBusinessID][0] == 0)
    {
        
format(string4sizeof(string4), "BusinessID\tBusiness Name\tBusiness Earnings\n-1\tNone\t$0");
    }
    if(
PlayerInfo[playerid][pBusinessID][1] > 0)
    {
        
format(string5sizeof(string5), "%s\n%d\t%s\t%d"string4PlayerInfo[playerid][pBusinessID][1], BusInfo[PlayerInfo[playerid][pBusinessID][1]][bName],BusInfo[PlayerInfo[playerid][pBusinessID][1]][bEarning]);
    }
    else if(
PlayerInfo[playerid][pBusinessID][1] == 0)
    {
        
format(string5sizeof(string5), "%s\n-1\tNone\t$0"string4);
    }
    
ShowPlayerDialog(playeridDIALOG_MY_BUSINESSESDIALOG_STYLE_TABLIST_HEADERS"My Businesses"string5"Locate""Back");




Re: Dialog not showing - TrueThing - 16.03.2018

its the same i already tried else if


Re: Dialog not showing - Maximun - 16.03.2018

Are you sure that 'case 2:' is done? If no, you can try with 'printf'


Re: Dialog not showing - TrueThing - 16.03.2018

Код:
				case 2:
				{
                    printf("before if statment");
				    new string4[128], string5[228];
                    printf("after variable creations");
				    if(PlayerInfo[playerid][pBusinessID][0] > 0)
				    {
				        format(string4, sizeof(string4), "BusinessID\tBusiness Name\tBusiness Earnings\n%d\t%s\t$%d", PlayerInfo[playerid][pBusinessID][0], BusInfo[PlayerInfo[playerid][pBusinessID][0]][bName], BusInfo[PlayerInfo[playerid][pBusinessID][0]][bEarning]);
				    }
				    else if(PlayerInfo[playerid][pBusinessID][0] == 0)
				    {
				        format(string4, sizeof(string4), "BusinessID\tBusiness Name\tBusiness Earnings\n-1\tNone\t$0");
				    }
				    if(PlayerInfo[playerid][pBusinessID][1] > 0)
				    {
				        format(string5, sizeof(string5), "%s\n%d\t%s\t%d", string4, PlayerInfo[playerid][pBusinessID][1], BusInfo[PlayerInfo[playerid][pBusinessID][1]][bName],BusInfo[PlayerInfo[playerid][pBusinessID][1]][bEarning]);
				    }
				    else if(PlayerInfo[playerid][pBusinessID][1] == 0)
				    {
				        format(string5, sizeof(string5), "%s\n-1\tNone\t$0", string4);
				    }
                    printf("After if statment");
				    ShowPlayerDialog(playerid, DIALOG_MY_BUSINESSES, DIALOG_STYLE_TABLIST_HEADERS, "My Businesses", string5, "Locate", "Back");
                    printf("After showdialog");
				}
yes case 2 is called this is the output
Код:
before if statment
after variable creations
After if statment
After showdialog



Re: Dialog not showing - iKarim - 16.03.2018

Show DIALOG_MY_BUSINESSES definition.


Re: Dialog not showing - TrueThing - 16.03.2018

Quote:
Originally Posted by iKarim
Посмотреть сообщение
Show DIALOG_MY_BUSINESSES definition.
Код:
enum
{
	DIALOG_REGISTER,
	DIALOG_LOGIN,
 	DIALOG_MY_BUSINESSES
}
i dont think this has anything to do with the problem


Re: Dialog not showing - MadeMan - 16.03.2018

You could be formatting string4 but showing string5 which is empty. I think it does not show dialogs with empty content.


Re: Dialog not showing - TrueThing - 16.03.2018

Quote:
Originally Posted by MadeMan
Посмотреть сообщение
You could be formatting string4 but showing string5 which is empty. I think it does not show dialogs with empty content.
no i am not doing that take a look at the code


Re: Dialog not showing - MadeMan - 16.03.2018

Print the values of pBusinessID, string4, string5 before showing the dialog.