03.03.2016, 00:58
So, I have this query to insert some information into table 'mdc', the sole purpose for adding offline crimes.
It does return saying "Crime added, blah blah". However, the crimes are not showing up in the table. It's as if it's not inserting anything (because it's not)
Any suggestions?
pawn Код:
forward OnCrimeAddOffline(iPlayerID, szAddCrime[], szPName[], iExtra);
public OnCrimeAddOffline(iPlayerID, szAddCrime[], szPName[], iExtra)
{
new
iRows,
iTempID;
iRows = cache_get_row_count(MainPipeline);
switch(iExtra) {
case 0: {
if(!iRows) return SendClientMessageEx(iPlayerID, 0xFFFFFF, "That player was not found!");
iTempID = cache_get_field_content_int(iRows, "id", MainPipeline);
format(szMiscArray, sizeof(szMiscArray), "INSERT INTO `mdc` (`id` ,`time` ,`issuer` ,`crime`, `origin`) VALUES ('%d',NOW(),'%s','%s','%d')", iTempID, GetPlayerNameEx(iPlayerID), szAddCrime, arrGroupData[PlayerInfo[iPlayerID][pMember]][g_iAllegiance]);
mysql_function_query(MainPipeline, szMiscArray, true, "OnCrimeAddOffline", "dssd", iPlayerID, szAddCrime, szPName, 1);
DeletePVar(iPlayerID, "OfflineSU");
}
case 1: {
if(!cache_affected_rows(MainPipeline)) return SendClientMessageEx(iPlayerID, 0xFFFFFF, "There was an issue appending that crime!");
format(szMiscArray, sizeof(szMiscArray), "Crime Added: %s - %s", szPName, szAddCrime);
SendClientMessage(iPlayerID, 0xFFFFFF, szMiscArray);
}
}
return 1;
}
Any suggestions?