• Inflation Code for DarkRP [Abandonware]
    29 replies, posted
I was going through my old stuff and found this - someone might find it useful for their DarkRP server. As people print money, this causes the prices to change accordingly in the economy. I'm not sure if it still works but it might be useful for someone with their own custom server - or FPtje, if you want it. [code]-- Inflation script for DarkRP 2.2 and 2.3 -- Goes in garrysmod/lua/autorun/server -- Feb 22, 2009 -- philxyz LASTAVERAGEWALLET = 500 function DoInflation() -- Money on the ground local total = 0 for k, v in pairs(ents.GetAll()) do if v.GetTable and v:GetTable().MoneyBag and v:GetTable().Amount then total = total + v:GetTable().Amount end end -- Money in wallets for k, v in pairs(player.GetAll()) do local p = v:GetNWInt("money") if p >= 0 then total = total + p end end -- Find the average amount a player has local avg = total / #player.GetAll() -- Adjust all the prices for inflation CfgVars["doorcost"] = math.floor(0.06*avg) CfgVars["vehiclecost"] = math.floor(0.08*avg) CfgVars["maxnormalsalary"] = math.floor(0.09*avg) CfgVars["maxmayorsetsalary"] = math.floor(0.3*avg) CfgVars["propcost"] = math.floor(0.02*avg) SetGlobalInt("ak47cost", math.floor(4.9*avg)) SetGlobalInt("mp5cost", math.floor(4.4*avg)) SetGlobalInt("m4cost", math.floor(4.9*avg)) SetGlobalInt("m16cost", math.floor(4.9*avg)) SetGlobalInt("mac10cost", math.floor(4.3*avg)) SetGlobalInt("shotguncost", math.floor(3.5*avg)) SetGlobalInt("snipercost", math.floor(7.5*avg)) SetGlobalInt("deaglecost", math.floor(0.43*avg)) SetGlobalInt("fivesevencost", math.floor(0.41*avg)) SetGlobalInt("glockcost", math.floor(0.32*avg)) SetGlobalInt("p228cost", math.floor(0.37*avg)) SetGlobalInt("druglabcost", math.floor(avg)) SetGlobalInt("gunlabcost", math.floor(avg)) SetGlobalInt("mprintercost", math.floor(2.0*avg)) SetGlobalInt("mprintamount", math.floor(0.5*avg)) SetGlobalInt("microwavecost", math.floor(0.8*avg)) SetGlobalInt("drugpayamount", math.floor(0.03*avg)) SetGlobalInt("ammopistolcost", math.floor(0.06*avg)) SetGlobalInt("ammoriflecost", math.floor(0.12*avg)) SetGlobalInt("ammoshotguncost", math.floor(0.17*avg)) SetGlobalInt("healthcost", math.floor(0.12*avg)) SetGlobalInt("microwavefoodcost", math.floor(0.06*avg)) SetGlobalInt("maxcopsalary", math.floor(0.2*avg)) local difference = avg - LASTAVERAGEWALLET local pcntInflation = (difference / LASTAVERAGEWALLET) * 100.0 LASTAVERAGEWALLET = avg if difference < 0.0 then NotifyAll(1, 4, "Prices decreased by " .. tostring(math.floor(-pcntInflation * 100 + 0.5) / 100) .. "% for deflation!") elseif difference > 0.0 then NotifyAll(1, 4, "Prices increased by " .. tostring(math.floor(pcntInflation * 100 + 0.5) / 100) .. "% for inflation!") end end -- Every 10 minutes call DoInflation to adjust prices timer.Create("inflationtimer", 600, 0, DoInflation)[/code]
So sad it is for 2.2 or 2.3 i think someone can make it for 2.5 and it will be good addon for servers
[QUOTE=Justtr;45570474]So sad it is for 2.2 or 2.3 i think someone can make it for 2.5 and it will be good addon for servers[/QUOTE] Thanks - well, it is just Lua so although it was for 2.2, it could easily be adapted I'm sure. Also, each server is different in that there are different items available and it will need tweaking. In fact, even without the lua, the code is basically doing: [code] -- Inflation script for DarkRP 2.2 and 2.3 -- Goes in garrysmod/lua/autorun/server -- Feb 22, 2009 -- philxyz LASTAVERAGEWALLET = <PLAYER STARTING AMOUNT OF MONEY> function DoInflation() -- Add up all the money bundles which currenly exist lying around on the floor -- Add up all the players' money (for connected players only - if you want it for the entire economy you'll have to add up all the amounts in the database too) -- Find the total of the above -- Find the average amount of money per player by dividing all the money across the current players (or all the players in the database that connected within X time if you're doing it for everyone) -- Update all the prices (wherever they are set in the code) so that they have a certain multiplier of that average amount -- Get the difference by subtracting the new amount from the last amount recorded (which ran when this script ran the last time) -- Work out the percentage of the difference ((difference * 100) / last amount) -- Notify the users whether inflation or deflation occurred with an on screen message end -- Every 10 minutes call DoInflation to adjust prices timer.Create("inflationtimer", 600, 0, DoInflation) [/code]
I might recreate this, if you wouldn't mind explaining the maths behind it, since I'm getting a lil' confused with the calculation. So instead of using flat numbers (0.06, 0.08, ...), I want to make it dynamic from the price of the item itself. So say I have a shipment of weapons that cost 600; What would I need to do to 600 to adjust the price?
[QUOTE=Alig96;45571515]I might recreate this, if you wouldn't mind explaining the maths behind it, since I'm getting a lil' confused with the calculation. So instead of using flat numbers (0.06, 0.08, ...), I want to make it dynamic from the price of the item itself. So say I have a shipment of weapons that cost 600; What would I need to do to 600 to adjust the price?[/QUOTE] You could multiply the fixed price by a factor If the price of the item is 600, then if you know that players start with 500 (for example), then the pistol would be (600/500) = 1.2 1.2 times the starting salary of a player. Does that help?
[QUOTE=ph:lxyz;45571599]You could multiply the fixed price by a factor If the price of the item is 600, then if you know that players start with 500 (for example), then the pistol would be (600/500) = 1.2 1.2 times the starting salary of a player. Does that help?[/QUOTE] Surely then the price wouldn't change, since starting salary is fixed? If you mean overwrite the 500 variable with the average after the first rep of the timer, then surely it will make pistols cost less which is the opposite effect I need; E.g The normal price for a pistol is 600, players start with 500 then the pistol would be (600/500) = 1.2 So the starting price would be; 600*1.2 = 720 On the next rep, if it goes using the average of a players wallet instead of the starting salary it would be say; Total Cash = 10,000 Total Players = 5 Average = 10,000 / 5 = 2,000 Factor = 720/2,000 = 0.36 So then the next price would be; 720*0.36 = 259 Which If I understand inflation is the opposite effect (price goes higher the more money there is) I think I'm over thinking this....
Here is another example, maybe this makes more sense: Firstly I recommend to take an average of ALL the money on the server and divide it between ALL the unique steam IDs in the darkrp money database to get a wide set of data. Then, :- As the timer ticks (every 10 minutes, presently): Total cash = 10,000 (in db and money entities combined) Total players = 5 (in db) Player average holdings = 2000 Factor predicided for snipercost is 1.2 (starting_salary * 1.2 = 600) so new price = 1.2 * 2000 ( what the average player has ) 2000 * sniperprice factor of 1.2 = 2400 for a sniper shipment [code] SetGlobalInt("snipercost", math.floor((600 / starting_salary) * avg)) [/code] Remember that if a new player joins and they have 500, the prices will be very high for that player to start with, so you might want to give those new players a starting value which is maybe 30% of what the other players have on average at the point that they join the server, and make their paycheck a percentage of the average as well so that they can save up. Pay has to rise with inflation. That will actually fix the issues that caused me to abandon the script and it will be quite good... when you join a server you can get an idea of how much moneyprinting has been going on by looking at your money!
Holy shit, I remember the CfgVars table and the GobalInts. These two caused me a huge headache when people were disconnecting from servers with network overflow errors. Rest assured this code definitely doesn't work with the latest version :v:
So pseudocode: factor = price / starting_salary price = factor * average_wallet So when the server does the first tick, it will be; (using your example) factor = 1.2 price = 2400 On the second tick it would be: (price changed, so adjust factor) factor = 2400 / 500 = 4.8 price = 2000 * 4.8 = 9600 Once again its wrong since this would infinitely get bigger and bigger I assume that we don't want to feed the inflated price back into the factor, but how about instead of using starting salary I used average salary of current connected players instead? Edit: <bad calculations> Thinking over it, it wouldn't work since if there was only 1 player on, it would be cheap as balls...
[QUOTE=FPtje;45572089]Rest assured this code definitely doesn't work with the latest version :v:[/QUOTE] Sure, I mean it [i]is[/i] abandoned. But then it is the general idea that counts. [QUOTE=Alig96] So pseudocode: factor = price / starting_salary price = factor * average_wallet So when the server does the first tick, it will be; (using your example) factor = 1.2 price = 2400 On the second tick it would be: (price changed, so adjust factor) factor = 2400 / 500 = 4.8 price = 2000 * 4.8 = 9600 Once again its wrong since this would infinitely get bigger and bigger I assume that we don't want to feed the inflated price back into the factor, but how about instead of using starting salary I used average salary of current connected players instead? Edit: <bad calculations> Thinking over it, it wouldn't work since if there was only 1 player on, it would be cheap as balls... [/QUOTE] I would suggest changing the starting salary to be a percentage (say 25%) of the average in all the existing player's wallets. So, if the average is 2000, the starting salary for new players will be 500. If the prices go up, the starting salary goes up and the wages should go up also (maybe by a depreciating factor but that is up to you) [b]In the section where you wrote "On the second tick..." , the input to the factor should never change. If the old original price was 600, keep that constant. If anything, the starting money should inflate (see above)[/b] For example: [code] new_item_price = math.floor((600 / starting_salary) * avg) [/code] notice how 600 is hard coded there to whatever the price is meant to be. This could even come from one of the Config variables (but that might confuse other users that try to set it to something since the prices change!)
Okay, so when I got home, I started to remake this, and here is what I have for the first few tests: [code] ] lua_run econ.Functions.AdjustPrices( econ.Functions.CalcAverageWallet(), econ.Functions.CalcAverageSalary() ) > econ.Functions.AdjustPrices( econ.Functions.CalcAverageWallet(), econ.Functions.CalcAverageSalary() )... Average Wallet: 861.25 Average Salary: 45 Pistol ammo has been changed from 30 to 574(1813%) Shotgun ammo has been changed from 50 to 956(1812%) Rifle ammo has been changed from 80 to 1531(1814%) Desert eagle (Sep) has been changed from 215 to 4114(1813%) Desert eagle has been changed from 215 to 4114(1813%) Fiveseven (Sep) has been changed from 205 to 3923(1814%) Glock (Sep) has been changed from 160 to 3062(1814%) P228 (Sep) has been changed from 185 to 3540(1814%) AK47 has been changed from 2450 to 46890(1814%) MP5 has been changed from 2200 to 42105(1814%) M4 has been changed from 2450 to 46890(1814%) Mac 10 has been changed from 2150 to 41148(1814%) Pump shotgun has been changed from 1750 to 33493(1814%) Sniper rifle has been changed from 3750 to 71770(1814%) G3A3 has been changed from 10 to 191(1810%) Drug lab has been changed from 400 to 7655(1814%) Money printer has been changed from 1000 to 19138(1814%) Gun lab has been changed from 500 to 9569(1814%) ] rp_setmoney aliii 2000 You set [Sperpes] Aliiig96's money to $2,000. [Sperpes] Aliiig96 set your money to $2,000. [DarkRP] [Sperpes] Aliiig96 (STEAM_0:0:49657803) set [Sperpes] Aliiig96's money to $2,000 ] lua_run econ.Functions.AdjustPrices( econ.Functions.CalcAverageWallet(), econ.Functions.CalcAverageSalary() ) > econ.Functions.AdjustPrices( econ.Functions.CalcAverageWallet(), econ.Functions.CalcAverageSalary() )... Average Wallet: 1077.5 Average Salary: 45 Pistol ammo has been changed from 574 to 718(25%) Shotgun ammo has been changed from 956 to 1197(25%) Rifle ammo has been changed from 1531 to 1915(25%) Desert eagle (Sep) has been changed from 4114 to 5148(25%) Desert eagle has been changed from 4114 to 5148(25%) Fiveseven (Sep) has been changed from 3923 to 4908(25%) Glock (Sep) has been changed from 3062 to 3831(25%) P228 (Sep) has been changed from 3540 to 4429(25%) AK47 has been changed from 46890 to 58663(25%) MP5 has been changed from 42105 to 52677(25%) M4 has been changed from 46890 to 58663(25%) Mac 10 has been changed from 41148 to 51480(25%) Pump shotgun has been changed from 33493 to 41902(25%) Sniper rifle has been changed from 71770 to 89791(25%) G3A3 has been changed from 191 to 239(25%) Drug lab has been changed from 7655 to 9577(25%) Money printer has been changed from 19138 to 23944(25%) Gun lab has been changed from 9569 to 11972(25%) ] rp_setsalary aliii 150 You set [Sperpes] Aliiig96's salary to $150. [Sperpes] Aliiig96 set your salary to $150. [DarkRP] [Sperpes] Aliiig96 (STEAM_0:0:49657803) set [Sperpes] Aliiig96's salary to $150 ] lua_run econ.Functions.AdjustPrices( econ.Functions.CalcAverageWallet(), econ.Functions.CalcAverageSalary() ) > econ.Functions.AdjustPrices( econ.Functions.CalcAverageWallet(), econ.Functions.CalcAverageSalary() )... Average Wallet: 1077.5 Average Salary: 71.25 Pistol ammo has been changed from 718 to 453(-37%) Shotgun ammo has been changed from 1197 to 756(-37%) Rifle ammo has been changed from 1915 to 1209(-37%) Desert eagle (Sep) has been changed from 5148 to 3251(-37%) Desert eagle has been changed from 5148 to 3251(-37%) Fiveseven (Sep) has been changed from 4908 to 3100(-37%) Glock (Sep) has been changed from 3831 to 2419(-37%) P228 (Sep) has been changed from 4429 to 2797(-37%) AK47 has been changed from 58663 to 37050(-37%) MP5 has been changed from 52677 to 33270(-37%) M4 has been changed from 58663 to 37050(-37%) Mac 10 has been changed from 51480 to 32514(-37%) Pump shotgun has been changed from 41902 to 26464(-37%) Sniper rifle has been changed from 89791 to 56710(-37%) G3A3 has been changed from 239 to 151(-37%) Drug lab has been changed from 9577 to 6049(-37%) Money printer has been changed from 23944 to 15122(-37%) Gun lab has been changed from 11972 to 7561(-37%) [/code] The prices are expensive shit! The calculation for adjusting the price is: math.floor((original_price / avg_sal) * avg_wal) So, say for the pistol ammo in the first change, the original price is 30. 30 / 45 * 861 = 574 Then I re-read your comment and re-adjusted it to use 25% of the average salary and here is the results: [code] ] lua_run econ.Functions.AdjustPrices( econ.Functions.CalcAverageWallet(), econ.Functions.CalcAverageSalary() ) > econ.Functions.AdjustPrices( econ.Functions.CalcAverageWallet(), econ.Functions.CalcAverageSalary() )... Average Wallet: 1227.5 Average Salary: 45 Starting Salary: 45 * 0.25 = 11.25 Pistol ammo has been changed from 30 to 3273(10810%) Shotgun ammo has been changed from 50 to 5455(10810%) Rifle ammo has been changed from 80 to 8728(10810%) Desert eagle (Sep) has been changed from 215 to 23458(10811%) Desert eagle has been changed from 215 to 23458(10811%) Fiveseven (Sep) has been changed from 205 to 22367(10811%) Glock (Sep) has been changed from 160 to 17457(10811%) P228 (Sep) has been changed from 185 to 20185(10811%) AK47 has been changed from 2450 to 267322(10811%) MP5 has been changed from 2200 to 240044(10811%) M4 has been changed from 2450 to 267322(10811%) Mac 10 has been changed from 2150 to 234588(10811%) Pump shotgun has been changed from 1750 to 190944(10811%) Sniper rifle has been changed from 3750 to 409166(10811%) G3A3 has been changed from 10 to 1091(10810%) Drug lab has been changed from 400 to 43644(10811%) Money printer has been changed from 1000 to 109111(10811%) Gun lab has been changed from 500 to 54555(10811%) [/code] And the prices were even more insane, so what needs to be adjusted?
OK, I think the following should work quite well and inflate without immediately causing problems - what I wrote above is not exactly what you implemented, but then my version was not quite right either: Give this a go and see how it goes... Each time the code runs, [b]first[/b] set [i]new_player_starting_amount[/i] like this: [code] money = avg_of_all_wallets_in_database + total amount found in cash bundle entities lying around new_player_starting_amount = math.floor(0.25 * money) [/code] Then for each item: [code] inflation_adjusted_item_price = math.floor(money * (original_constant_item_price / new_player_starting_amount)) [/code] Then, for the salary, assuming that the player salary is normally 45 on a standard DarkRP installation (might be different for police chief but maybe Falco has changed it since then), that is 9% of the normal starting amount of 500, so, the salary setting should be set to: [code] salary = math.floor(0.09 * new_player_starting_amount) [/code] That should cover everything. If you want purchasing power to go down as the inflation goes up, you can drop the salary gently compared with the starting amount for new players as the number gets higher. To do this, you would subtract a number from the salary which is proportional to the amount of money in the economy.
[QUOTE=ph:lxyz;45575420]OK, I think the following should work quite well and inflate without immediately causing problems - what I wrote above is not exactly what you implemented, but then my version was not quite right either: Give this a go and see how it goes... Each time the code runs, [b]first[/b] set [i]new_player_starting_amount[/i] like this: [code] money = avg_of_all_wallets_in_database + total amount found in cash bundle entities lying around new_player_starting_amount = math.floor(0.25 * money) [/code] Then for each item: [code] inflation_adjusted_item_price = math.floor(money * (original_constant_item_price / new_player_starting_amount)) [/code] Then, for the salary, assuming that the player salary is normally 45 on a standard DarkRP installation (might be different for police chief but maybe Falco has changed it since then), that is 9% of the normal starting amount of 500, so, the salary setting should be set to: [code] salary = math.floor(0.09 * new_player_starting_amount) [/code] That should cover everything. If you want purchasing power to go down as the inflation goes up, you can drop the salary gently compared with the starting amount for new players as the number gets higher. To do this, you would subtract a number from the salary which is proportional to the amount of money in the economy.[/QUOTE] The new example will never change and will always stay the same, Item price is 30: Example 1: money = 1000 new_player_starting_amount = math.floor(0.25 * 1000) = 250 inflation_adjusted_item_price = math.floor(1000 * (30 / 250)) = 120 Example 2: money = 5000 new_player_starting_amount = math.floor(0.25 * 5000) = 1250 inflation_adjusted_item_price = math.floor(5000 * (30 / 1250)) = 120
[QUOTE=Alig96;45575627]The new example will never change and will always stay the same, Item price is 30: Example 1: money = 1000 new_player_starting_amount = math.floor(0.25 * 1000) = 250 inflation_adjusted_item_price = math.floor(1000 * (30 / 250)) = 120 Example 2: money = 5000 new_player_starting_amount = math.floor(0.25 * 5000) = 1250 inflation_adjusted_item_price = math.floor(5000 * (30 / 1250)) = 120[/QUOTE] Ah - well spotted - hmmm... having a little rethink... EDIT: You could keep the starting salary fixed then set salary to be calculated the same way as the inflation_adjusted_item_price except put the value "45" in where you have 30 for the item above. [code] salary = math.floor(money * (45 / fixed_starting_amount)) [/code] Does that look better?
Okay, so I went back to my original calc of: math.floor((original_price / avg_sal) * avg_wal) However, I made it 10% of the average wallet amount, and it is now a more subtle change. This is with 4 players connected. [code] ] lua_run econ.Functions.AdjustPrices( econ.Functions.CalcAverageWallet(), econ.Functions.CalcAverageSalary() ) > econ.Functions.AdjustPrices( econ.Functions.CalcAverageWallet(), econ.Functions.CalcAverageSalary() )... Average Wallet: 1571 Average Salary: 45 Pistol ammo has been changed from 104 to 104(0%) Shotgun ammo has been changed from 174 to 174(0%) Rifle ammo has been changed from 279 to 279(0%) Desert eagle (Sep) has been changed from 750 to 750(0%) Desert eagle has been changed from 750 to 750(0%) Fiveseven (Sep) has been changed from 715 to 715(0%) Glock (Sep) has been changed from 558 to 558(0%) P228 (Sep) has been changed from 645 to 645(0%) AK47 has been changed from 8553 to 8553(0%) MP5 has been changed from 7680 to 7680(0%) M4 has been changed from 8553 to 8553(0%) Mac 10 has been changed from 7505 to 7505(0%) Pump shotgun has been changed from 6109 to 6109(0%) Sniper rifle has been changed from 13091 to 13091(0%) G3A3 has been changed from 34 to 34(0%) Drug lab has been changed from 1396 to 1396(0%) Money printer has been changed from 3491 to 3491(0%) Gun lab has been changed from 1745 to 1745(0%) ] rp_setmoney alii 1000 You set [Sperpes] Aliiig96's money to $1,000. [Sperpes] Aliiig96 set your money to $1,000. [DarkRP] [Sperpes] Aliiig96 (STEAM_0:0:49657803) set [Sperpes] Aliiig96's money to $1,000 ] lua_run econ.Functions.AdjustPrices( econ.Functions.CalcAverageWallet(), econ.Functions.CalcAverageSalary() ) > econ.Functions.AdjustPrices( econ.Functions.CalcAverageWallet(), econ.Functions.CalcAverageSalary() )... Average Wallet: 1662 Average Salary: 45 Pistol ammo has been changed from 104 to 110(5.77%) Shotgun ammo has been changed from 174 to 184(5.75%) Rifle ammo has been changed from 279 to 295(5.73%) Desert eagle (Sep) has been changed from 750 to 794(5.87%) Desert eagle has been changed from 750 to 794(5.87%) Fiveseven (Sep) has been changed from 715 to 757(5.87%) Glock (Sep) has been changed from 558 to 590(5.73%) P228 (Sep) has been changed from 645 to 683(5.89%) AK47 has been changed from 8553 to 9048(5.79%) MP5 has been changed from 7680 to 8125(5.79%) M4 has been changed from 8553 to 9048(5.79%) Mac 10 has been changed from 7505 to 7940(5.8%) Pump shotgun has been changed from 6109 to 6463(5.79%) Sniper rifle has been changed from 13091 to 13850(5.8%) G3A3 has been changed from 34 to 36(5.88%) Drug lab has been changed from 1396 to 1477(5.8%) Money printer has been changed from 3491 to 3693(5.79%) Gun lab has been changed from 1745 to 1846(5.79%) ] rp_setmoney alii 10000 You set [Sperpes] Aliiig96's money to $10,000. [Sperpes] Aliiig96 set your money to $10,000. [DarkRP] [Sperpes] Aliiig96 (STEAM_0:0:49657803) set [Sperpes] Aliiig96's money to $10,000 ] lua_run econ.Functions.AdjustPrices( econ.Functions.CalcAverageWallet(), econ.Functions.CalcAverageSalary() ) > econ.Functions.AdjustPrices( econ.Functions.CalcAverageWallet(), econ.Functions.CalcAverageSalary() )... Average Wallet: 3462 Average Salary: 45 Pistol ammo has been changed from 110 to 230(109.09%) Shotgun ammo has been changed from 184 to 384(108.7%) Rifle ammo has been changed from 295 to 615(108.47%) Desert eagle (Sep) has been changed from 794 to 1654(108.31%) Desert eagle has been changed from 794 to 1654(108.31%) Fiveseven (Sep) has been changed from 757 to 1577(108.32%) Glock (Sep) has been changed from 590 to 1230(108.47%) P228 (Sep) has been changed from 683 to 1423(108.35%) AK47 has been changed from 9048 to 18848(108.31%) MP5 has been changed from 8125 to 16925(108.31%) M4 has been changed from 9048 to 18848(108.31%) Mac 10 has been changed from 7940 to 16540(108.31%) Pump shotgun has been changed from 6463 to 13463(108.31%) Sniper rifle has been changed from 13850 to 28850(108.3%) G3A3 has been changed from 36 to 76(111.11%) Drug lab has been changed from 1477 to 3077(108.33%) Money printer has been changed from 3693 to 7693(108.31%) Gun lab has been changed from 1846 to 3846(108.34%) ] rp_setmoney alii 100000 You set [Sperpes] Aliiig96's money to $100,000. [Sperpes] Aliiig96 set your money to $100,000. [DarkRP] [Sperpes] Aliiig96 (STEAM_0:0:49657803) set [Sperpes] Aliiig96's money to $100,000 ] lua_run econ.Functions.AdjustPrices( econ.Functions.CalcAverageWallet(), econ.Functions.CalcAverageSalary() ) > econ.Functions.AdjustPrices( econ.Functions.CalcAverageWallet(), econ.Functions.CalcAverageSalary() )... Average Wallet: 21462 Average Salary: 45 Pistol ammo has been changed from 230 to 1430(521.74%) Shotgun ammo has been changed from 384 to 2384(520.83%) Rifle ammo has been changed from 615 to 3815(520.33%) Desert eagle (Sep) has been changed from 1654 to 10254(519.95%) Desert eagle has been changed from 1654 to 10254(519.95%) Fiveseven (Sep) has been changed from 1577 to 9777(519.97%) Glock (Sep) has been changed from 1230 to 7630(520.33%) P228 (Sep) has been changed from 1423 to 8823(520.03%) AK47 has been changed from 18848 to 116848(519.95%) MP5 has been changed from 16925 to 104925(519.94%) M4 has been changed from 18848 to 116848(519.95%) Mac 10 has been changed from 16540 to 102540(519.95%) Pump shotgun has been changed from 13463 to 83463(519.94%) Sniper rifle has been changed from 28850 to 178850(519.93%) G3A3 has been changed from 76 to 476(526.32%) Drug lab has been changed from 3077 to 19077(519.99%) Money printer has been changed from 7693 to 47693(519.95%) Gun lab has been changed from 3846 to 23846(520.02%) [/code] Would you say this is the right affect we're going for here? The price only gets inflated alot if one player (or a few) have an insane amount of money disparity between the other players. (As you can see above when the average gets bumped to 20,000)
[QUOTE=Alig96;45575848] Would you say this is the right affect we're going for here? The price only gets inflated alot if one player (or a few) have an insane amount of money disparity between the other players. (As you can see above when the average gets bumped to 20,000)[/QUOTE] It looks good to me - it can be tricky to get right but you might have got it there - best way to know for sure is to playtest it for a while and see if anything seems out-of-whack. Keep in mind the bit above about salaries, though - if those don't increase at all, the players will lose any purchasing power very quickly indeed. I had that problem with my older version. It should inflate but allow the players to catch up if they work harder than others to gain cash. That said, it looks good!
[lua] //Inflation-al Salary Mod hook.Add( "playerGetSalary", "econ_SalaryMod", function( ply, amount ) local sal = math.floor(econ.Functions.CalcAverageWallet() * (econ.Functions.CalcAverageSalary() / 500)) return false, "Payday! You received " .. DarkRP.formatMoney(amount) .. " + (INF:".. DarkRP.formatMoney(sal - amount) ..")", sal end ) [/lua] Output: [code] Average Wallet: 2572 Average Salary: 45 ... Payday! You received $45 + (INF:$186) Payday! You received $45 + (INF:$190) Payday! You received $45 + (INF:$212) Payday! You received $45 + (INF:$217) Payday! You received $45 + (INF:$221) Payday! You received $45 + (INF:$226) [/code] Does this look right? Or is the inflation salary amount too much?
Yes, that was what I meant, but you're right it looks slightly off - so now try increasing paychecks by 10% of the inflation amount. That way you'll bring it more in line with the rest of it. 45 + math.floor(INF * 0.1)
Hah. Sorry to not contribute much, but I'm surprised I haven't seen something like this in a server before (I dont play much anymore though). Incredibly neat idea, though.
Alig: Once you're happy with it, you could maybe release it on the workshop or even communicate with FPtje about including it as an option in the base gamemode. Another thing to mention: To avoid [i]Hyper[/i] inflation, we want to keep the money printer producing the normal amount. That should keep the system in check a little bit at least hehehe
I'll probably stick it up on github, since I don't actually have a community darkrp server to use it with anyway :v: Oh and I don't think Falco would want to put a feature that would cause him hassle, since about 90% of servers are owned by kids who like to spawn themselves a shit tonne of money, so it would cause the prices to be insane when they have a-gajollion monies. (that's a number I swear) So they'll be like "omg why are the prices too high!" I'm just making this for the hell of it, seemed like fun. Also I think I'm going to implement some statistics, like maybe some line graphs to show the fluctuation in price from when it first started running. Maybe a graph for total money in the economy too
[QUOTE=Alig96;45578736]I'll probably stick it up on github, since I don't actually have a community darkrp server to use it with anyway :v: I'm just making this for the hell of it, seemed like fun. Also I think I'm going to implement some statistics, like maybe some line graphs to show the fluctuation in price from when it first started running. Maybe a graph for total money in the economy too[/QUOTE] It would be cool if the mayor can see that info so he can decide how much he needs to get his police chief to go after the money printing! The bundles of cash need to be counted also in the counting of money since the script might run at the moment that 10K is down on a counter being paid to someone. You might already have that though.
I'm just thinking about the impact it would have on small and big servers. The more registered players, the less of an effect 1 person can have on the economy, since it would be harder to change the average. So let's say a server has around 100 people registered and the richest player decided he doesn't want to play anymore so he decides to burn all his money, by doing that he will affect the prices a lot more than say on a server with a 1000 players registered. Its scary (and interesting) to think that in a smaller server the prices could crash if he destroyed a large amount of money.
[QUOTE=Alig96;45578808]I'm just thinking about the impact it would have on small and big servers. The more registered players, the less of an effect 1 person can have on the economy, since it would be harder to change the average. So let's say a server has around 100 people registered and the richest player decided he doesn't want to play anymore so he decides to burn all his money, by doing that he will affect the prices a lot more than say on a server with a 1000 players registered. Its scary (and interesting) to think that in a smaller server the prices could crash if he destroyed a large amount of money.[/QUOTE] Yep it will certainly be interesting!
Just to show a little progress: [t]http://i.gyazo.com/bda876fde4a895fa4e01557beb128f6b.png[/t] The first part in that time line is when it was just me, with 45 salary & $100, then the second time, is where I added a bot, and it slightly dipped in the average wallet. The 3rd part is where I changed my job to Mayor so my salary went up, the huge spike in the graph is where I set my cash $1,000 then finally set it back to normal. Sucks I can't monitor it with some actual data...
That looks great! There must be a willing server owner ready to try this out...
-snip-
Well, aslong as you guys can accept that It hasn't had proper testing and could crash the prices or make then insane, since I'm not sure how it will work. I'll stick it up on github later today. [editline]4th August 2014[/editline] The effects of spawning money or cashing out a money printer (then destroying the money) [img]http://i.gyazo.com/10414a9ddbaeef660810269efaebf625.png[/img] [img]http://i.gyazo.com/7549703a05739da91110c91a9d14369b.png[/img] [img]http://i.gyazo.com/7e9ea5837e8bf7b3542dba90f6ac9c65.png[/img]
Looks nice, it will be nice to see the graphs for a large server over a few days! :P
Sorry, you need to Log In to post a reply to this thread.