Causing negative numbers - Inflation system
#1

pawn Код:
InfPrice(oldprice)
{
    if(TotalServerMoney < 7000000) return oldprice;
    new newprice, money, Float: money2, Float: money3;
    money = TotalServerMoney - ServerStartMoney;
    money2 = money * 100;
    money3 = money2 / ServerStartMoney;
    new Float: calc = money3 / 100;
    new Float: calc2 = calc * oldprice;
    newprice = oldprice + floatround(calc2);
    return newprice;
}
Essentially, when it's called it causes negative numbers, essentially giving people money.

IT ONLY DOES THIS WHEN THE TOTALSERVERMONEY > 290,000,000

The server total money = $305,88,913

Will be wiping this but I need to know the cause?

Код:
[13:15:41] Money = 22000000
[13:15:41] Money2 = -822493868
[13:15:41] Money3 = -1013603335
[13:15:41] calc = -1069577676
[13:15:41] calc2 = -1005214727
[13:15:41] newprice = -399
Reply
#2

RESOLVED - Caused by integer > int maximum.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)