Dialog not showing
#1

I have this command /notifications which shows you all of your emails.
The command /notifications works, it shows your emails, but if you click one of you emails, nothing happens.
This is the command.
Код:
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;
}
And this is the OnDialogResponse.
Код:
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;
				}
			}
		}
I have everything defined, but it doesn't show up in game.
Reply
#2

change playerVariables[playerid][pSelectedMail] to listitem in query
Reply
#3

Quote:
Originally Posted by czerwony03
Посмотреть сообщение
change playerVariables[playerid][pSelectedMail] to listitem in query
Thanks! Its working now. But the problem now is, that the message doesn't change, even if "seen" is equal to 0.
Reply
#4

Can You explain it more? I don't really understand, what do you mean by "doesn't change"
Reply
#5

Quote:
Originally Posted by czerwony03
Посмотреть сообщение
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;
}
As you see I have it set that if "seen" is equal to 0 from the database
Код:
if(seen == 0)
it will return the message
Код:
format(string, sizeof(string), "%s\n[NECITIT] %s", string,text);
else if seen is 1 it should return
Код:
format(string, sizeof(string), "%s\n%s", string,text);
. That doesn't work.
Reply
#6

The correct way to assign an integer variable to an integer field value:
PHP код:
seen cache_get_field_content_int(i"seen"); 
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)