[/email] CMD reading from mysql with DIALOG - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: [/email] CMD reading from mysql with DIALOG (
/showthread.php?tid=576281)
[/email] CMD reading from mysql with DIALOG -
CaTaLinU - 02.06.2015
Код:
CMD:email(playerid,params[])
{
if(IsPlayerConnected(playerid))
{
new string[10000],stringg[1000];
new text[75];
mysql_format(SQL, stringg, sizeof(stringg), "SELECT * FROM email WHERE playerid = %d ORDER BY id DESC",PlayerInfo[playerid][pSQLID]);
new Cache: result12 = mysql_query (SQL, stringg);
for ( new i, j = cache_get_row_count ( ); i != j; ++i )
{
cache_get_field_content(i, "text", text);
format(string, sizeof(string), "%s\n%s", string,text);
}
cache_delete(result12);
ShowPlayerDialog(playerid, 5000, DIALOG_STYLE_LIST, "Emails", string, "OK", "Close");
new var[ 140 ];
mysql_format(SQL, var, sizeof(var), "UPDATE `users` SET newemail = 0 WHERE id = %d", PlayerInfo[playerid][pSQLID]);
mysql_query(SQL ,var);
}
}
Can someone tell me what is wrong with this command ?
No error after compiling with pawno
Re: [/email] CMD reading from mysql with DIALOG -
Vince - 02.06.2015
You tell use.
What exactly does not work?
Plus, bit of advice. Use threaded queries when you can. There is almost never a need to use unthreaded queries. Point two, add a boolean column "hasRead" to your e-mail table instead of storing the count in another unrelated table. You can use "select count(*) from email where playerid = %d and not hasRead" to retrieve the number of unread emails.