Currently the developers are putting their own money into JC2-MP to keep the servers online.

Please take a few seconds of your time and disable your AdBlock plugin for our website.

Ad revenue is not going to developers, it is used purely for covering our hosting costs.

 

You are also free to donate, which removes all ads from our website!

Patch 0.3 was just released! Full changelog here: https://t.co/4A50m6IKen

2 years ago

Advertisement
July 16, 2019, 04:14:15 pm

Author Topic: Bank  (Read 8629 times)

Philpax

  • Developer
  • Hero Member
  • *****
  • Posts: 563
    • View Profile
Bank
« on: December 16, 2013, 07:02:58 pm »
Grab the bank script here: https://github.com/Philpax/jc2mp-bank
Extract into a folder called "bank" and drop in scripts/

StuartD

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: Bank
« Reply #1 on: December 16, 2013, 07:06:27 pm »
Awesome, thanks for the release :)

Comfuzio

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Bank
« Reply #2 on: December 16, 2013, 09:01:40 pm »
what do i need to change in order to give to myself money?

Colorful

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Bank
« Reply #3 on: December 16, 2013, 09:10:03 pm »
what do i need to change in order to give to myself money?
Use this nifty little program: http://sourceforge.net/projects/sqlitebrowser/
to edit the database file located in the servers root folder, its called "server.db"
If you want further help i can upload screenshots on how to do it! :D

DennisReynolds

  • Jr. Member
  • **
  • Posts: 54
    • View Profile
Re: Bank
« Reply #4 on: December 16, 2013, 09:15:45 pm »
You can type this in the server console to give everyone on the server whatever amount:

lua bank for p in Server:GetPlayers() do p:SetMoney(1000000) end

Comfuzio

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Bank
« Reply #5 on: December 16, 2013, 09:19:33 pm »
what do i need to change in order to give to myself money?
Use this nifty little program: http://sourceforge.net/projects/sqlitebrowser/
to edit the database file located in the servers root folder, its called "server.db"
If you want further help i can upload screenshots on how to do it! :D

Thanks! It worked like a charm!

Source

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Bank
« Reply #6 on: December 17, 2013, 12:31:41 am »
edit: nvm
« Last Edit: December 17, 2013, 12:36:43 am by Source »

Kitten

  • Donator
  • Newbie
  • *****
  • Posts: 11
    • View Profile
Re: Bank
« Reply #7 on: December 17, 2013, 04:31:04 am »
Great work, looking forward in using this, mind if I edit it a bit?

Hilariousz

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Bank
« Reply #8 on: December 17, 2013, 02:43:46 pm »
Excuse me. Sir Colorful..  please upload screenshots for know how to do it

MedicOnDuty

  • Jr. Member
  • **
  • Posts: 98
    • View Profile
Re: Bank
« Reply #9 on: December 17, 2013, 04:41:45 pm »
Thanks a lot Phil. Will definitely download and install when I have the chance.

PresidentOldSpice

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: Bank
« Reply #10 on: February 28, 2016, 06:48:34 am »
Is there a way to add commas to the bank? (Thousands, Millions, etc.) Currently it's just a straight number. Help would be appreciated.

LordNoob

  • Sr. Member
  • ****
  • Posts: 349
    • View Profile
Re: Bank
« Reply #11 on: February 28, 2016, 06:48:50 pm »
I just Googled it quickly. The Lua wiki has some helpful snippets on this.

Add this to the top of the script (all credit to the Lua Wiki and this Richard Warburton who contributed this):

Code: [Select]
function comma_value(n) -- credit http://richard.warburton.it
local left,num,right = string.match(n,'^([^%d]*%d)(%d*)(.-)$')
return left..(num:reverse():gsub('(%d%d%d)','%1,'):reverse())..right
end

Then change lines 94 and 95 to this:

Code: [Select]
formatted = comma_value(LocalPlayer:GetMoney())
local text = "$" .. formatted