03.10.2011, 10:34
This is the command:
It only shows the last message, can anyone spot a problem in my code?
PHP код:
CMD:questions(playerid, params[])
{
if(!PlayerInfo[playerid][pTester] && !PlayerInfo[playerid][pAdmin])
return 0;
new
string[2048],
query[128]
;
mysql_query("SELECT * FROM `reports` WHERE `type` = '0'");
mysql_store_result();
if(mysql_num_rows() == 0)
return ShowPlayerDialog(playerid, DIALOG_BANK_STAT, DIALOG_STYLE_MSGBOX, "{24FF0A}Supporter - {FFFFFF}Questions", "No questions have been submitted yet", "OK", "");
mysql_free_result();
format(string,sizeof(string),"{FF6347}QUESTIONS:\n");
format(query,sizeof(query),"SELECT `string`,`from` FROM `reports` WHERE `type` = '0' ORDER BY `id` DESC");
mysql_query(query);
mysql_store_result();
new
x=0
;
while(mysql_fetch_row(query, "|") && x < 6)
{
new
query1[128],
query2[128]
;
query1 = query;
query2 = query;
strmid(query1, query, 0, strfind(query, "|"));
new
len2 = strlen(query1)
;
len2 += 1;
strmid(query2, query, len2, strlen(query));
new
id = strval(query2)
;
format(string, sizeof(string), "%s{FF6347}From: {B1C8FB}%s\n{FF6347}Question: {B1C8FB}%s\n{FFFFFF}______________\n", string, GetNameThroughUID(id), query1);
printf("%s",string);
x++;
printf("%i",x);
}
printf("%s",string);
mysql_free_result();
ShowPlayerDialog(playerid,DIALOG_BANK_STAT,DIALOG_STYLE_MSGBOX,"{24FF0A}Supporter - {FFFFFF}Questions",string,"OK","");
return 1;
}