AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [Solved] Mathematical operation help (https://forums.alliedmods.net/showthread.php?t=220046)

dFF 07-06-2013 07:48

[Solved] Mathematical operation help
 
I need some math calculation some like this:

[day] - [value]
40 - 8000
41 - 9000
42 - 10000
43 - 11000
44 - 12000
45 - 13000
.....

i tried some like:
PHP Code:

return day == 40 8000 day 1000 / ( day 10 ) ... ??? 


ConnorMcLeod 07-06-2013 07:57

Re: Mathematical operation help
 
Which usage do you need this for ?

What are values for day < 40 ?
Are values increased by 1000 each day after 40 ?

dFF 07-06-2013 08:03

Re: Mathematical operation help
 
Quote:

Originally Posted by ConnorMcLeod (Post 1984493)
Are values increased by 1000 each day after 40 ?

Yes.
If day < 40 i used others values - no problem here.

I don't have any idea how to calculate after the day is > 40, increased by 1000 each day, like in example of 1st post.

SpeeDeeR 07-06-2013 08:28

Re: Mathematical operation help
 
From your current day extract your base day and multiply it 1000. Then add it up to your base day value.

dFF 07-06-2013 08:49

Re: Mathematical operation help
 
Still no have any iddea :stupid:
PHP Code:


#define day_calc(%0) ( (%0+1) * 1000 + 8000)

---
value8000 for day 40
value
9000 for day 41
value
10000 for day 42
value
11000 for day 43
value
12000 for day 44
value
13000 for day 45
etc
... 


SpeeDeeR 07-06-2013 09:18

Re: Mathematical operation help
 
Dude I've already told you hold it should be done. Can't you follow simple instructions?!
Code:

NewValue = (CurrentDay - BaseDay) * 1000 + BaseDayValue

dFF 07-06-2013 09:40

Re: Mathematical operation help
 
oh, oky. done. Thanks!

fysiks 07-06-2013 14:48

Re: [Solved] Mathematical operation help
 
This is simple math. Find the equation of a straight line.


All times are GMT -4. The time now is 06:23.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.