Multiplier and Divider operators a bit bugged?
#1

Okay, well I can't explain this very good but sometimes the * and / operator's either return very OFF values or negative values, using the raw floatmul and floatdiv fixes it

Example, when someone sells a house in my server that has over 20m or around that price it gives them negative values, this is how the sale price is calculated

pawn Код:
SafeGivePlayerMoney(playerid, HouseInfo[i][Price] * 87/100);
Yet, it gave then -x instead of x.

doing this

pawn Код:
SafeGivePlayerMoney(playerid, floatround(floatdiv(floatmul(HouseInfo[i][Price], 87), 100)));
did the trick s:

I don't know if it's suppose to be like that but... if so just remove the topic please
Reply
#2

It's because you're trying to multiply an integer with a float and then returning an integer again.
pawn Код:
new price = floatround(float(HouseInfo[i][Price]) * 0.87);
Something like that should work.
Reply
#3

oh... well I kinda learnt by multiplying first so..

Thanks I guess..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)