SA-MP Forums Archive
Dialog help - 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 help (/showthread.php?tid=585669)



Dialog help - Edw - 15.08.2015

Hello! Could you tell me please how can I find a player SELCT ID of a dialogue?
I tried something like:

PHP код:
                    formatszQuerysizeofszQuery ), "SELECT * FROM `users` WHERE `Clan` = '%d'"PlayerInfo[playerid][pClan] );
                    new 
Cacheresult mysql_querymysqlszQuery );
                    for ( new 
icache_get_row_count ( ); != j; ++)
                    {
                        
cache_get_field_contenti"Username"szName ); formatstring300szName );
                        
format(Selected[Players][snume], MAX_PLAYER_NAMEszName);
                        
format(sName[playerid], MAX_PLAYER_NAMESelected[Players][snume]);
                        
Players ++;
                    }
                    
cache_deleteresult );
                    
ShowPlayerDialog(playeridDIALOG_CLAN2DIALOG_STYLE_LIST"Clan Members:"szDialog"Select""Back" );
and
        case 
DIALOG_CLAN2:
        {
            switch(
listitem)
            {
                case 
0:
                {
                    
SendClientMessage(playerid, -1"Click: %s"sName[playerid]);
                }
            }
        } 



Re: Dialog help - Edw - 16.08.2015

help me?


Re: Dialog help - Evocator - 16.08.2015

I dont know if this is what you did mean but; The row ids displayed from your selection are normally indexed from 0 till the end of the list #.

So basically after showing the dialog (threaded queries) you can:

Код:
// Display the clan dialog:
mysql_format(mysql, szQuery, sizeof (szQuery), "SELECT * FROM `users` WHERE `Clan` = '%d'", PlayerInfo[playerid][pClan]);
mysql_tquery(mysql, szQuery, "DisplayClanList", "ii", playerid, -1);

// Under the dialog response
case DIALOG_CLAN:
{
    if (!response) 
    	return 1;

	mysql_format(mysql, szQuery, sizeof (szQuery), "SELECT * FROM `users` WHERE `Clan` = '%d'", PlayerInfo[playerid][pClan]);
	mysql_tquery(mysql, szQuery, "DisplayClanList", "ii", playerid, listitem);

    return 1;
}


public DisplayClanList(playerid, rowid)
{
	// you are showing the list
	if (rowid == -1)
	{
		for ( new i, j = cache_get_row_count ( ); i != j; ++i ) 
		{ 
		    cache_get_field_content( i, "Username", szName ); 
		    format(string, 300, szName); 
		    format(Selected[Players][snume], MAX_PLAYER_NAME, szName); 
		    format(sName[playerid], MAX_PLAYER_NAME, Selected[Players][snume]); 
		    Players++; 
		} 
		ShowPlayerDialog(playerid, DIALOG_CLAN2, DIALOG_STYLE_LIST, "Clan Members:", szDialog, "Select", "Back" );
		return 1;
	}

	new nick[21];
	cache_get_field_content(rowid, "Username", nick);

	printf("You clicked username %s", nick);
}
Please note that this is an example code, im not sure of what you are selecting or requesting. This is what i understood and coded in 3 mins. I hope this helped.