16.05.2015, 15:39
I'm getting these really screwy errors and nothing I can think of has been able to help out:
I understand what this means, I just don't understand why I get them.
Each equation (matpricetemp = ..., etc) is the 'tag mismatch' line.
matpricetemp, potgpricetemp, crackgpricetemp and DriversLicenseCosttemp are all floats, so why do I have tag mismatches? crackamount, potamount and matamount are all clearly untagged (integers) and TaxValue is the same.
I have tried the following:
What I get from the printfs:
What's puzzling me, is I do the following:
and:
and I get...
So what gives? I've searched over the forums and every post I've come across has said you can use floatround() and _:var to convert a float to an integer:
I'm completely stumped and out of answers.
Another error is the following:
Even the float is calculated wrong:
I'm 100% sure that (0.5/101^2) * 10^8 is not 1414933888, so what is the problem?
Код:
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
pawn Код:
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);
matpricetemp, potgpricetemp, crackgpricetemp and DriversLicenseCosttemp are all floats, so why do I have tag mismatches? crackamount, potamount and matamount are all clearly untagged (integers) and TaxValue is the same.
I have tried the following:
- Adding float() tags around the equations (so matpricetemp = float((0.5/matamount^2) * 2.5 * 10^ et cetera)
- Using integers instead of floats for crackgpricetemp et cetera, and using crackgpricetemp = floatround((0.5/crackamount^2) * 10^;
- Printing the values to see what's happening with the following:
pawn Код: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);
What I get from the printfs:
Код:
[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
pawn Код:
DriversLicenseCost = floatround(DriversLicenseCosttemp);
pawn Код:
DriversLicenseCost = _:DriversLicenseCosttemp;
Код:
DriversLicenseCost = 1174011904 DriversLicenseCosttemp = 8000.000000 TaxValue = 423
Quote:
Originally Posted by Jeffry
new YourInteger = floatround(/*YourFloat*/, floatround_round);
|
Quote:
Originally Posted by SA-MP wiki; https://sampwiki.blast.hk/wiki/Floats#Fl...3E_Integer
new Float:fMyFloat = 1.3;
new nSomeInt = _:fMyFloat; //nSomeInt is now 1. |
Another error is the following:
Код:
[11:41:05] crackgprice = 1319677019 / 1414933888.000000 / 101
Код:
crackgpricetemp = (0.5/crackamount^2) * 10^8;