Salutare, am o problema la comanda /emails.
CMD:emails(playerid,params[])
{
new string[128],query[512],query2[512],text[32],idemail,id = ,status,sender,sendername[32],message[1024];
mysql_format(handle, query, sizeof(query), "SELECT * FROM emails WHERE playerID = %d ORDER BY Data DESC LIMIT 20",PlayerInfo[playerid][pID]);
new Cache: result = mysql_query(handle, query);
for(new i = ; i < cache_get_row_count(); i++)
{
idemail = cache_get_field_content_int(i, "ID");
SelectEmail[playerid][id] = idemail; id++;
cache_get_field_content(i, "Text", text);
status = cache_get_field_content_int(i, "Status");
sender = cache_get_field_content_int(i, "Sender");
if(sender > )
{
mysql_format(handle, query2, sizeof(query2), "SELECT * FROM accounts WHERE accounts.ID = %d",sender);
mysql_query(handle, query2);
cache_get_field_content(, "Username", sendername);
if(status == 1) format(string, sizeof(string), "[NEW] %s: %s ...\n",sendername,text);
else format(string, sizeof(string), "%s: %s ...\n",sendername,text);
strcat(message,string);
}
else if(sender == )
{
if(status == 1) format(string, sizeof(string), "[NEW] %s ...\n",text);
else format(string, sizeof(string), "%s ...\n",text);
strcat(message,string);
}
}
cache_delete(result);
if(id == ) SendClientMessage(playerid, COLOR_WHITE, "Eroare: Nu ai niciun email.");
else ShowPlayerDialog(playerid, 18, DIALOG_STYLE_LIST, "New Email", message, "Read", "Close");
return 1;
}
Acolo unde trimit query-ul din interiorului loop-ului e problema cred. Deoarece mysql_query returneaza 1 si opreste loop-ul automat. Ce altceva pot face in privinta asta, inafara de faptul sa modific tabelul din baza de date in loc ID sa pun numele jucatorului deoarece folosesc asta in multe locuri mai ales pe panel si sunt multe de modificat. Daca ati vazut voi o alta optiune in care sa nu-mi mai opreasca loop-ul.