CMD:notifications(playerid,params[])
{
if(IsPlayerConnected(playerid))
{
new string[10000],stringg[1000];
new text[75], seen, ids;
mysql_format(handle, stringg, sizeof(stringg), "SELECT * FROM email WHERE playerid = %d ORDER BY id DESC",playerVariables[playerid][pInternalID]);
new Cache: result12 = mysql_query (handle, stringg);
for ( new i, j = cache_get_row_count ( ); i != j; ++i )
{
cache_get_field_content_int(i, "id", ids);
cache_get_field_content(i, "text", text);
cache_get_field_content_int(i, "seen", seen);
playerVariables[playerid][pSelectedMail] = ids;
if(seen == 0)
{
format(string, sizeof(string), "%s\n[NECITIT] %s", string,text);
}
else
{
format(string, sizeof(string), "%s\n%s", string,text);
}
}
cache_delete(result12);
ShowPlayerDialog(playerid, 5000, DIALOG_STYLE_LIST, "Emails", string, "OK", "Close");
}
return 1;
}
case 5000:
{
if(response)
{
if(listitem >= 0)
{
new query[512], query2[512];
new string[512];
mysql_format(handle, query, sizeof(query), "SELECT * FROM email WHERE id = '%d'", playerVariables[playerid][pSelectedMail]);
new Cache: result14 = mysql_query(handle, query);
new ids, text[256], time[256];
for ( new i, j = cache_get_row_count ( ); i != j; ++i )
{
cache_get_field_content_int(i, "id", ids);
cache_get_field_content(i, "text", text);
cache_get_field_content(i, "time", time);
playerVariables[playerid][pSelectedMail] = ids;
format(string, sizeof(string), "%s\n[%s]\n%s", string, time, text);
}
cache_delete(result14);
ShowPlayerDialog(playerid, DIALOG_EMAIL2, DIALOG_STYLE_MSGBOX, "Emails", string, "Close", "");
mysql_format(handle, query2, sizeof(query2), "UPDATE email SET seen = '1' WHERE id = '%d'", playerVariables[playerid][pSelectedMail]);
mysql_tquery(handle, query2);
playerVariables[playerid][pSelectedMail] = -1;
}
}
}
|
change playerVariables[playerid][pSelectedMail] to listitem in query
|
|
Can You explain it more? I don't really understand, what do you mean by "doesn't change"
![]() |
CMD:notifications(playerid,params[])
{
if(IsPlayerConnected(playerid))
{
new string[10000],stringg[1000];
new text[75], seen, ids;
format(string, sizeof(string),"Emails\n");
mysql_format(handle, stringg, sizeof(stringg), "SELECT * FROM email WHERE playerid = %d ORDER BY id DESC",playerVariables[playerid][pInternalID]);
new Cache: result12 = mysql_query (handle, stringg);
for ( new i, j = cache_get_row_count ( ); i != j; ++i )
{
cache_get_field_content_int(i, "id", ids);
cache_get_field_content(i, "text", text);
cache_get_field_content_int(i, "seen", seen);
playerVariables[playerid][pSelectedMail] = ids;
if(seen == 0)
{
format(string, sizeof(string), "%s\n[NECITIT] %s", string,text);
}
else
{
format(string, sizeof(string), "%s\n%s", string,text);
}
}
cache_delete(result12);
ShowPlayerDialog(playerid, 5000, DIALOG_STYLE_LIST, "Emails", string, "OK", "Close");
}
return 1;
}
if(seen == 0)
format(string, sizeof(string), "%s\n[NECITIT] %s", string,text);
format(string, sizeof(string), "%s\n%s", string,text);
seen = cache_get_field_content_int(i, "seen");