Bank System [DARKRP MODULE]

Hello guys, since there is no working public darkrp bank plugin out there i decided to make one,
this is not the most advanced addon but it works.

http://www.garrysmod.org/img/?t=dll&id=115025

Enjoy!

stop cry anderson64 and maskedmayhem, i know you got buttraped.

This is totally awesome.

I like how you used less than 200 lines of code for this. But couldn’t you make the code look better as in, indenting properly and stuff?

Maybe that’s something for v 1.1

Now I can’t sell my bank system anymore. :frowning:

yeah, but the function is always the most important part :3

[editline]17th December 2010[/editline]

thank you.

[editline]17th December 2010[/editline]

:’(

Beast!

new version.

http://www.garrysmod.org/img/?t=dll&id=115025

I must say, this has blown me away.

(I’m sorry I had to :xd:)

so the interest? i seem to stay with the same amount of cash

the bank interest is 10%

So much potential wasted in… urghh DarkRp (Or 'TardRP)

you do not have to say it several times.

http://img146.imageshack.us/img146/4003/awej.jpg

My hate for Darkrp is almost infinite :<
And it’s not like i was insulting you, your mod is Awesome.I’m just a little… disapointed.

Fixed.

This is amazing. I have been looking for something like this for ages. Its now on my server and running :slight_smile:

thank you.

Even though I give darkRP shit I don’t forward it and just bash it, you know why? Because I can’t code a better gamemode and neither can you. Stop saying you hate it so much when you can’t even have some respect for the people the put quite a bit of work into something for the people. Just say you don’t enjoy playing it and move on.

[editline]21st December 2010[/editline]

why is the end thats ending the function in front of the end thats ending the if statement??

[editline]21st December 2010[/editline]

[lua]
//now your gay tabbing is gone!

require(“datastream”)

local CUR = “$”
local DOT = “.”
local savetimer = 10 --save time
local interesttimer = 255 – seconds for bank interest

function bankvalue( ply )
unique_id = sql.QueryValue(“SELECT unique_id FROM player_bank WHERE unique_id = '”…steamID…"’")
bank = sql.QueryValue(“SELECT bank FROM player_bank WHERE unique_id = '”…steamID…"’")
ply:SetNWString(“unique_id”, unique_id)
ply:SetNWInt(“bank”, bank)
end

function Savebank( ply )
bank = ply:GetNWInt(“bank”)
unique_id = ply:GetNWString (“SteamID”)
sql.Query(“UPDATE player_bank SET bank = “…bank…” WHERE unique_id = '”…unique_id…"’")
end

function check_bank()
if (!sql.TableExists(“player_bank”)) then
query = “CREATE TABLE player_bank ( unique_id varchar(255), bank int )”
result = sql.Query(query)
end
end

function new_bank(SteamID, ply)
steamID = SteamID
sql.Query( “INSERT INTO player_bank (unique_id, bank)VALUES (’”…steamID…"’, ‘100’)" )
result = sql.Query( “SELECT unique_id, bank FROM player_bank WHERE unique_id = '”…steamID…"’" )
if (result) then
bankvalue( ply )
end
end

function player_check( ply )
steamID = ply:GetNWString(“SteamID”)
result = sql.Query(“SELECT unique_id, bank FROM player_bank WHERE unique_id = '”…steamID…"’")
if (result) then
bankvalue( ply )
else
new_bank(steamID, ply)
end
end

function Initialize()
check_bank()
end
hook.Add(“Initialize”, “Initialize”, Initialize)

function interest( ply )
Notify(ply, 1, 4, “You got “…CUR…(tonumber(ply:GetNetworkedVar(“bank”))*0.1)…” interest from the bank.”)
ply:AddMoney(tonumber(ply:GetNetworkedVar(“bank”)) * 0.1)
end

function Pspawn( ply )
timer.Create(“Steam_id_delay”, 1, 1, function()
SteamID = ply:SteamID()
ply.seenbank = 0
ply:SetNWString(“SteamID”, SteamID)
timer.Create(“Savebank”, savetimer, 0, function()
Savebank( ply )
end)
timer.Create(ply:UniqueID() … “giefintrest”, interesttimer, 0, function()
intrest( ply )
end)
player_check( ply )
end)
end
hook.Add(“PlayerInitialSpawn”, “Pspawn”, Pspawn)

function pbanks(ply)
if tonumber(ply.seenbank) == 1 then
ply.seenbank = 0
end
end
datastream.Hook(“bankclose”, pbanks)

concommand.Add( “p_1”, function(ply, cmd, args)
if not tonumber(args[1]) then return end
if tonumber(ply.seenbank) == 1 then
if ply.DarkRPVars.money >= tonumber(args[1]) then
ply:AddMoney(-args[1])
ply:SetNWInt(“bank”, ply:GetNetworkedInt( “bank” ) + args[1]);
Notify(ply, 1, 9, "You deposited "…args[1]…CUR…DOT)
Savebank ( ply )
end
end
end)

concommand.Add( “p_2”, function( ply, cmd, args )
if not tonumber(args[1]) then return end
if tonumber(ply.seenbank) == 1 then
if tonumber(ply:GetNetworkedInt( “bank” )) >= tonumber(args[1]) then
ply:AddMoney(args[1])
ply:SetNWInt(“bank”, ply:GetNetworkedInt( “bank” ) - args[1]);
Notify(ply, 1, 9, "You withdrawn "…args[1]…CUR…DOT)
Savebank ( ply )
end
end
end)

function pSetbank(ply, cmd, args)
if not args[1] then return end
if ply:EntIndex() ~= 0 and not ply:IsSuperAdmin() then
return
end
local amount = math.floor(tonumber(args[2]))
if not amount then
if ply:EntIndex() == 0 then
print(string.format(LANGUAGE.invalid_x, “argument”, args[2]))
else
ply:PrintMessage(2, string.format(LANGUAGE.invalid_x, “argument”, args[2]))
end
return
end
local target = FindPlayer(args[1])
if target then
local nick = “”
target:SetNWInt(“bank”, amount)
end
end
concommand.Add(“rp_setbank”, pSetbank)
[/lua]

The Menus and overal UI are “Shotty” at best

shotty?

I will use this, except make it better.

Also do you not understand why shotty means, it doesn’t mean an airsoft gun from AirsoftGI