SA-MP Forums Archive
issue with mysql tquery - 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: issue with mysql tquery (/showthread.php?tid=647411)



issue with mysql tquery - JessThompson - 04.01.2018

Код:
[21:23:43 01/04/18] [DEBUG] mysql_format - connection: 3, len: 2500, format: "INSERT INTO `Reports` (`uID`, `vID`, `Reason`, `Time`, `Status`) VALUES(%d, %d, '%s', %d, '0')"


[21:23:43 01/04/18] [DEBUG] mysql_tquery - connection: 3, query: "INSERT INTO `Reports` (`uID`, `vID`, `Reason`, `Time`, `Status`)", callback: "SendReportDB", format: "iis[200]"

[21:23:43 01/04/18] [ERROR] mysql_tquery - callback parameter count does not match format specifier length (Query: "INSERT INTO `Reports` (`uID`, `vID`, `Reason`, `Time`, `Status`) VALUES(1258, 1, 'd', 1515101023, '0')")
I don't understand why Im getting this error but my SendReportDB is the same as the t query formatter

Код:
CMD:report(playerid, params[])
{
	new pid, info[200], query[2500];
	if(Account[playerid][reportMuted] == 1) return SendClientMessage(playerid, COLOR_GREY, "{1E90FF}(Server):{dadada} You have been report muted!");
	if(sscanf(params, "us[200]", pid, info)) return SendClientMessage(playerid, COLOR_GRAY, "{1E90FF}(Server):{dadada} /report [playerid] [reason]");
	if(playerid == pid) return SendClientMessage(playerid, COLOR_GREY, "{1E90FF}(Server):{dadada} You cannot report yourself!");
	if(!IsPlayerConnected(pid)) return SendClientMessage(playerid, COLOR_GREY, "{1E90FF}(Server):{dadada} This player is not conneted therefor you cannot report them!");
	if(Account[playerid][lastReport] == pid) return SendClientMessage(playerid, COLOR_GREY, "{1E90FF}(Server):{dadada} You must use /cancelreport [playerid] before making a new report on this player!");

	Account[playerid][lastReport] = pid;

	mysql_format(SQL_CONNECTION, query, sizeof(query), "INSERT INTO `Reports` (`uID`, `vID`, `Reason`, `Time`, `Status`) VALUES(%d, %d, '%s', %d, '0')", Account[playerid][SQLID], Account[pid][SQLID], info, gettime());
	mysql_tquery(SQL_CONNECTION, query, "SendReportDB", "iis[190]", playerid, pid, info);
	return true;
}
Код:
forward SendReportDB(playerid, pid, info);
public SendReportDB(playerid, pid, info)
{
	    new ReportSQLID, str[2000], str1[2000];
    	ReportSQLID = cache_insert_id();

		format(str, sizeof(str), "(#%d) Report from: [%s] | Report on: [%s] | Reason:[%s]", ReportSQLID, GetName(playerid), GetName(pid), info);
		SendReportMessage(1, COLOR_LIGHTRED, str);

		format(str1, sizeof(str1), "{1E90FF}|-{dadada}  [ID - #%d] Report has been sent to all online staff! Please wait for a response. /myreports {1E90FF}-|", ReportSQLID);
		SendClientMessage(playerid, COLOR_GREY, str1);
		return true;
}



Re: issue with mysql tquery - Mikro - 04.01.2018

I assume the definition of your result function should identify the last parameter as a string. Thus:

Код:
forward SendReportDB(playerid, pid, info[]);
public SendReportDB(playerid, pid, info[])
{
    ...



Re: issue with mysql tquery - JessThompson - 04.01.2018

Nah this still don't work :L


Re: issue with mysql tquery - Mikro - 04.01.2018

Remove the string length from your mysql_tquery parameter formatting:

Код:
mysql_tquery(SQL_CONNECTION, query, "SendReportDB", "iis", playerid, pid, info);