Tag mismatch on a float?
#1

I'm getting these really screwy errors and nothing I can think of has been able to help out:
Код:
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
I understand what this means, I just don't understand why I get them.

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);
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:
  • 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);
I have also tried changing crackgprice = floatround(crackgpricetemp); to crackgprice = _:crackgpricetemp; and it still doesn't work.

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
What's puzzling me, is I do the following:
pawn Код:
DriversLicenseCost = floatround(DriversLicenseCosttemp);
and:
pawn Код:
DriversLicenseCost = _:DriversLicenseCosttemp;
and I get...
Код:
DriversLicenseCost = 1174011904
DriversLicenseCosttemp = 8000.000000
TaxValue = 423
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:

Quote:
Originally Posted by Jeffry
new YourInteger = floatround(/*YourFloat*/, floatround_round);
Quote:
new Float:fMyFloat = 1.3;
new nSomeInt = _:fMyFloat;

//nSomeInt is now 1.
I'm completely stumped and out of answers.

Another error is the following:
Код:
[11:41:05] crackgprice = 1319677019 / 1414933888.000000 / 101
Even the float is calculated wrong:
Код:
crackgpricetemp = (0.5/crackamount^2) * 10^8;
I'm 100% sure that (0.5/101^2) * 10^8 is not 1414933888, so what is the problem?
Reply


Messages In This Thread
Tag mismatch on a float? - by [FMJ]PowerSurge - 16.05.2015, 15:39
Re: Tag mismatch on a float? - by Virtual1ty - 16.05.2015, 15:59
Re: Tag mismatch on a float? - by [FMJ]PowerSurge - 16.05.2015, 16:10
Re: Tag mismatch on a float? - by Virtual1ty - 16.05.2015, 16:15
Re: Tag mismatch on a float? - by [FMJ]PowerSurge - 16.05.2015, 16:16
Re: Tag mismatch on a float? - by Joe Staff - 16.05.2015, 16:57

Forum Jump:


Users browsing this thread: 2 Guest(s)