Need assistance with some calculations: - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Need assistance with some calculations: (
/showthread.php?tid=507181)
Need assistance with some calculations: -
Dokins - 16.04.2014
Basically I'm trying to calculate the rate of inflation to apply that to everything in my server so:
Say the total amount in the server this month is: $1000.
Next month it's $2000.
That's a 100% increase, right?
How do I add that to each item. I.e
Say a cellphone costs $100, How do I add the rate of inflation to that amount if it's $100 increase? Would it be $200 now instead of $100?
How do I actually calculate it in code?
Re: Need assistance with some calculations: -
Evocator - 16.04.2014
Ok basically to get an increase in percentage you need an equation which is
Код:
Inflation Rate = ((Current Value - Starting Value) / Starting Value) * 100
Now for getting each item's value as an increase, you should
Код:
New Item Value = (Current Item Value) * Inflation Rate / 100
EDIT: Missed something in the equation
Re: Need assistance with some calculations: -
Dokins - 16.04.2014
PERFECT.
Thank you + REP.