SA-MP Forums Archive
ShowPlayerDialog Bug - 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: ShowPlayerDialog Bug (/showthread.php?tid=601631)



ShowPlayerDialog Bug - danielpalade - 23.02.2016

This command:

Код:
CMD:factions(playerid, params[])
{
	new members;
	format(szMessage, sizeof(szMessage), "Factions:");
	for(new xf = 0; xf < MAX_GROUPS; xf++)
	{
	    if(strlen(groupVariables[xf][gGroupName]) >= 1 && strcmp(groupVariables[xf][gGroupName], "None", true))
	    {
	    	new stringy2[256];
			mysql_format(handle, stringy2, 256, "SELECT * FROM `playeraccounts` WHERE  `playerGroup` = '%d'", xf);
			new Cache: resultx = mysql_query (handle, stringy2);
			members = cache_get_row_count();
			cache_delete(resultx);
			format(szMessage, sizeof(szMessage),"%s\n%s [%d/%d]", szMessage, groupVariables[xf][gGroupName], members, groupVariables[xf][gSlots]);
	    }
	}
	ShowPlayerDialog(playerid, 4500, DIALOG_STYLE_LIST,"Server: Factions", szMessage, "Select", "Cancel");
	SelFaction[playerid] = 0;
	return 1;
}
Should show me a dialog with all the helpers from the database.
It does. Now when I select a helper from the list, it should send me to a different dialog.
That doesn't work.

This is my OnDialogResponse

Код:
		case DIALOG_HELPERS:
		{
			if(response)
			{
				if(listitem >= 1)
				{
					new item = listitem;
					format(playerVariables[playerid][pSelected], MAX_PLAYER_NAME, "%s",Selected[item][snume]);
					ShowPlayerDialog(playerid, DIALOG_HELPERS2, DIALOG_STYLE_LIST, "Select an action", "Uninvite\nChangerank\nFwarn", "Go", "Cancel");
				}
				else
				{
					SendClientMessage(playerid, COLOR_GREY, "You can't click on this item.");
				}
			}
		}
Yes, I have defined everything.


Re: ShowPlayerDialog Bug - Jefff - 24.02.2016

DIALOG_HELPERS is 4500?


Re: ShowPlayerDialog Bug - danielpalade - 24.02.2016

Quote:
Originally Posted by Jefff
Посмотреть сообщение
DIALOG_HELPERS is 4500?
No, its
Код:
#define DIALOG_HELPERS	84176
#define DIALOG_HELPERS2 81848



Re: ShowPlayerDialog Bug - RoboN1X - 24.02.2016

Quote:
Originally Posted by danielpalade
Посмотреть сообщение
No, its
Код:
#define DIALOG_HELPERS	84176
#define DIALOG_HELPERS2 81848
Then you need to change this:
Код:
ShowPlayerDialog(playerid, 4500, DIALOG_STYLE_LIST,"Server: Factions", szMessage, "Select", "Cancel");
to
Код:
ShowPlayerDialog(playerid, DIALOG_HELPERS, DIALOG_STYLE_LIST,"Server: Factions", szMessage, "Select", "Cancel");
By the way you are doing a database query on a loop, try to optimize it (I am not sure how your database structure and what you wanted from it though, so i have no idea to write the code for it, perhaps it's fine).


Re: ShowPlayerDialog Bug - Amunra - 24.02.2016

Change
Quote:

ShowPlayerDialog(playerid, DIALOG_HELPERS, DIALOG_STYLE_LIST,"Server: Factions", szMessage, "Select", "Cancel");
SelFaction[playerid] = 0;

And At Dialog Response
PHP код:
        if(dialogid == DIALOG_HELPERS)
        {
            if(
response)
            {
                if(
listitem >= 1)
                {
                    new 
item listitem;
                    
format(playerVariables[playerid][pSelected], MAX_PLAYER_NAME"%s",Selected[item][snume]);
                    
ShowPlayerDialog(playeridDIALOG_HELPERS2DIALOG_STYLE_LIST"Select an action""Uninvite\nChangerank\nFwarn""Go""Cancel");
                }
                else
                {
                    
SendClientMessage(playeridCOLOR_GREY"You can't click on this item.");
                }
            }
        }