#License violation

1 messages · Page 1 of 1 (latest)

radiant cargo
#

How does somone recieva a inovice?

soft helm
#

/invoice command is there. you can use it to send it to an account and a citizenid (it checks if person is member of that account). then he can pay that at bank or if it's sent to his default account then I will add pay using same menu...for now menu only shows unpaid invoices

#

Also player can send from accounts in which he has sendInvoice permission

radiant cargo
#

thank you

ornate ruin
#

awesome are you creating the ui and funcionalities on the basis of ox_banking 😲

soft helm
young crag
soft helm
# young crag why not take renewed and use ox_bankings ui?

Umm... I didn't thought about that because i was looking for a banking script for new server. Pefcl is no longer maintained, and renewed banking lacks invoice system....
I can create a migrate command which will create a default user account for existing users and then transfer balance from old accounts to new one.

ornate ruin
#

Ox banking is a resource that will continue to be supported for a long time, it's great that you rewrite it and make it open source.

young crag
young crag
#

also im messing with this rn but how would i do things like addAccountMoney or getAccount Money ETC

#

for integration with third party resources

maiden gull
#

Hello everyone, this guy's idea is really impressive... I'm trying to install it but I really don't know how to create my own interactive interface with Ox Banking. Will this resource be available for use on any qbx server?

soft helm
#

In future, yes.

soft helm
# young crag also im messing with this rn but how would i do things like addAccountMoney or g...

https://github.com/Risky-Shot/ox_banking/wiki/Exports#get-character-default-account

Utilise this export to fetch character default account and if account available then use functions from here https://github.com/Risky-Shot/ox_banking/wiki/Account-Object

local account = exports.ox_banking:GetCharacterAccount(citizenid)

if not account then return end

-- available balance
local balance = account:getMeta('balance')

-- add balance
account:addBalance(1000, 'State Welfare')
GitHub

Contribute to Risky-Shot/ox_banking development by creating an account on GitHub.

GitHub

Contribute to Risky-Shot/ox_banking development by creating an account on GitHub.

#

I just saw i have used dot(.) instead of : in wiki. Will fix that

young crag
soft helm
young crag
soft helm
#

You need yo do some additional steps for that mentioned in installation part.

  1. Add hasAccount = true for job/gang which you want a default account
  2. Inside grades, add bankAuth = 'role name'role can be viewer, contributor, manager

Then user will be added automatically to bank and roles will be updated as per grade and job

young crag
#

what about for something like this ```lua
local function pay(player)
local job = player.PlayerData.job
local payment = GetJob(job.name).grades[job.grade.level].payment or job.payment
if payment <= 0 then return end
if not GetJob(job.name).offDutyPay and not job.onduty then return end
if not config.money.paycheckSociety then
config.sendPaycheck(player, payment)
return
end
local account = exports.ox_banking:GetGroupAccount(job.name)
if not account.getMeta(job.name) then -- Checks if player is employed by a society
config.sendPaycheck(player, payment)
return
end
if account < payment then -- Checks if company has enough money to pay society
Notify(player.PlayerData.source, locale('error.company_too_poor'), 'error')
return
end
config.removeSocietyMoney(job.name, payment)
config.sendPaycheck(player, payment)
end

soft helm
#

Will see once available on pc. Probably in an hour

young crag
young crag
#
04:19:01 AM [   script:ox_banking] SelectDefaultAccountId | lspd | {"id":2411045972.0}
04:19:01 AM [     script:qbx_core] SCRIPT ERROR: @qbx_core/server/loops.lua:44: attempt to call a nil value (method 'getMeta')
04:19:01 AM [     script:qbx_core] > pay (@qbx_core/server/loops.lua:44)
04:19:01 AM [     script:qbx_core] > fn (@qbx_core/server/loops.lua:62)
04:19:01 AM [     script:qbx_core] > rawQuery (@oxmysql/dist/build.js:26045)
04:19:01 AM [     script:qbx_core] > processTicksAndRejections (node:internal/process/task_queues:96)

local function pay(player)
    local job = player.PlayerData.job
    local payment = GetJob(job.name).grades[job.grade.level].payment or job.payment
    if payment <= 0 then return end
    if not GetJob(job.name).offDutyPay and not job.onduty then return end

    if not config.money.paycheckSociety then
        config.sendPaycheck(player, payment)
        return
    end

    local societyAccount = exports.ox_banking:GetGroupAccount(job.name)
    if not societyAccount then -- Not a society job
        config.sendPaycheck(player, payment)
        return
    end

    local balance = societyAccount:getMeta('balance')
    if balance < payment then
        Notify(player.PlayerData.source, locale('error.company_too_poor'), 'error')
        return
    end

    local result = societyAccount:removeBalance(payment, 'Paycheck Payment')
    if result.success then
        config.sendPaycheck(player, payment)
    end
end
``` What am i doing wrong?
young crag
#

