Money

{:links-list}

INSTALLATION

  1. Open the downloaded ZIP product file and drop the folder in it somewhere in your resources folder.
  2. Add your product key (get it here) to the settings.ini file
  3. Add start BigDaddy-Money to your server.cfg.

DO NOT RENAME THE FOLDER.

If you change the name of the folder it will not function correctly so leave the name as it is.

{:is-danger}

CONFIGURATION

REQUIRES MYSQL DATABASE

This resource requires a MySQL database to be setup and for the CreateMoneyTable.sql file to be run within that database to create the table to hold saved money. We will not set your database up for you, that is for your server dev to do.

NOTE

This does NOT require mysql_async or ox_mysql or any other database connector. It uses its own internal connection. It DOES use the connection string in your server.cfg (see guide above). If you have mysql_async or any other mysql connector, that is fine... this WILL still work but you do not need another connector if you don't already have it.

SETTING DEFAULT DESCRIPTION
[licensing]
key1 none This is where you put your product key
[settings]
autoPaycheck false Pay based on cycle time below
paycheckCycle 30 Real world minutes between paychecks
flatPaycheckAmount 1000 Amount paid per paycheck
allowMultiCharacter false Save totals per character (NOT YET IMPLEMENTED)
looseMode true If true, allows players to set their own totals for RP
startingBank 2500 How much money should the player start with in the bank
startingCash 50 How much cash should the player start with
startingDirty 0 How much "Dirty" money should the player start with (NOT YET IMPLEMENTED)
additionalAtmModels none If you have custom ATM models you can add the spawn codes here separated by commas and no spaces
atmIncrement 10 Set to minimum required increment allowed for ATM total entered
atmFee 3.50 Set whatever atm fee you want to charge players using the atm... set to zero for no fee
[callbacks]
updateClient BigDaddy-HUD:UpdateMoney Sends a client event to the person with the money change on any money update. Used by default with BigDaddy-HUD
useLocalDisplay true This displays your totals in the upper right corner if you do not have another hud to display totoals. Z will show totals
local us-en for currency localization - SEE THIS for valid culture settings
[keys] See ValidKeys.txt that came with this resource for a list of keys to use. You must match the keys in that file exactly or the setting won't work
SearchChoose E Key to choose which player receives money during search function
PayGeneric X Key to pay money to nobody (similar to paying the bank in monopoly)
[locales] You have the ability to change most of the on-screen text to whatever language or wording that you want. You can tell what most are by the value they are initially set to in the config file. If you have questions about one, Google Translate or you can ask us.

COMMANDS

COMMAND Arguments INFO
/money none Opens the money menu
/setcash [n] Sets how much cash you have (if loose mode is enabled)
/setbank [n] Sets how much money you have in the bank (if loose mode is enabled)
/paycash [n] [SID] Gives someone cash, if ToServerId is left blank, you will get a visual prompt to pick a person on screen. n = amount, SID = [optional] ServerId of person you are paying.
/paycard [n] [SID] Pay someone with debit/credit card, if ToServerId is left blank, you will get a visual prompt to pick a person on screen. n = amount, SID = [optional] ServerId of person you are paying.
/makeitrain [n] [SID] Gives someone cash with the make it rain animation, if ToServerId is left blank, you will get a visual prompt to pick a person on screen. n = amount, SID = [optional] ServerId of person you are paying.
/paymecash [n] [SID] Request cash payment from another player, if ToServerId is left blank, you will get a visual prompt to pick a person on screen. n = amount, SID = [optional] ServerId of person you are paying.
/paymecard [n] [SID] Request debit/credit payment from another player, if ToServerId is left blank, you will get a visual prompt to pick a person on screen. n = amount, SID = [optional] ServerId of person you are paying.

DEVELOPERS

EXPORTS (SERVER)

EXPORT ARGS RETURN
exports['BigDaddy-Money']:UpdateTotals(player, bank, cash, dirty, cID) player [int], bank [float], cash [float], dirty [float], cID [int] true/false
exports['BigDaddy-Money']:GetAccounts(player, playerSID, cID) player [int], playerSID [int], cID [int] json

player and playerSID are both the server ID of the player.

For now the cID should be set to -1 this is planned to be part of the upcoming framework data.

the json data is as follows:

{
    bank: [float]
  cash: [float]
  dirty: [float] (NOT YET IMPLIMENTED)
}

EXAMPLE

GetBankBalance

function GetBankBalance(serverID)
    local src = source
    local data = exports['BigDaddy-Money']:GetAccounts(src, playerSID, -1.
  local accounts = json.decode(data)
  return accounts.bank
end

PurchaseItem

function PurchaseItem(serverID, ammount)
    local src = source
    local data = exports['BigDaddy-Money']:GetAccounts(src, playerSID, -1.
  local accounts = json.decode(data)
  if accounts.bank >= ammount then
    local newbalance = accounts.bank - ammount
    exports['BigDaddy-Money']:UpdateTotals(src, newbalance, accounts.cash, accounts.dirty, -1.
  end
end

Events

EVENT INFO
BigDaddy-Money:DebitPurchase(amount [float], PayeeServerId [int]) PayeeServerId = -1 for generic payment to no one or to use selector in game
BigDaddy-Money:CashPurchase(amount [float], PayeeServerId [int]) PayeeServerId = -1 for generic payment to no one or to use selector in game
BigDaddy-Money:MakeItRain(amount [float], PayeeServerId [int]) PayeeServerId = -1 for generic payment to no one or to use selector in game

EXAMPLE

To Pay with bank balance to generic:

function PayForThing(amount,player)
    GivePlayerThing(player)
  BigDaddy-Money:DebitPurchase(amount, -1.
end

To Pay with cash to another Player:

function PayForThing(amount,player)
    GivePlayerThing(player)
  BigDaddy-Money:CashPurchase(amount, player)
end