SA-MP Forums Archive
[HELP] Working with dates (Property Tax) - 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: [HELP] Working with dates (Property Tax) (/showthread.php?tid=603180)



[HELP] Working with dates (Property Tax) - WhoIsYourDaddy - 19.03.2016

Hello guys, I'm trying to script a property tax system and having a rough time how to set date for a bought car (the day that a player buys the car) and give them a daily tax. Can someone please explain this logic? (Btw my gamemode is based on MySQL)

I've searched a lot but couldn't find any results.


Re: [HELP] Working with dates (Property Tax) - WhoIsYourDaddy - 20.03.2016

Up...


Re: [HELP] Working with dates (Property Tax) - Abagail - 20.03.2016

The best way(atleast in my own opinion) is to use timestamps for data functions. What do you mean by a "daily tax" though? When they log in on a different day? When it's strictly been 24 hours from the time bought? They've played 24 hours?


Re: [HELP] Working with dates (Property Tax) - WhoIsYourDaddy - 20.03.2016

Quote:
Originally Posted by Abagail
Посмотреть сообщение
The best way(atleast in my own opinion) is to use timestamps for data functions. What do you mean by a "daily tax" though? When they log in on a different day? When it's strictly been 24 hours from the time bought? They've played 24 hours?
Let me explain this through an example.

You bought a Infernus. ($100.000) It's daily tax will be %0.25 which is $250. The time they bought the car will be stored in database. (D/M/Y) Let's say they bought the car today. (20.3.2016) And tomorrow the vehicle tax will be $250. (stored in database as well)

For an even simple explanation; I want to change the tax (increase it) day by day.


Re: [HELP] Working with dates (Property Tax) - introzen - 20.03.2016

Quote:
Originally Posted by WhoIsYourDaddy
Посмотреть сообщение
Let me explain this through an example.

You bought a Infernus. ($100.000) It's daily tax will be %0.25 which is $250. The time they bought the car will be stored in database. (D/M/Y) Let's say they bought the car today. (20.3.2016) And tomorrow the vehicle tax will be $250. (stored in database as well)

For an even simple explanation; I want to change the tax (increase it) day by day.
You're talking about exponential growth. Here's an example:

Example
x0 = 50
r = 4% = 0.04
t = 90 hours
x(t) = x0 Ч (1 + r) t = 50Ч(1+0.04)90 = 1706

Source http://www.rapidtables.com/calc/math...calculator.htm