got that lets go

#

i had to make two exports in the banking a GetAccountMoney and RemoveAccountMoney as i couldnt figure out the proper way

soft helm
soft helm
#

Just pushed exports to repo. Can be found in : server/core/index.lua

toxic dock
#

Nice job! Are you planing to keep updating it with you're features and the main one coming from the original repo?

maiden gull
#

The interface does not open for me, gentlemen. It's not developed yet, right?

soft helm
soft helm
maiden gull
#

I have followed the entire installation, even added the ranks to use the player managed society, but I don't have the knowledge to make the interface (UI) sir.

#

Can't you keep the original UI of Ox Banking, sir?

soft helm
maiden gull
#

I followed the steps, it opens in the browser but it doesn't in the game

soft helm
# maiden gull

i remember getting this error earlier.....
is there any error in serve console ?

daring torrent
#
19:54:53 [   script:ox_banking] SCRIPT ERROR: @ox_banking/server/qbox.lua:88: 
19:54:53 [   script:ox_banking]  An error occurred while calling export `CreateAccount` in resource `ox_banking`:
19:54:53 [   script:ox_banking]   citizen:/scripting/lua/scheduler.lua:749: SCRIPT ERROR: @ox_banking/server/core/db.lua:205: 
19:54:53 [   script:ox_banking]    An error occurred while calling export `GetOfflinePlayer` in resource `qbx_core`:
19:54:53 [   script:ox_banking]     citizen:/scripting/lua/scheduler.lua:749: SCRIPT ERROR: @qbx_core/server/storage/players.lua:115: attempt to index a nil value (local 'player')
19:54:53 [   script:ox_banking]     > fetchPlayerEntity (@qbx_core/server/storage/players.lua:115)
19:54:53 [   script:ox_banking]     > ref (@qbx_core/server/player.lua:57)
19:54:53 [   script:ox_banking]     > rawQuery (@oxmysql/dist/build.js:27077)
19:54:53 [   script:ox_banking]     > processTicksAndRejections (node:internal/process/task_queues:96)
19:54:53 [   script:ox_banking]   
19:54:53 [   script:ox_banking]  ---
19:54:53 [   script:ox_banking]   > CreateNewAccount (@ox_banking/server/core/db.lua:205)
19:54:53 [   script:ox_banking]   > ref (@ox_banking/server/core/index.lua:20)
19:54:53 [   script:ox_banking]   > rawQuery (@oxmysql/dist/build.js:27077)
19:54:53 [   script:ox_banking]   > processTicksAndRejections (node:internal/process/task_queues:96)
19:54:53 [   script:ox_banking] 
19:54:53 [   script:ox_banking]  ---
19:54:53 [   script:ox_banking] > fn (@ox_banking/server/qbox.lua:88)
19:54:53 [   script:ox_banking] > rawQuery (@oxmysql/dist/build.js:27077)
19:54:53 [   script:ox_banking] > processTicksAndRejections (node:internal/process/task_queues:96)

did i miss something in the installation?
i did all the steps

wild kettle
#

I get this error in my server console[ script:oxmysql] Error: grp-banking was unable to complete a transaction! [ script:oxmysql] INSERT INTO ox_group_grades (`group`, `grade`, `label`, `accountRole`) [ script:oxmysql] VALUES ('cardealer', '4', 'Manager', true) [ script:oxmysql] ON DUPLICATE KEY UPDATE [ script:oxmysql] `group` = VALUES(`group`), [ script:oxmysql] `grade` = VALUES(`grade`), [ script:oxmysql] `label` = VALUES(`label`), [ script:oxmysql] `accountRole` = VALUES(`accountRole`) [ script:oxmysql] [ script:oxmysql] Cannot add or update a child row: a foreign key constraint fails (`s59362_qbox123`.`ox_group_grades`, CONSTRAINT `FK_ox_group_grades_account_roles` FOREIGN KEY (`accountRole`) REFERENCES `account_roles` (`name`) ON DELETE CASCADE ON UPDATE CASCADE)

