Quite a setback

I was doing quite well but I have quite a problem. I’m making the Dead London gamemode and I need a money system. I’ve been trying for ages and have come up with nothing. If anyone could give me a tutorial on making one of how to use one from another gamemode/base I would be very appreciative.


(User was banned for this post ("Undescriptive thread title / wrong section" - mahalis))

GLON. Gmod lua wiki. That’s all you need. Or mysql if you know how to use it.

Dexter, I wouldn’t suggest he starts playing with GLON when he doesn’t know how to make something like this. One way to do it is using **[Player.SetPData

http://wiki.garrysmod.com/favicon.ico](wiki.garrysmod.com/?title=Player.SetPData)** and **[Player.GetPData

http://wiki.garrysmod.com/favicon.ico](wiki.garrysmod.com/?title=Player.GetPData)**.

Examples:

[lua]function GM:SetMoney( ply, amount )
ply:SetPData( “Money”, amount )
end

function GM:GiveMoney( ply, amount )
ply:SetPData( “Money”, self:GetMoney( ply ) + amount )
end

function GM:TakeMoney( ply, amount )
ply:SetPData( “Money”, self:GetMoney( ply ) - amount )
end

function GM:GetMoney( ply )
ply:GetPData( “Money” ) or 0
end[/lua]

Ok, thanks alot. I’ll try this.

If you’re still looking for some inspiration, here’s a sample money addon I made that includes saving to a SQL database.

http://entoros.pastebin.com/f2e88e84a

What’s the difference between PData and NWSTrings, does PData use DTVars?

No. PData saves it to the local LiteSQL Database.

PData is saved between maps/server restarts in the local SQL database.

Ooooh, i never noticed PData, might use that in my further endeavours.