C:\Users\joeytucker\Desktop\SAMP037svr\gamemodes\IRP.pwn(23135) : warning 213: tag mismatch C:\Users\joeytucker\Desktop\SAMP037svr\gamemodes\IRP.pwn(23140) : warning 213: tag mismatch C:\Users\joeytucker\Desktop\SAMP037svr\gamemodes\IRP.pwn(23145) : warning 213: tag mismatch C:\Users\joeytucker\Desktop\SAMP037svr\gamemodes\IRP.pwn(23145) : warning 213: tag mismatch C:\Users\joeytucker\Desktop\SAMP037svr\gamemodes\IRP.pwn(23150) : warning 213: tag mismatch
format(string, sizeof(string), "SELECT Sum(`Crack`), Sum(`Pot`), Sum(`Materials`) FROM `Users`");
query = sql_query(SQL:1, string);
sql_store_result(query);
new crackamount = sql_get_field_int(query, 0);
new potamount = sql_get_field_int(query, 1);
new matamount = sql_get_field_int(query, 2);
new Float:crackgpricetemp, Float:potgpricetemp,
Float:matpricetemp, Float:DriversLicenseCosttemp;
if(TaxValue >= 25000) {
DriversLicenseCosttemp = (0.5/TaxValue^2) * 10^13;
}
else DriversLicenseCosttemp = (8000);
if(potamount >= 100) {
potgpricetemp = (0.5/potamount^2) * 10^7; //price per gram
}
else potgpricetemp = (500);
if(matamount >= 17677) {
matpricetemp = (0.5/matamount^2) * 2.5 * 10^12;
}
else matpricetemp = (4000);
if(crackamount >= 100) {
crackgpricetemp = (0.5/crackamount^2) * 10^8; //price per gram
}
else crackgpricetemp = (5000);
sql_free_result(query);
crackgprice = floatround(crackgpricetemp);
DriversLicenseCost = floatround(DriversLicenseCosttemp);
matprice = floatround(matpricetemp);
potgprice = floatround(potgpricetemp);
printf("crackgprice = %d / %f / %d", crackgprice, crackgpricetemp, crackamount);
printf("potgprice = %d / %f / %d", potgprice, potgpricetemp, potamount);
printf("DriversLicenseCost = %d / %f / %d", DriversLicenseCost, DriversLicenseCosttemp, TaxValue);
printf("matprice = %d / %f / %d", matprice, matpricetemp, matamount);
[11:41:05] crackgprice = 1319677019 / 1414933888.000000 / 101 [11:41:05] potgprice = 1318862193 / 1310636160.000000 / 250 [11:41:05] DriversLicenseCost = 1174011904 / 8000.000000 / 423 [11:41:05] matprice = 1319196057 / 1353370752.000000 / 100000
DriversLicenseCost = floatround(DriversLicenseCosttemp);
DriversLicenseCost = _:DriversLicenseCosttemp;
DriversLicenseCost = 1174011904 DriversLicenseCosttemp = 8000.000000 TaxValue = 423
Originally Posted by Jeffry
new YourInteger = floatround(/*YourFloat*/, floatround_round);
|
Originally Posted by SA-MP wiki; https://sampwiki.blast.hk/wiki/Floats#Float_-.3E_Integer
new Float:fMyFloat = 1.3;
new nSomeInt = _:fMyFloat; //nSomeInt is now 1. |
[11:41:05] crackgprice = 1319677019 / 1414933888.000000 / 101
crackgpricetemp = (0.5/crackamount^2) * 10^8;
You can't use ^ operator in Pawn for floats, AFAIK it's the binary XOR operator and can be only used on ints.
If you need to square something or raise to a power use floatpower or just multiply by the same number. |
The problem is it tries to divide a float number by a number. And it expects a floating point number. It's defined that way in float.inc, it has to be a float number.
No prob |
[12:23:07] crackgprice = 4901 / 4901.479980 / 101 [12:23:07] potgprice = 80 / 80.000000 / 250 [12:23:07] DriversLicenseCost = 8000 / 8000.000000 / 423 [12:23:07] matprice = 125 / 124.999992 / 100000