Cap money limit?

I was looking into capping the maximum amount of money people can have in their wallets to 5,000 but am trying to find a ‘master’ location of where I can actually write something like that in Darkrp as I don’t want to rewrite every function that takes money away to check if wallet > 5000. Any help?

Hm: self.DarkRPVars.money seems to be what things use to check how much money a player has. So could I use something in like main.lua to say:

if self.DarkRPVars.money > 5000 then
self.DarkRPVars.money == 5000
ply:Notify( “Blabla your wallet is full”)
end

only thing is it will still eat up the money that is put into the wallet.

You want to go into meta:AddMoney and do it there, that function is used everywhere.
[lua]
function meta:AddMoney(amount)
if not amount then return false end

hook.Call("PlayerWalletChanged", GAMEMODE, ply, amount)

local newmoney = self.DarkRPVars.money + math.floor(amount)
if newmoney > 5000 then
	newmoney = 5000
end
DB.StoreMoney(self, newmoney)

end[/lua]

By the way that go’s in garrysmod/gamemodes/DarkRP/gamemode/server/player.lua then on line 399 you should see this

[lua]
function meta:AddMoney(amount)
if not amount then return false end
hook.Call(“PlayerWalletChanged”, GAMEMODE, ply, amount)
DB.StoreMoney(self, self.DarkRPVars.money + math.floor(amount))
end
[/lua]