15.09.2017, 09:48
P_CHEMICAL[playerid][Amount] Is a FLOAT
PHP код:
if(mysql_num_rows())
{
while(mysql_retrieve_row())
{
mysql_fetch_field_row(temp, "ID"), P_CHEMICAL[playerid][ID][id] = strval(temp);
mysql_fetch_field_row(temp, "Item"), P_CHEMICAL[playerid][ChemicalID][id] = strval(temp);
mysql_fetch_field_row(temp, "Amount"), P_CHEMICAL[playerid][Amount][id] = floatstr(temp); // warning line
id ++;
}
}
PHP код:
stock AddChemical(playerid, chemical, Float:amount)
{
for(new i = 0,j = MAX_CHEMICAL; i < j; i ++)
{
if(P_CHEMICAL[playerid][ChemicalID][i] > 0) continue;
else
{
format(_query, sizeof(_query), "INSERT INTO `chemical`(`Owner`, `Item`, `Amount`) VALUES (%d, %d, %.1f)", cInfo[playerid][SQLID], chemical, amount);
mysql_query(_query);
P_CHEMICAL[playerid][ID][i] = mysql_insert_id();
P_CHEMICAL[playerid][ChemicalID][i] = chemical;
P_CHEMICAL[playerid][Amount][i] = amount; // warning line
P_CHEMICAL[playerid][Owner][i] = cInfo[playerid][SQLID];
break;
}
}
return 1;
}