#

sorry i renamed the script haha

soft helm
#

you missed 1 part related to grades and permission setup...

You have to change bankAuth = 'rolename' inside shared data

#

valid role names are these : 'viewer' | 'contributor' | 'manager' | 'owner'

wild kettle
#

oh i didnt put it inside the ' '

daring torrent
wild kettle
#

I have this issue now:

[   script:ox-banking] > rawQuery (@oxmysql/dist/build.js:26045)
[   script:ox-banking] > processTicksAndRejections (node:internal/process/task_queues:96)```
muted narwhal
#
lib.callback.register('qbx_core:server:createCharacter', function(source, data)
    local newData = {}
    newData.charinfo = data

    local success = Login(source, nil, newData)
    if not success then return end

    giveStarterItems(source)

    if GetResourceState('qbx_spawn') == 'missing' then
        SetPlayerBucket(source, 0)
    end

    local player = exports.qbx_core:GetPlayer(source)

    if not player then return end

    local citizenid = player.PlayerData.citizenid

    local newAccount = exports.ox_banking:CreateAccount(citizenid, "Personal", true)

    if not newAccount then 
        lib.print.info('Failed to Create Bank Account. Please contact staff to fix this issue.')
        return
    end

    local account = exports.ox_banking:GetCharacterAccount(citizenid).accountId


    exports.ox_banking:AddBalance(account, config.money.moneyTypes.bank, "State Welfare")

    lib.print.info(('%s has created a character'):format(GetPlayerName(source)))
    return newData
end)```
#

i managed to get the starting money to work

soft helm
wild kettle
soft helm
#

exports.ox_banking: remove this from qbox.lua line 88

Should just be function call

muted narwhal
#

so far

soft helm
#

ok...will see that

muted narwhal
#
sendPaycheck = function (player, payment)
        local account = exports.ox_banking:GetCharacterAccount(player.PlayerData.citizenid).accountId

        exports.ox_banking:AddBalance(account, payment, 'Paycheck')

        Notify(player.PlayerData.source, locale('info.received_paycheck', payment))
    end,```
#

also this is what ive done for paychecks

#

idk if i shouldve added some checks or sum but as is it works good

muted narwhal
# maiden gull

i experinced this issue when i didnt make a fresh character when i first installed or if i didnt even have an account with the bank

soft helm
soft helm
toxic dock
#

quick question, shouldn't this table inside players be connected to the default personal account?

this will make a lot of scripts compatible from the start with ox_banking

#

or it is already? i didn't check the script fully yet

toxic dock
#
    function self.Functions.GetMoney(moneytype)
        if not moneytype then return false end
        if moneytype == "bank" then
            local account = exports.ox_banking:GetCharacterAccount(self.PlayerData.citizenid)
            if account then
                return exports.ox_banking:GetMetadata(account.accountId, 'balance')
            end
        end
        return self.PlayerData.money[moneytype]
    end

then for removemoney/setmoney/addmoney i added similiar checks

like this

        if moneytype == "bank" then
            local account = exports.ox_banking:GetCharacterAccount(self.PlayerData.citizenid)
            if account then
                local accountID = account.accountId
                print('Money Removed from Bank' .. amount .. ' for ' .. self.PlayerData.citizenid .. ' with accountID: ' .. accountID)
                exports.ox_banking:RemoveBalance(accountID, amount, "US Government")
            end
        end
#

for setmoney i just remove currentbalance then add the new value, if you have a better approach for this, tell me ^^

wild kettle
soft helm
#

Yeah, just keep it as
CreateAccount(groupName, groupData.label, true)

wild kettle
#

alright i will try that

wild kettle
#

i get this when trying to press E at an atm or inside a bank

soft helm
toxic dock
#

Yeah i understand, i already heavily modified it for my needs so one new change doesnt bother me

soft helm
hushed brook
#

a 'rewrite' of ox_banking to qbox should not be done this way, it is horrible and will become outdated quickly.

If someone actually wants to make a half decent qbox compatable ox_banking. A good start would actually be forking it (so users aren't stuck with a out of date ox_banking) and not rewriting it into lua (pointless to do and will require more work in the future as ox_banking gets expanded)

Also this violates the original licensing of ox_banking.