SA-MP Forums Archive
Calculate problem. - 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: Calculate problem. (/showthread.php?tid=600364)



Calculate problem. - Bruker - 07.02.2016

How could I do that every 500 km traveled by vehicle to increase the price of insurance for 100$?
Exemple:
KM < 500 = 100$ Insurance Price.
500 KM = 200$ Insurance Price.
1.000 KM = 300$ Insurance Price.
1.500 KM = 400$ Insurance Price.
...and so on...


Re: Calculate problem. - Vince - 07.02.2016

Код:
price = ((distance / 500) + 1) * 100;
Basic math, really.


Re: Calculate problem. - Bruker - 07.02.2016

Quote:
Originally Posted by Vince
Посмотреть сообщение
Код:
price = ((distance / 500) + 1) * 100;
Basic math, really.
Thank you man, thank you.
KM is a float variable, exemple: MYSQL TABLE: "3.8".