🔌Installation & Usage

  • Run the SQL on your database

  • Add the job (if you'd like) to your core shared jobs

  • Edit server functions in sv_edit.lua

  • Edit the config

Offline Autodraft Fees SQL

QB / QBX

MySQL.scalar('SELECT `money` FROM `players` WHERE `citizenid` = ? LIMIT 1', {
    owner
}, function(money)
    local moneyInfo = json.decode(money)
    local newBank = (moneyInfo.bank - payment)
    local newInfo = {}
    for moneyType, moneyAmount in pairs(moneyInfo) do
        if moneyType ~= 'bank' then
            newInfo[moneyType] = moneyAmount
        else
            newInfo['bank'] = newBank
        end
    end
    newInfo = json.encode(newInfo)

    MySQL.update('UPDATE `players` SET `money` = ? WHERE `citizenid` = ?', {
        newInfo, owner
    }, function(affectedRows)
        print(('Storage Fees Due: %s | Offline Owner: %s | Paid: %s | Old Balance: $%s | New Balance: $%s'):format(lockerID, owner, payment, moneyInfo.bank, newBank))

        MySQL.update.await('UPDATE `storagelockers` SET `lastpayment` = ?, `nextpayment` = ? WHERE `id` = ?', { currentDate, nextPayment, lockerID })
    end)
end)

ND_Core

MySQL.scalar('SELECT `bank` FROM `nd_characters` WHERE `charid` = ? LIMIT 1', {
    owner
}, function(bankAmount)
    local newBank = (bankAmount - payment)

    MySQL.update('UPDATE `nd_characters` SET `bank` = ? WHERE `charid` = ?', {
        newBank, owner
    }, function(affectedRows)
        print(('Storage Fees Due: %s | Offline Owner: %s | Paid: %s | Old Balance: $%s | New Balance: $%s'):format(lockerID, owner, payment, bankAmount, newBank))

        MySQL.update.await('UPDATE `storagelockers` SET `lastpayment` = ?, `nextpayment` = ? WHERE `id` = ?', { currentDate, nextPayment, lockerID })
    end)
end)

ESX

MySQL.scalar('SELECT `accounts` FROM `users` WHERE `identifer` = ? LIMIT 1', {
    owner
}, function(money)
    local moneyInfo = json.decode(money)
    local newBank = (moneyInfo.bank - payment)
    local newInfo = {}
    for moneyType, moneyAmount in pairs(moneyInfo) do
        if moneyType ~= 'bank' then
            newInfo[moneyType] = moneyAmount
        else
            newInfo['bank'] = newBank
        end
    end
    newInfo = json.encode(newInfo)

    MySQL.update('UPDATE `users` SET `accounts` = ? WHERE `identifer` = ?', {
        newInfo, owner
    }, function(affectedRows)
        print(('Storage Fees Due: %s | Offline Owner: %s | Paid: %s | Old Balance: $%s | New Balance: $%s'):format(lockerID, owner, payment, moneyInfo.bank, newBank))

        MySQL.update.await('UPDATE `storagelockers` SET `lastpayment` = ?, `nextpayment` = ? WHERE `id` = ?', { currentDate, nextPayment, lockerID })
    end)
end)

Last updated