Multiplying to a Decimal Number -
Neil. - 11.02.2013
pawn Код:
new SellPrice;
SellPrice = AHouseData[HouseID][HousePrice] * 0.1;
It's giving me tag mismatch errors. But when I do subtraction or addition it doesn't return that error?
Help
Respuesta: Multiplying to a Decimal Number -
admantis - 11.02.2013
If you need to, make it a float number.
new Float:SellPrice;
SellPrice = AHouseData[HouseID][HousePrice] * 0.1;
GivePlayerMoney(playerid, (floatround(SellPrice)));
Re: Respuesta: Multiplying to a Decimal Number -
Neil. - 11.02.2013
Quote:
Originally Posted by admantis
If you need to, make it a float number.
new Float:SellPrice;
SellPrice = AHouseData[HouseID][HousePrice] * 0.1;
GivePlayerMoney(playerid, (floatround(SellPrice)));
|
Is the float conversion necessary? Tried that still, compiles with a tag mismatch error
Re: Multiplying to a Decimal Number -
Sasoft - 11.02.2013
I guess you could try this
Re: Multiplying to a Decimal Number -
Neil. - 11.02.2013
Quote:
Originally Posted by Sasoft
I guess you could try this
|
That wouldn't work at all
Re: Multiplying to a Decimal Number -
vIBIENNYx - 11.02.2013
Create a new float variable and assign the value as 0.1, then keep SellPrice as a float and do the equation that way.
Respuesta: Multiplying to a Decimal Number -
kirk - 11.02.2013
Quote:
Originally Posted by admantis
If you need to, make it a float number.
new Float:SellPrice;
SellPrice = AHouseData[HouseID][HousePrice] * 0.1;
GivePlayerMoney(playerid, (floatround(SellPrice)));
|
Do it this way and make sure, AHouseData[HouseID][HousePrice] its a float.
Re: Multiplying to a Decimal Number -
denNorske - 11.02.2013
As mentioned above, you could try to use a variable/define which is set to 0.1, and then attempt to try again.
like:
and keep the number as a Float - ; And it should work.
Re: Multiplying to a Decimal Number -
Neil. - 11.02.2013
Quote:
Originally Posted by vIBIENNYx
Create a new float variable and assign the value as 0.1, then keep SellPrice as a float and do the equation that way.
|
A bit of noobish here, but would I do it like this?
pawn Код:
new Float:multi;
multi = 0.1;
new Float:SellPrice = AHouseData[HouseID][HousePrice] * multi;
return floatround(SellPrice);
Re: Multiplying to a Decimal Number -
Sinner - 11.02.2013
It returns a tag mismatch because HousePrice isn't a float either.
pawn Код:
new Float:SellPrice;
SellPrice = float(AHouseData[HouseID][HousePrice]) * 0.1;