Dialog list with multiple result from query - 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 list with multiple result from query (
/showthread.php?tid=654770)
Dialog list with multiple result from query -
Criniti - 05.06.2018
Hi I need to create a dialog list with data drawn from a sql query only that I can not understand how to do with this code shows me only the last result of the query while I need to show them all the code is this:
PHP код:
forward GetSkinsForPlayer(playerid);
public GetSkinsForPlayer(playerid)
{
new rows, razza, age, fat,aged, sex, dialogo[1024];
razza = 1;
age = pInfo[playerid][pAge];
sex = pInfo[playerid][pSex];
aged = age+5;
fat = 0;
cache_get_row_count(rows);
if(rows)
{
new s_model, s_age, s_razza, s_fat;
for(new i; i<rows; i++)
{
cache_get_value_int(i, "skinModel", s_model);
cache_get_value_int(i, "skinAge", s_age);
cache_get_value_int(i, "skinRazza", s_razza);
cache_get_value_int(i, "skinFat", s_fat);
printf("Skin Model ID: %d - Age: %d - Razza: %d - Fat: %d ",s_model, s_age, s_razza, s_fat);
format(dialogo, sizeof(dialogo), "[%d] Modello Skin: %d - Etа: %d - %d\n",i,s_model, s_age, aged);
}
ShowPlayerDialog(playerid, DIALOG_SKIN_SELECT, DIALOG_STYLE_LIST, "Seleziona Skin", dialogo, "Scegli", "Chiudi");
}
return true;
}
Sorry for my bad english
Re: Dialog list with multiple result from query -
ball - 05.06.2018
You have to create two strings and use strcat
Код:
new str1[512], str2[100];
//loop
format(str2, sizeof str2, ...);
strcat(str1, str2);
In your code, you format actual row, but the row before is overwritten.
Re: Dialog list with multiple result from query -
Criniti - 05.06.2018
Thanks so much rep +