if(!strcmp(cmdtext,"/cmd",true))
{
item[playerid] = 0;
mysql_query("SELECT item FROM table");
mysql_store_result();
while(mysql_retrieve_row())
{
mysql_fetch_field_row(resultstr,"item");
result=strval(resultstr);
format(str,sizeof(str),"id: %d\n",result);
strcat(guistr,str);
item[playerid]++;
}
mysql_free_result();
ShowPlayerDialog(playerid,666,DIALOG_STYLE_LIST,"items",guistr,"ok","");
return 1;
}
if(dialogid == 666)
{
if(listitem == item[playerid])
{
printf("clicked id: %d",item[playerid]);
}
return 1;
}
new ID = strval(string[6]);
new item[MAX_PLAYERS][99], SOMECOUNT;
if(!strcmp(cmdtext,"/cmd",true))
{
item[playerid] = 0;
mysql_query("SELECT item FROM table");
mysql_store_result();
while(mysql_retrieve_row())
{
mysql_fetch_field_row(resultstr,"item");
result=strval(resultstr);
format(str,sizeof(str),"id: %d\n",result);
strcat(guistr,str);
SOMECOUNT++;
item[playerid][SOMECOUNT]=result;
}
mysql_free_result();
ShowPlayerDialog(playerid,666,DIALOG_STYLE_LIST,"items",guistr,"ok","");
return 1;
}
if(dialogid == 666)
{
printf("clicked id: %d",item[playerid][listitem]);
return 1;
}
|
That's perhaps a bit faster than my solution (perhaps, maybe, maybe not), but wastes a lot more space. Space that does not necessarily need wasting
![]() |
|
https://sampforum.blast.hk/showthread.php?tid=190068 check this out
|
|
So this should be done in this way? :
Код:
new item[MAX_PLAYERS][99], SOMECOUNT; Код:
if(!strcmp(cmdtext,"/cmd",true))
{
item[playerid] = 0;
mysql_query("SELECT item FROM table");
mysql_store_result();
while(mysql_retrieve_row())
{
mysql_fetch_field_row(resultstr,"item");
result=strval(resultstr);
format(str,sizeof(str),"id: %d\n",result);
strcat(guistr,str);
SOMECOUNT++;
item[playerid][SOMECOUNT]=result;
}
mysql_free_result();
ShowPlayerDialog(playerid,666,DIALOG_STYLE_LIST,"items",guistr,"ok","");
return 1;
}
Код:
if(dialogid == 666)
{
printf("clicked id: %d",item[playerid][listitem]);
return 1;
}
|
|
That's perhaps a bit faster than my solution (perhaps, maybe, maybe not), but wastes a lot more space. Space that does not necessarily need wasting |
|
Код:
new item[MAX_PLAYERS][99], SOMECOUNT; Код:
if(!strcmp(cmdtext,"/cmd",true))
{
item[playerid] = 0;
mysql_query("SELECT item FROM table");
mysql_store_result();
while(mysql_retrieve_row())
{
mysql_fetch_field_row(resultstr,"item");
result=strval(resultstr);
format(str,sizeof(str),"id: %d\n",result);
strcat(guistr,str);
SOMECOUNT++;
item[playerid][SOMECOUNT]=result;
}
mysql_free_result();
ShowPlayerDialog(playerid,666,DIALOG_STYLE_LIST,"items",guistr,"ok","");
return 1;
}
Код:
if(dialogid == 666)
{
printf("clicked id: %d",item[playerid][listitem]);
return 1;
}
|