Money system

Hi, Im looking for someone to make a basic money system for me.
It whould be used on my sandbox server.

The money system would have a /givemoney chat command for giving money and a setmoney console command for setting a users cash, of course admin only.

4th the amount of money you have will display on the top left corner

lastly the whole system would be saved in a .txt file

Thanks for reading.


I pretty much have made something that basic, except it saves to the server’s sqlite. :smille:. I’ll post it later if I can.

hehe! i was looking for this to!

i want to use it so people can… erh… nevermind people will flame me if i say what i wanted to say

but yes i support this idea

Thanks, Sqlite support is ok :smiley:

Here’s what I have :
local Meta = FindMetaTable(“Player”)

function Meta:Money(money)
return self:GetNWInt(“Money”)

function Meta:SetMoney(money)
self:SetPData(“Money”, money)
self:SetNWInt(“Money”, money)

function Meta:CanAfford(cost)
return (self:Money() - cost) >= 0

hook.Add(“PlayerInitialSpawn”,“DataRetrieving”, function(ply)
if !ply:GetPData(“Money”) then ply:SetPData(“Money”,0) end
ply:SetNWInt(“Money”, ply:GetPData(“Money”) )

function ChangeMoney(ply,cmd,args)
local target, amount = FindPlayer(args[1]),tonumber(args[2])
if !ply:IsSuperAdmin() then ply:ChatPrint(“You don’t have access to that command!”) end
if !target then ply:ChatPrint(“No player found with a matching name!”) end
if amount < 0 then ply:ChatPrint(“You can’t use a negative number!”) end




function GiveMoney(ply,cmd,args)

local target = ply:GetEyeTrace().Entity
if !target:IsPlayer() or !ply:CanAfford(args[1]) then return end
target:SetMoney(target:Money() + args[1])
ply:SetMoney(ply:Money() - args[1])
target:ChatPrint("Received "..tostring(args[1]).."$ from "..ply:Nick().."!")
ply:ChatPrint("Gave "..tostring(args[1]).."$ to ""!")



function FindPlayer(info)
local players = player.GetAll()

for k, v in pairs(players) do
	if string.find(string.lower(v:Nick()), string.lower(tostring(info))) ~= nil then
		return v
return nil


[lua]local Meta = FindMetaTable(“Player”)

function Meta:Money(money)
return self:GetNWInt(“Money”)

draw.RoundedBox( 2, 25, ScrH() - 100, 130, 23, Color( 128, 255, 128, 255 ) )
draw.DrawText("Money: "…LocalPlayer():Money(), “ScoreboardText”, 30, ScrH() - 97, Color(255,255,255,255),0)

It’s pretty basic, not really done. Might have bugs too. Right now it uses only console commands so if you want chat commands you’ll have to make them yourself. Sorry that it isn’t commented, hope this helps! :smile:

It helps alot, Thanks :smiley:

Does it work?

hmm… if this could be worked out…

then it would be awesome if it was like you earn money by… erh i dunno… playing enough on the server? then you can open a menu with stuff in it (sents, sweps and stuff) and buy stuff!

thats a bit to far bit just a idea

Just use a timer.