Part 3
This commit is contained in:
parent
9a7bcfa270
commit
05467895cf
87
resources/[renewed]/Renewed-Banking/README.md
Normal file
87
resources/[renewed]/Renewed-Banking/README.md
Normal file
@ -0,0 +1,87 @@
|
||||
# Renewed-Banking
|
||||
<a href='https://ko-fi.com/ushifty' target='_blank'><img height='35' style='border:0px;height:46px;' src='https://az743702.vo.msecnd.net/cdn/kofi3.png?v=0' border='0' alt='Buy Me a Coffee at ko-fi.com' />
|
||||
|
||||
[Renewed Discord](https://discord.gg/P3RMrbwA8n)
|
||||
|
||||
# Project Description
|
||||
This resource was created by myself and was not a fork of any of the other banking resources. So lets not say "Isnt this x banking 🤓" because its not. The user interface was heavily inspired by No Pixels Banking Interface.
|
||||
This resource is a replacement for qb-banking, qb-atm, qb-managment
|
||||
|
||||
# Dependencies
|
||||
* [oxmysql](https://github.com/overextended/oxmysql)
|
||||
* [QBCore](https://github.com/qbcore-framework/qb-core)
|
||||
* [QB-Target](https://github.com/qbcore-framework/qb-target)
|
||||
* [QB-Menu](https://github.com/qbcore-framework/qb-menu)
|
||||
* [QB-Input](https://github.com/qbcore-framework/qb-input)
|
||||
* [progressbars](https://github.com/Project-Sloth/progressbar)
|
||||
|
||||
# Features
|
||||
* Personal, Job, Gang, Shared Accounts
|
||||
* Withdraw, Deposit, Transfer between accounts
|
||||
* Offline Player Full Support
|
||||
* QB Target Support
|
||||
* Optimized Resource (0.00ms Running At All Times)
|
||||
|
||||
# Installation
|
||||
|
||||
1) Insert the SQL provided
|
||||
|
||||
2) Edit your QBCore/Shared/jobs.lua and add `bankAuth = true` to the job grades which have access to society funds
|
||||
|
||||
## Transaction Integrations
|
||||
|
||||
```lua
|
||||
exports['Renewed-Banking']:handleTransaction(account, title, amount, message, issuer, receiver, type, transID)
|
||||
---@param account<string> - job name or citizenid
|
||||
---@param title<string> - Title of transaction example `Personal Account / ${Player.PlayerData.citizenid}`
|
||||
---@param amount<number> - Amount of money being transacted
|
||||
---@param message<string> - Description of transaction
|
||||
---@param issuer<string> - Name of Business or Character issuing the bill
|
||||
---@param receiver<string> - Name of Business or Character receiving the bill
|
||||
---@param type<string> - deposit | withdraw
|
||||
---@param transID<string> - (optional) Force a specific transaction ID instead of generating one.
|
||||
|
||||
---@return transaction<table> {
|
||||
---@param trans_id<string> - Transaction ID for the created transaction
|
||||
---@param amount<number> - Amount of money being transacted
|
||||
---@param trans_type<string> - deposit | withdraw
|
||||
---@param receiver<string> - Name of Business or Character receiving the bill
|
||||
---@param message<string> - Description of transaction
|
||||
---@param issuer<string> - Name of Business or Character issuing the bill
|
||||
---@param time<number> - Epoch timestamp of transaction
|
||||
---}
|
||||
|
||||
|
||||
exports['Renewed-Banking']:getAccountMoney(account)
|
||||
---@param account<string> - Job Name | Custom Account Name
|
||||
|
||||
---@return amount<number> - Amount of money account has or false
|
||||
|
||||
exports['Renewed-Banking']:addAccountMoney(account, amount)
|
||||
---@param account<string> - Job Name | Custom Account Name
|
||||
---@param amount<number> - Amount of money being transacted
|
||||
|
||||
---@return complete<boolean> - true | false
|
||||
|
||||
exports['Renewed-Banking']:removeAccountMoney(account, amount)
|
||||
---@param account<string> - Job Name | Custom Account Name
|
||||
---@param amount<number> - Amount of money being transacted
|
||||
|
||||
---@return complete<boolean> - true | false
|
||||
```
|
||||
|
||||
## qb-managment conversion
|
||||
```lua
|
||||
exports['qb-management']:GetAccount => exports['Renewed-Banking']:getAccountMoney
|
||||
exports['qb-management']:AddMoney => exports['Renewed-Banking']:addAccountMoney
|
||||
exports['qb-management']:RemoveMoney => exports['Renewed-Banking']:removeAccountMoney
|
||||
exports['qb-management']:GetGangAccount=> exports['Renewed-Banking']:getAccountMoney
|
||||
exports['qb-management']:AddGangMoney=> exports['Renewed-Banking']:addAccountMoney
|
||||
exports['qb-management']:RemoveGangMoney=> exports['Renewed-Banking']:removeAccountMoney
|
||||
```
|
||||
|
||||
## Change Logs
|
||||
V1.0.1
|
||||
```
|
||||
Added Banking Blips
|
||||
```
|
29
resources/[renewed]/Renewed-Banking/Renewed-Banking.sql
Normal file
29
resources/[renewed]/Renewed-Banking/Renewed-Banking.sql
Normal file
@ -0,0 +1,29 @@
|
||||
CREATE TABLE IF NOT EXISTS `bank_accounts_new` (
|
||||
`id` varchar(50) NOT NULL,
|
||||
`amount` int(11) DEFAULT 0,
|
||||
`transactions` longtext DEFAULT '[]',
|
||||
`auth` longtext DEFAULT '[]',
|
||||
`isFrozen` int(11) DEFAULT 0,
|
||||
`creator` varchar(50) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
);
|
||||
|
||||
INSERT INTO `bank_accounts_new` (`id`, `amount`, `transactions`, `auth`, `isFrozen`, `creator`) VALUES
|
||||
('ambulance', 0, '[]', '[]', 0, NULL),
|
||||
('cardealer', 0, '[]', '[]', 0, NULL),
|
||||
('mechanic', 0, '[]', '[]', 0, NULL),
|
||||
('police', 0, '[]', '[]', 0, NULL),
|
||||
('realestate', 0, '[]', '[]', 0, NULL),
|
||||
('lostmc', 0, '[]', '[]', 0, NULL),
|
||||
('ballas', 0, '[]', '[]', 0, NULL),
|
||||
('vagos', 0, '[]', '[]', 0, NULL),
|
||||
('cartel', 0, '[]', '[]', 0, NULL),
|
||||
('families', 0, '[]', '[]', 0, NULL),
|
||||
('triads', 0, '[]', '[]', 0, NULL);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `player_transactions` (
|
||||
`id` varchar(50) NOT NULL,
|
||||
`isFrozen` int(11) DEFAULT 0,
|
||||
`transactions` longtext DEFAULT '[]',
|
||||
PRIMARY KEY (`id`)
|
||||
);
|
631
resources/[renewed]/Renewed-Banking/client/main.lua
Normal file
631
resources/[renewed]/Renewed-Banking/client/main.lua
Normal file
@ -0,0 +1,631 @@
|
||||
local QBCore = exports['qb-core']:GetCoreObject()
|
||||
local isVisible = false
|
||||
|
||||
local FullyLoaded = LocalPlayer.state.isLoggedIn
|
||||
|
||||
AddStateBagChangeHandler('isLoggedIn', nil, function(_, _, value)
|
||||
FullyLoaded = value
|
||||
end)
|
||||
|
||||
local function nuiHandler(val)
|
||||
isVisible = val
|
||||
SetNuiFocus(val, val)
|
||||
end
|
||||
|
||||
local function openBankUI(isAtm)
|
||||
SendNUIMessage({action = "setLoading", status = true})
|
||||
nuiHandler(true)
|
||||
QBCore.Functions.TriggerCallback('renewed-banking:server:initalizeBanking', function(result)
|
||||
if not result then
|
||||
nuiHandler(false)
|
||||
QBCore.Functions.Notify(Lang:t("notify.loading_failed"), 'error', 7500)
|
||||
return
|
||||
end
|
||||
SetTimeout(1000, function()
|
||||
SendNUIMessage({
|
||||
action = "setVisible",
|
||||
status = isVisible,
|
||||
accounts = result,
|
||||
loading = false,
|
||||
atm = isAtm
|
||||
})
|
||||
end)
|
||||
end)
|
||||
end
|
||||
|
||||
RegisterNetEvent("Renewed-Banking:client:openBankUI", function(data)
|
||||
local txt = data.atm and 'Åbner ATM' or 'Åbner bank'
|
||||
TaskStartScenarioInPlace(PlayerPedId(), "PROP_HUMAN_ATM", 0, 1)
|
||||
QBCore.Functions.Progressbar('Renewed-Banking', txt, math.random(1000,3000), false, true, {
|
||||
disableMovement = true,
|
||||
disableCarMovement = true,
|
||||
disableMouse = false,
|
||||
disableCombat = true,
|
||||
}, {}, {}, {}, function()
|
||||
openBankUI(data.atm)
|
||||
Wait(500)
|
||||
ClearPedTasksImmediately(PlayerPedId())
|
||||
end, function()
|
||||
ClearPedTasksImmediately(PlayerPedId())
|
||||
QBCore.Functions.Notify('Cancelled...', 'error', 7500)
|
||||
end)
|
||||
end)
|
||||
|
||||
RegisterNUICallback("closeInterface", function(_, cb)
|
||||
nuiHandler(false)
|
||||
cb("ok")
|
||||
end)
|
||||
|
||||
RegisterCommand("closeBankUI", function() nuiHandler(false) end)
|
||||
|
||||
local bankActions = {"deposit", "withdraw", "transfer"}
|
||||
CreateThread(function ()
|
||||
for k=1, #bankActions do
|
||||
RegisterNUICallback(bankActions[k], function(data, cb)
|
||||
local pushingP = promise.new()
|
||||
QBCore.Functions.TriggerCallback("Renewed-Banking:server:"..bankActions[k], function(result)
|
||||
pushingP:resolve(result)
|
||||
end, data)
|
||||
local newTransaction = Citizen.Await(pushingP)
|
||||
cb(newTransaction)
|
||||
end)
|
||||
end
|
||||
if lib then
|
||||
exports.ox_target:addModel(config.atms, {{
|
||||
name = 'renewed_banking_openui',
|
||||
event = 'Renewed-Banking:client:openBankUI',
|
||||
icon = 'fas fa-money-check',
|
||||
label = Lang:t("menu.view_bank"),
|
||||
atm = true,
|
||||
canInteract = function(_, distance)
|
||||
return distance < 2.5
|
||||
end
|
||||
}})
|
||||
return
|
||||
end
|
||||
exports['qb-target']:AddTargetModel(config.atms,{
|
||||
options = {{
|
||||
type = "client",
|
||||
event = "Renewed-Banking:client:openBankUI",
|
||||
icon = "fas fa-money-check",
|
||||
label = Lang:t("menu.view_bank"),
|
||||
atm = true
|
||||
}},
|
||||
distance = 2.5
|
||||
})
|
||||
|
||||
end)
|
||||
|
||||
local pedSpawned = false
|
||||
local peds = {basic = {}, adv ={}}
|
||||
local blips = {}
|
||||
local function createPeds()
|
||||
if pedSpawned then return end
|
||||
for k=1, #config.peds do
|
||||
local model = joaat(config.peds[k].model)
|
||||
|
||||
RequestModel(model)
|
||||
while not HasModelLoaded(model) do Wait(0) end
|
||||
|
||||
local coords = config.peds[k].coords
|
||||
local bankPed = CreatePed(0, model, coords.x, coords.y, coords.z-1, coords.w, false, false)
|
||||
|
||||
TaskStartScenarioInPlace(bankPed, 'PROP_HUMAN_STAND_IMPATIENT', 0, true)
|
||||
FreezeEntityPosition(bankPed, true)
|
||||
SetEntityInvincible(bankPed, true)
|
||||
SetBlockingOfNonTemporaryEvents(bankPed, true)
|
||||
table.insert(config.peds[k].createAccounts and peds.adv or peds.basic, bankPed)
|
||||
|
||||
blips[k] = AddBlipForCoord(coords.x, coords.y, coords.z-1)
|
||||
SetBlipSprite(blips[k], 108)
|
||||
SetBlipDisplay(blips[k], 4)
|
||||
SetBlipScale (blips[k], 0.80)
|
||||
SetBlipColour (blips[k], 2)
|
||||
SetBlipAsShortRange(blips[k], true)
|
||||
BeginTextCommandSetBlipName("STRING")
|
||||
AddTextComponentString("Bank")
|
||||
EndTextCommandSetBlipName(blips[k])
|
||||
end
|
||||
if lib then
|
||||
local targetOpts ={{
|
||||
name = 'renewed_banking_openui',
|
||||
event = 'Renewed-Banking:client:openBankUI',
|
||||
icon = 'fas fa-money-check',
|
||||
label = Lang:t("menu.view_bank"),
|
||||
atm = false,
|
||||
canInteract = function(_, distance)
|
||||
return distance < 4.5
|
||||
end
|
||||
}}
|
||||
exports.ox_target:addLocalEntity(peds.basic, targetOpts)
|
||||
targetOpts[#targetOpts+1]={
|
||||
name = 'renewed_banking_accountmng',
|
||||
event = 'Renewed-Banking:client:accountManagmentMenu',
|
||||
icon = 'fas fa-money-check',
|
||||
label = Lang:t("menu.manage_bank"),
|
||||
atm = false,
|
||||
canInteract = function(_, distance)
|
||||
return distance < 4.5
|
||||
end
|
||||
}
|
||||
exports.ox_target:addLocalEntity(peds.adv, targetOpts)
|
||||
else
|
||||
exports['qb-target']:AddTargetEntity(peds.basic, {
|
||||
options = {
|
||||
{
|
||||
type = "client",
|
||||
event = "Renewed-Banking:client:openBankUI",
|
||||
icon = "fas fa-money-check",
|
||||
label = Lang:t("menu.view_bank"),
|
||||
atm = false
|
||||
}
|
||||
},
|
||||
distance = 4.0
|
||||
})
|
||||
exports['qb-target']:AddTargetEntity(peds.adv, {
|
||||
options = {
|
||||
{
|
||||
type = "client",
|
||||
event = "Renewed-Banking:client:openBankUI",
|
||||
icon = "fas fa-money-check",
|
||||
label = Lang:t("menu.view_bank"),
|
||||
atm = false
|
||||
},
|
||||
{
|
||||
type = "client",
|
||||
event = "Renewed-Banking:client:accountManagmentMenu",
|
||||
icon = "fas fa-money-check",
|
||||
label = Lang:t("menu.manage_bank")
|
||||
}
|
||||
},
|
||||
distance = 4.0
|
||||
})
|
||||
end
|
||||
pedSpawned = true
|
||||
end
|
||||
|
||||
local function deletePeds()
|
||||
if not pedSpawned then return end
|
||||
local k=1
|
||||
for x,v in pairs(peds)do
|
||||
for i=1, #v do
|
||||
DeletePed(v[i])
|
||||
RemoveBlip(blips[k])
|
||||
k += 1
|
||||
end
|
||||
peds[x] = {}
|
||||
end
|
||||
end
|
||||
|
||||
RegisterNetEvent('QBCore:Client:OnPlayerLoaded', function()
|
||||
Wait(100)
|
||||
createPeds()
|
||||
SendNUIMessage({
|
||||
action = "updateLocale",
|
||||
translations = Translations.ui,
|
||||
})
|
||||
end)
|
||||
|
||||
RegisterNetEvent('QBCore:Client:OnPlayerUnload', function()
|
||||
deletePeds()
|
||||
end)
|
||||
|
||||
AddEventHandler('onResourceStop', function(resource)
|
||||
if resource ~= GetCurrentResourceName() then return end
|
||||
if lib then
|
||||
exports.ox_target:removeModel(config.atms, {'renewed_banking_openui'})
|
||||
exports.ox_target:removeEntity(peds.basic, {'renewed_banking_openui'})
|
||||
exports.ox_target:removeEntity(peds.adv, {'renewed_banking_openui','renewed_banking_accountmng'})
|
||||
else
|
||||
exports['qb-target']:RemoveTargetModel(config.atms, Lang:t("menu.view_bank"))
|
||||
exports['qb-target']:RemoveTargetEntity(peds.basic, Lang:t("menu.view_bank"))
|
||||
exports['qb-target']:RemoveTargetEntity(peds.adv, {Lang:t("menu.view_bank"), Lang:t("menu.manage_bank")})
|
||||
end
|
||||
deletePeds()
|
||||
end)
|
||||
|
||||
AddEventHandler('onResourceStart', function(resource)
|
||||
if resource ~= GetCurrentResourceName() then return end
|
||||
if not FullyLoaded then return end
|
||||
Wait(100)
|
||||
createPeds()
|
||||
SendNUIMessage({
|
||||
action = "updateLocale",
|
||||
translations = Translations.ui,
|
||||
})
|
||||
|
||||
end)
|
||||
|
||||
RegisterNetEvent("Renewed-Banking:client:sendNotification", function(msg)
|
||||
if not msg then return end
|
||||
SendNUIMessage({
|
||||
action = "notify",
|
||||
status = msg,
|
||||
})
|
||||
end)
|
||||
|
||||
RegisterNetEvent('Renewed-Banking:client:viewAccountsMenu', function()
|
||||
TriggerServerEvent("Renewed-Banking:server:getPlayerAccounts")
|
||||
end)
|
||||
|
||||
local bankingMenus = {
|
||||
[1] = {
|
||||
event = "Renewed-Banking:client:accountManagmentMenu",
|
||||
menu = function()
|
||||
local table = {
|
||||
{
|
||||
isMenuHeader = true,
|
||||
header = Lang:t("menu.bank_name")
|
||||
},
|
||||
{
|
||||
header = Lang:t("menu.create_account"),
|
||||
icon = 'file-invoice-dollar',
|
||||
txt = Lang:t("menu.create_account_txt"),
|
||||
params = {
|
||||
event = 'Renewed-Banking:client:createAccountMenu'
|
||||
}
|
||||
},
|
||||
{
|
||||
header = Lang:t("menu.manage_account"),
|
||||
icon = 'users-gear',
|
||||
txt = Lang:t("menu.manage_account_txt"),
|
||||
params = {
|
||||
event = 'Renewed-Banking:client:viewAccountsMenu'
|
||||
}
|
||||
}
|
||||
}
|
||||
exports["qb-menu"]:openMenu(table)
|
||||
end,
|
||||
lib = function()
|
||||
lib.registerContext({
|
||||
id = 'renewed_banking_account_management',
|
||||
title = Lang:t("menu.bank_name"),
|
||||
position = 'top-right',
|
||||
options = {
|
||||
{
|
||||
title = Lang:t("menu.create_account"),
|
||||
icon = 'file-invoice-dollar',
|
||||
metadata = {Lang:t("menu.create_account_txt")},
|
||||
event = "Renewed-Banking:client:createAccountMenu"
|
||||
},
|
||||
{
|
||||
title = Lang:t("menu.manage_account"),
|
||||
icon = 'users-gear',
|
||||
metadata = {Lang:t("menu.manage_account_txt")},
|
||||
event = 'Renewed-Banking:client:viewAccountsMenu'
|
||||
}
|
||||
}
|
||||
})
|
||||
lib.showContext("renewed_banking_account_management")
|
||||
end
|
||||
},
|
||||
[2] = {
|
||||
event = "Renewed-Banking:client:createAccountMenu",
|
||||
menu = function()
|
||||
local dialog = exports["qb-input"]:ShowInput({
|
||||
header = Lang:t("menu.bank_name"),
|
||||
submitText = Lang:t("menu.create_account"),
|
||||
inputs = {
|
||||
{
|
||||
text = Lang:t("menu.account_id"),
|
||||
name = "accountid",
|
||||
type = "text",
|
||||
isRequired = true
|
||||
}
|
||||
}
|
||||
})
|
||||
if dialog and dialog.accountid then
|
||||
dialog.accountid = dialog.accountid:lower():gsub("%s+", "")
|
||||
TriggerServerEvent("Renewed-Banking:server:createNewAccount", dialog.accountid)
|
||||
end
|
||||
end,
|
||||
lib = function()
|
||||
local input = lib.inputDialog(Lang:t("menu.bank_name"), {{
|
||||
type = "input",
|
||||
label = Lang:t("menu.account_id"),
|
||||
placeholder = "a_test_account"
|
||||
}})
|
||||
if input and input[1] then
|
||||
input[1] = input[1]:lower():gsub("%s+", "")
|
||||
TriggerServerEvent("Renewed-Banking:server:createNewAccount", input[1])
|
||||
end
|
||||
end
|
||||
},
|
||||
[3] = {
|
||||
event = "Renewed-Banking:client:accountsMenu",
|
||||
menu = function(data)
|
||||
local table = {{
|
||||
isMenuHeader = true,
|
||||
header = Lang:t("menu.bank_name")
|
||||
}}
|
||||
if #data >= 1 then
|
||||
for k=1, #data do
|
||||
table[#table+1] = {
|
||||
header = data[k],
|
||||
icon = 'users-gear',
|
||||
txt = Lang:t("menu.view_members"),
|
||||
params = {
|
||||
event = 'Renewed-Banking:client:accountsMenuView',
|
||||
args = {
|
||||
account = data[k],
|
||||
}
|
||||
}
|
||||
}
|
||||
end
|
||||
else
|
||||
table[#table+1] = {
|
||||
header = Lang:t("menu.no_account"),
|
||||
icon = 'users-gear',
|
||||
txt = Lang:t("menu.no_account_txt"),
|
||||
isMenuHeader = true
|
||||
}
|
||||
end
|
||||
exports["qb-menu"]:openMenu(table)
|
||||
end,
|
||||
lib = function(data)
|
||||
local menuOpts = {}
|
||||
if #data >= 1 then
|
||||
for k=1, #data do
|
||||
menuOpts[#menuOpts+1] = {
|
||||
title = data[k],
|
||||
icon = 'users-gear',
|
||||
metadata = {Lang:t("menu.view_members")},
|
||||
event = "Renewed-Banking:client:accountsMenuView",
|
||||
args = {
|
||||
account = data[k],
|
||||
}
|
||||
}
|
||||
end
|
||||
else
|
||||
menuOpts[#menuOpts+1] = {
|
||||
title = Lang:t("menu.no_account"),
|
||||
icon = 'users-gear',
|
||||
metadata = {Lang:t("menu.no_account_txt")},
|
||||
}
|
||||
end
|
||||
lib.registerContext({
|
||||
id = 'renewed_banking_account_list',
|
||||
title = Lang:t("menu.bank_name"),
|
||||
position = 'top-right',
|
||||
menu = "renewed_banking_account_management",
|
||||
options = menuOpts
|
||||
})
|
||||
lib.showContext("renewed_banking_account_list")
|
||||
end
|
||||
},
|
||||
[4] = {
|
||||
event = "Renewed-Banking:client:accountsMenuView",
|
||||
menu = function(data)
|
||||
local table = {
|
||||
{
|
||||
isMenuHeader = true,
|
||||
header = Lang:t("menu.bank_name")
|
||||
},
|
||||
{
|
||||
header = Lang:t("menu.manage_members"),
|
||||
icon = 'users-gear',
|
||||
txt = Lang:t("menu.manage_members_txt"),
|
||||
params = {
|
||||
isServer =true,
|
||||
event = 'Renewed-Banking:server:viewMemberManagement',
|
||||
args = data
|
||||
}
|
||||
},
|
||||
{
|
||||
header = Lang:t("menu.edit_acc_name"),
|
||||
icon = 'users-gear',
|
||||
txt = Lang:t("menu.edit_acc_name_txt"),
|
||||
params = {
|
||||
event = 'Renewed-Banking:client:changeAccountName',
|
||||
args = data
|
||||
}
|
||||
}
|
||||
}
|
||||
exports["qb-menu"]:openMenu(table)
|
||||
end,
|
||||
lib = function(data)
|
||||
lib.registerContext({
|
||||
id = 'renewed_banking_account_view',
|
||||
title = Lang:t("menu.bank_name"),
|
||||
position = 'top-right',
|
||||
menu = "renewed_banking_account_list",
|
||||
options = {
|
||||
{
|
||||
title = Lang:t("menu.manage_members"),
|
||||
icon = 'users-gear',
|
||||
metadata = {Lang:t("menu.manage_members_txt")},
|
||||
serverEvent = "Renewed-Banking:server:viewMemberManagement",
|
||||
args = data
|
||||
},
|
||||
{
|
||||
title = Lang:t("menu.edit_acc_name"),
|
||||
icon = 'users-gear',
|
||||
metadata = {Lang:t("menu.edit_acc_name_txt")},
|
||||
event = "Renewed-Banking:client:changeAccountName",
|
||||
args = data
|
||||
}
|
||||
}
|
||||
})
|
||||
lib.showContext("renewed_banking_account_view")
|
||||
end
|
||||
},
|
||||
[5] = {
|
||||
event = "Renewed-Banking:client:viewMemberManagement",
|
||||
menu = function(data)
|
||||
local table = {{
|
||||
isMenuHeader = true,
|
||||
header = Lang:t("menu.bank_name")
|
||||
}}
|
||||
local account = data.account
|
||||
for k,v in pairs(data.members) do
|
||||
table[#table+1] = {
|
||||
header = v,
|
||||
txt = Lang:t("menu.remove_member_txt"),
|
||||
params = {
|
||||
event = 'Renewed-Banking:client:removeMemberConfirmation',
|
||||
args = {
|
||||
account = account,
|
||||
cid = k,
|
||||
}
|
||||
}
|
||||
}
|
||||
end
|
||||
table[#table+1] = {
|
||||
header = Lang:t("menu.add_member"),
|
||||
txt = Lang:t("menu.add_member_txt"),
|
||||
params = {
|
||||
event = 'Renewed-Banking:client:addAccountMember',
|
||||
args = {
|
||||
account = account
|
||||
}
|
||||
}
|
||||
}
|
||||
exports["qb-menu"]:openMenu(table)
|
||||
end,
|
||||
lib = function(data)
|
||||
local menuOpts = {}
|
||||
local account = data.account
|
||||
for k,v in pairs(data.members) do
|
||||
menuOpts[#menuOpts+1] = {
|
||||
title = v,
|
||||
metadata = {Lang:t("menu.remove_member_txt")},
|
||||
event = 'Renewed-Banking:client:removeMemberConfirmation',
|
||||
args = {
|
||||
account = account,
|
||||
cid = k,
|
||||
}
|
||||
}
|
||||
end
|
||||
menuOpts[#menuOpts+1] = {
|
||||
title = Lang:t("menu.add_member"),
|
||||
metadata = {Lang:t("menu.add_member_txt")},
|
||||
event = 'Renewed-Banking:client:addAccountMember',
|
||||
args = {
|
||||
account = account
|
||||
}
|
||||
}
|
||||
lib.registerContext({
|
||||
id = 'renewed_banking_member_manage',
|
||||
title = Lang:t("menu.bank_name"),
|
||||
position = 'top-right',
|
||||
menu = 'renewed_banking_account_view',
|
||||
options = menuOpts
|
||||
})
|
||||
lib.showContext("renewed_banking_member_manage")
|
||||
end
|
||||
},
|
||||
[6] = {
|
||||
event = "Renewed-Banking:client:removeMemberConfirmation",
|
||||
menu = function(data)
|
||||
local table = {
|
||||
{
|
||||
isMenuHeader = true,
|
||||
header = Lang:t("menu.bank_name")
|
||||
},
|
||||
{
|
||||
header = Lang:t("menu.back"),
|
||||
icon = "fa-solid fa-angle-left",
|
||||
params = {
|
||||
isServer =true,
|
||||
event = "Renewed-Banking:client:accountsMenuView",
|
||||
args = data
|
||||
}
|
||||
},
|
||||
{
|
||||
header = Lang:t("menu.remove_member"),
|
||||
txt = Lang:t("menu.remove_member_txt2", {id=data.cid}),
|
||||
params = {
|
||||
isServer = true,
|
||||
event = 'Renewed-Banking:server:removeAccountMember',
|
||||
args = data
|
||||
}
|
||||
}
|
||||
}
|
||||
exports["qb-menu"]:openMenu(table)
|
||||
end,
|
||||
lib = function(data)
|
||||
lib.registerContext({
|
||||
id = 'renewed_banking_member_remove',
|
||||
title = Lang:t("menu.bank_name"),
|
||||
position = 'top-right',
|
||||
menu = "renewed_banking_account_view",
|
||||
options = {
|
||||
{
|
||||
title = Lang:t("menu.remove_member"),
|
||||
metadata = {Lang:t("menu.remove_member_txt2", {id=data.cid})},
|
||||
serverEvent = 'Renewed-Banking:server:removeAccountMember',
|
||||
args = data
|
||||
}
|
||||
}
|
||||
})
|
||||
lib.showContext("renewed_banking_member_remove")
|
||||
end
|
||||
},
|
||||
[7] = {
|
||||
event = "Renewed-Banking:client:addAccountMember",
|
||||
menu = function(data)
|
||||
local dialog = exports["qb-input"]:ShowInput({
|
||||
header = Lang:t("menu.bank_name"),
|
||||
submitText = Lang:t("menu.add_account_member"),
|
||||
inputs = {
|
||||
{
|
||||
text = Lang:t("menu.citizen_id"),
|
||||
name = "accountid",
|
||||
type = "text",
|
||||
isRequired = true
|
||||
}
|
||||
}
|
||||
})
|
||||
if dialog and dialog.accountid then
|
||||
dialog.accountid = dialog.accountid:upper():gsub("%s+", "")
|
||||
TriggerServerEvent("Renewed-Banking:server:addAccountMember", data.account, dialog.accountid)
|
||||
end
|
||||
end,
|
||||
lib = function(data)
|
||||
local input = lib.inputDialog(Lang:t("menu.add_account_member"), {{
|
||||
type = "input",
|
||||
label = Lang:t("menu.citizen_id"),
|
||||
placeholder = "1001"
|
||||
}})
|
||||
if input and input[1] then
|
||||
input[1] = input[1]:upper():gsub("%s+", "")
|
||||
TriggerServerEvent("Renewed-Banking:server:addAccountMember", data.account, input[1])
|
||||
end
|
||||
end
|
||||
},
|
||||
[8] = {
|
||||
event = "Renewed-Banking:client:changeAccountName",
|
||||
menu = function(data)
|
||||
local dialog = exports["qb-input"]:ShowInput({
|
||||
header = Lang:t("menu.bank_name"),
|
||||
submitText = Lang:t("menu.change_account_name"),
|
||||
inputs = {
|
||||
{
|
||||
text = Lang:t("menu.account_id"),
|
||||
name = "accountid",
|
||||
type = "text",
|
||||
isRequired = true
|
||||
}
|
||||
}
|
||||
})
|
||||
if dialog and dialog.accountid then
|
||||
dialog.accountid = dialog.accountid:lower():gsub("%s+", "")
|
||||
TriggerServerEvent("Renewed-Banking:server:changeAccountName", data.account, dialog.accountid)
|
||||
end
|
||||
end,
|
||||
lib = function(data)
|
||||
local input = lib.inputDialog(Lang:t("menu.change_account_name"), {{
|
||||
type = "input",
|
||||
label = Lang:t("menu.account_id"),
|
||||
placeholder = "savings-1001"
|
||||
}})
|
||||
if input and input[1] then
|
||||
input[1] = input[1]:lower():gsub("%s+", "")
|
||||
TriggerServerEvent("Renewed-Banking:server:changeAccountName", data.account, input[1])
|
||||
end
|
||||
end
|
||||
}
|
||||
}
|
||||
for k=1, #bankingMenus do
|
||||
RegisterNetEvent(bankingMenus[k].event, lib and bankingMenus[k].lib or bankingMenus[k].menu)
|
||||
end
|
45
resources/[renewed]/Renewed-Banking/config.lua
Normal file
45
resources/[renewed]/Renewed-Banking/config.lua
Normal file
@ -0,0 +1,45 @@
|
||||
config = {
|
||||
renewedMultiJob = false, -- https://github.com/Renewed-Scripts/qb-phone Built into the qb-phone edit.
|
||||
atms = {
|
||||
`prop_atm_01`,
|
||||
`prop_atm_02`,
|
||||
`prop_atm_03`,
|
||||
`prop_fleeca_atm`
|
||||
},
|
||||
peds = {
|
||||
[1] = { -- Pacific Standard
|
||||
model = 'u_m_m_bankman',
|
||||
coords = vector4(241.44, 227.19, 106.29, 170.43),
|
||||
createAccounts = true
|
||||
},
|
||||
[2] = {
|
||||
model = 'ig_barry',
|
||||
coords = vector4(313.84, -280.58, 54.16, 338.31)
|
||||
},
|
||||
[3] = {
|
||||
model = 'ig_barry',
|
||||
coords = vector4(149.46, -1042.09, 29.37, 335.43)
|
||||
},
|
||||
[4] = {
|
||||
model = 'ig_barry',
|
||||
coords = vector4(-351.23, -51.28, 49.04, 341.73)
|
||||
},
|
||||
[5] = {
|
||||
model = 'ig_barry',
|
||||
coords = vector4(-1211.9, -331.9, 37.78, 20.07)
|
||||
},
|
||||
[6] = {
|
||||
model = 'ig_barry',
|
||||
coords = vector4(-2961.14, 483.09, 15.7, 83.84)
|
||||
},
|
||||
[7] = {
|
||||
model = 'ig_barry',
|
||||
coords = vector4(1174.8, 2708.2, 38.09, 178.52)
|
||||
},
|
||||
[8] = { -- paleto
|
||||
model = 'u_m_m_bankman',
|
||||
coords = vector4(-112.22, 6471.01, 31.63, 134.18),
|
||||
createAccounts = true
|
||||
}
|
||||
}
|
||||
}
|
31
resources/[renewed]/Renewed-Banking/fxmanifest.lua
Normal file
31
resources/[renewed]/Renewed-Banking/fxmanifest.lua
Normal file
@ -0,0 +1,31 @@
|
||||
fx_version 'cerulean'
|
||||
game 'gta5'
|
||||
|
||||
description 'Renewed Banking'
|
||||
Author "uShifty#1733"
|
||||
version '1.0.3'
|
||||
|
||||
lua54 'yes'
|
||||
|
||||
shared_scripts {
|
||||
'@qb-core/shared/locale.lua',
|
||||
'locales/da.lua',
|
||||
'config.lua'
|
||||
}
|
||||
|
||||
client_scripts {
|
||||
--'@ox_lib/init.lua',
|
||||
'client/*.lua'
|
||||
}
|
||||
|
||||
server_scripts {
|
||||
'@oxmysql/lib/MySQL.lua',
|
||||
'server/*.lua'
|
||||
}
|
||||
|
||||
ui_page 'web/public/index.html'
|
||||
|
||||
files {
|
||||
'web/public/index.html',
|
||||
'web/public/**/*'
|
||||
}
|
87
resources/[renewed]/Renewed-Banking/locales/da.lua
Normal file
87
resources/[renewed]/Renewed-Banking/locales/da.lua
Normal file
@ -0,0 +1,87 @@
|
||||
Translations = {
|
||||
time = {
|
||||
weeks = "%{time} uger siden",
|
||||
aweek = "En uge siden",
|
||||
days = "%{time} dage siden",
|
||||
aday = "En dag siden",
|
||||
hours = "%{time} timer siden",
|
||||
ahour = "En time siden",
|
||||
mins = "%{time} minutter siden",
|
||||
amin = "Et minut siden",
|
||||
secs = "Et par sekudner siden",
|
||||
},
|
||||
logs = {
|
||||
invalid_account = "^6[^4Renewed-Banking^6] ^0 Konto fundet (%{account})",
|
||||
broke_account = "^6[^4Renewed-Banking^6] ^0 Konto(%{account}) er for fattig med %{amount} DKK",
|
||||
illegal_action = "^6[^4Renewed-Banking^6] ^0 %{name} Prøvede at udføre en aktion på en konto han ikke har lavet.",
|
||||
no_account = "^6[^4Renewed-Banking^6] ^0 %{name} Prøvede at udføre en aktion på en konto han ikke har lavet.",
|
||||
existing_account = "^6[^4Renewed-Banking^6] ^0 Konto %{account} eksistere allerede."
|
||||
},
|
||||
notify = {
|
||||
invalid_amount = "Ugyldig mængde %{type}",
|
||||
not_enough_money = "Kontoen har ingen penge",
|
||||
comp_transaction = "%{name} har %{type} %{amount} DKK",
|
||||
fail_transfer = "Fejl! Kunne ikke overføre til den ukendte konto!",
|
||||
account_taken = "Konto ID er allerede i brug...",
|
||||
unknown_player = "Spiller med ID '%{id}' blev ikke fundet...",
|
||||
loading_failed = "Fejl! Kunne ikke finde Bank Data!",
|
||||
dead = "Du er død! Handlingen mislykkedes...",
|
||||
too_far_away = "Handlingen mislykkedes, du er for langt væk...",
|
||||
give_cash = "Succesfuldt givet %{cash},- til ID %{id}",
|
||||
received_cash = "Du modtog %{cash},- fra ID %{id}"
|
||||
},
|
||||
menu = {
|
||||
bank_name = "Los Santos Bank",
|
||||
view_members = "Se alle konto medlemmer!",
|
||||
no_account = "Konto blev ikke fundet",
|
||||
no_account_txt = "Du skal være ejeren af kontoen!",
|
||||
manage_members = "Styre konto medlemmer",
|
||||
manage_members_txt = "Se og tilføj Konto Medlemmer!",
|
||||
edit_acc_name = "Skift Konto navn",
|
||||
edit_acc_name_txt = "Transaktioner ville ikke opdatere gamle navne",
|
||||
remove_member_txt = "Fjern konto medlemmer!",
|
||||
add_member = "Tilføj borger til konto!",
|
||||
add_member_txt = "Vær forsigtig med hvem du tilføjer (Skal bruge Borger ID)",
|
||||
remove_member = "Er du sikker på du ville fjerne borger?",
|
||||
remove_member_txt2 = "BorgerID: %{id}; Der er ingen vej tilbage!",
|
||||
back = "Gå Tilbage",
|
||||
view_bank = "Vis Bank Konto",
|
||||
manage_bank = "Styr Bank Konto",
|
||||
create_account = "Lav en ny Konto",
|
||||
create_account_txt = "Lav en ny underbankskonto!",
|
||||
manage_account = "Styr eksisterende Kontoer",
|
||||
manage_account_txt = "Vis eksisterende Kontoer!",
|
||||
account_id = "Konto ID (INGEN MELLEMRUM)",
|
||||
change_account_name = "Skift Konto Navn",
|
||||
citizen_id = "Borger/Spiller ID",
|
||||
add_account_member = "Tilføj Konto Medlem",
|
||||
givecash = "Brug /givecash [ID] [BELØB]",
|
||||
},
|
||||
ui = {
|
||||
account_title = " Konto | #",
|
||||
account = " Konto ",
|
||||
amount = "Mængde",
|
||||
comment = "Kommentar",
|
||||
transfer = "Virksomhed eller Borger ID",
|
||||
cancel = "Annuller",
|
||||
confirm = "Send",
|
||||
cash = "Kontanter: DKK",
|
||||
transactions = "Transaktioner",
|
||||
bank_name = "Los Santos Bank",
|
||||
select_account = "Vælg hvilken som helst konto",
|
||||
message = "Beksed",
|
||||
accounts = "Kontoer",
|
||||
balance = "Tilgængelig Saldo",
|
||||
frozen = "Konto Status: Frosset",
|
||||
org = "Organisation",
|
||||
personal = "Personlig",
|
||||
personal_acc = "Personlig Konto | Konto #",
|
||||
deposit_but = "Indsæt Penge",
|
||||
withdraw_but = "Hæv Penge",
|
||||
transfer_but = "Overførsel"
|
||||
}
|
||||
}
|
||||
Lang = Locale:new({
|
||||
phrases = Translations,
|
||||
warnOnMissing = true
|
||||
})
|
87
resources/[renewed]/Renewed-Banking/locales/en.lua
Normal file
87
resources/[renewed]/Renewed-Banking/locales/en.lua
Normal file
@ -0,0 +1,87 @@
|
||||
Translations = {
|
||||
time = {
|
||||
weeks = "%{time} weeks ago",
|
||||
aweek = "A week ago",
|
||||
days = "%{time} days ago",
|
||||
aday = "A day ago",
|
||||
hours = "%{time} hours ago",
|
||||
ahour = "A hour ago",
|
||||
mins = "%{time} minutes ago",
|
||||
amin = "A minute ago",
|
||||
secs = "A few seconds ago",
|
||||
},
|
||||
logs = {
|
||||
invalid_account = "^6[^4Renewed-Banking^6] ^0 Account not found (%{account})",
|
||||
broke_account = "^6[^4Renewed-Banking^6] ^0 Account(%{account}) is too broke with balance of $%{amount}",
|
||||
illegal_action = "^6[^4Renewed-Banking^6] ^0 %{name} has attempted to perform an action to an account they didnt create.",
|
||||
no_account = "^6[^4Renewed-Banking^6] ^0 %{name} has attempted to perform an action to an account they didnt create.",
|
||||
existing_account = "^6[^4Renewed-Banking^6] ^0 Account %{account} already exsist"
|
||||
},
|
||||
notify = {
|
||||
invalid_amount = "Invalid amount to %{type}",
|
||||
not_enough_money = "Account does not have enough funds!",
|
||||
comp_transaction = "%{name} has %{type} $%{amount}",
|
||||
fail_transfer = "Failed to transfer to unknown account!",
|
||||
account_taken = "Account ID is already in use",
|
||||
unknown_player = "Player with ID '%{id}' could not be found.",
|
||||
loading_failed = "Failed to load Banking Data!",
|
||||
dead = "Action failed, you're dead ",
|
||||
too_far_away = "Action failed, too far away",
|
||||
give_cash = "Successfully gave $%{cash} to ID %{id}",
|
||||
received_cash = "Successfully received $%{cash} from ID %{id}"
|
||||
},
|
||||
menu = {
|
||||
bank_name = "Los Santos Banking",
|
||||
view_members = "View All Account Members!",
|
||||
no_account = "Account Not Found",
|
||||
no_account_txt = "You need to be the creator",
|
||||
manage_members = "Manage Account Members",
|
||||
manage_members_txt = "View Existing & Add Members",
|
||||
edit_acc_name = "Change Account Name",
|
||||
edit_acc_name_txt = "Transactions wont update old names",
|
||||
remove_member_txt = "Remove Account Member!",
|
||||
add_member = "Add Citizen To Account",
|
||||
add_member_txt = "Be careful who youu add(Requires Citizen ID)",
|
||||
remove_member = "Are you sure you want to remove Citizen?",
|
||||
remove_member_txt2 = "CitizenID: %{id}; Their is no going back.",
|
||||
back = "Go Back",
|
||||
view_bank = "View Bank Account",
|
||||
manage_bank = "Manage Bank Account",
|
||||
create_account = "Create New Account",
|
||||
create_account_txt = "Create a new sub bank account!",
|
||||
manage_account = "Manage Existing Accounts",
|
||||
manage_account_txt = "View existing accounts!",
|
||||
account_id = "Account ID (NO SPACES)",
|
||||
change_account_name = "Change Account Name",
|
||||
citizen_id = "Citizen/State ID",
|
||||
add_account_member = "Add Account Member",
|
||||
givecash = "Usage /givecash [ID] [AMOUNT]",
|
||||
},
|
||||
ui = {
|
||||
account_title = " Account / ",
|
||||
account = " Account ",
|
||||
amount = "Amount",
|
||||
comment = "Comment",
|
||||
transfer = "Business or Citizen ID",
|
||||
cancel = "Cancel",
|
||||
confirm = "Submit",
|
||||
cash = "Cash: $",
|
||||
transactions = "Transactions",
|
||||
bank_name = "Los Santos Bank",
|
||||
select_account = "Select any Account",
|
||||
message = "Message",
|
||||
accounts = "Accounts",
|
||||
balance = "Available Balance",
|
||||
frozen = "Account Status: Frozen",
|
||||
org = "Organization",
|
||||
personal = "Personal",
|
||||
personal_acc = "Personal Account / ",
|
||||
deposit_but = "Deposit",
|
||||
withdraw_but = "Withdraw",
|
||||
transfer_but = "Transfer",
|
||||
}
|
||||
}
|
||||
Lang = Locale:new({
|
||||
phrases = Translations,
|
||||
warnOnMissing = true
|
||||
})
|
82
resources/[renewed]/Renewed-Banking/locales/es.lua
Normal file
82
resources/[renewed]/Renewed-Banking/locales/es.lua
Normal file
@ -0,0 +1,82 @@
|
||||
Translations = {
|
||||
time = {
|
||||
weeks = "%{time} hace semanas",
|
||||
aweek = "hace una semana",
|
||||
days = "%{time} hace días",
|
||||
aday = "Hace un día",
|
||||
hours = "%{time} hours ago",
|
||||
ahour = "horas atras",
|
||||
mins = "%{time} hace minutos",
|
||||
amin = "Hace un minuto",
|
||||
secs = "Hace unos segundos",
|
||||
},
|
||||
logs = {
|
||||
invalid_account = "^6[^4Renewed-Banking^6] ^0 Cuenta no encontrada (%{account})",
|
||||
broke_account = "^6[^4Renewed-Banking^6] ^0 Cuenta(%{account}) está demasiado arruinado con el saldo de $%{amount}",
|
||||
illegal_action = "^6[^4Renewed-Banking^6] ^0 %{name} ha intentado realizar una acción en una cuenta que no creó.",
|
||||
no_account = "^6[^4Renewed-Banking^6] ^0 %{name} ha intentado realizar una acción en una cuenta que no creó.",
|
||||
existing_account = "^6[^4Renewed-Banking^6] ^0 Cuenta %{account} ya existe"
|
||||
},
|
||||
notify = {
|
||||
invalid_amount = "Cantidad Invalida para %{type}",
|
||||
not_enough_money = "La cuenta no tiene fondos suficientes!",
|
||||
comp_transaction = "%{name} tiene %{type} $%{amount}",
|
||||
fail_transfer = "Error al transferir a cuenta desconocida!",
|
||||
account_taken = "El ID de cuenta ya está en uso",
|
||||
unknown_player = "Jugador con ID '%{id}' no pudo ser encontrado.",
|
||||
loading_failed = "Error al cargar los datos bancarios!"
|
||||
},
|
||||
menu = {
|
||||
bank_name = "Banco De Los Santos",
|
||||
view_members = "Ver todos los miembros de la cuenta!",
|
||||
no_account = "Cuenta no encontrada",
|
||||
no_account_txt = "Necesitas ser el creador",
|
||||
manage_members = "Administrar miembros de la cuenta",
|
||||
manage_members_txt = "Ver miembros existentes y agregar",
|
||||
edit_acc_name = "Cambiar nombre de cuenta",
|
||||
edit_acc_name_txt = "Las transacciones no actualizarán los nombres antiguos",
|
||||
remove_member_txt = "Eliminar miembro de la cuenta!",
|
||||
add_member = "Agregar ciudadano a la cuenta",
|
||||
add_member_txt = "Ten cuidado a quien agregas(Requiere ID de ciudadano)",
|
||||
remove_member = "¿Estás seguro de que quieres eliminar Citizen?",
|
||||
remove_member_txt2 = "ID De el Ciudadano : %{id}; No hay vuelta atrás.",
|
||||
back = "Regresar",
|
||||
view_bank = "Ver cuenta bancaria",
|
||||
manage_bank = "Administrar cuenta bancaria",
|
||||
create_account = "Crear una nueva cuenta",
|
||||
create_account_txt = "Crear una nueva subcuenta bancaria!",
|
||||
manage_account = "Administrar cuentas existentes",
|
||||
manage_account_txt = "Ver cuentas existentes!",
|
||||
account_id = "ID de la cuenta (NO ESPACIOS)",
|
||||
change_account_name = "Cambiar nombre de cuenta",
|
||||
citizen_id = "ID De el Ciudadano/Estado",
|
||||
add_account_member = "Agregar miembro de la cuenta"
|
||||
},
|
||||
ui = {
|
||||
account_title = " Cuenta / ",
|
||||
account = " Cuenta ",
|
||||
amount = "Cantidad",
|
||||
comment = "Comentario",
|
||||
transfer = "Negocio or ID De el Ciudadano",
|
||||
cancel = "Cancelar",
|
||||
confirm = "Enviar",
|
||||
cash = "Dinero: $",
|
||||
transactions = "Transaciones",
|
||||
bank_name = "Banco De Los Santos",
|
||||
select_account = "Seleccione cualquier cuenta",
|
||||
message = "Mensaje",
|
||||
accounts = "Cuentas",
|
||||
balance = "Saldo disponible",
|
||||
frozen = "Estado de la cuenta: congelada",
|
||||
org = "Organización",
|
||||
personal = "Personal",
|
||||
personal_acc = "Cuenta Personal / ",
|
||||
deposit_but = "Depósito",
|
||||
withdraw_but = "Retirar",
|
||||
transfer_but = "Transferir",
|
||||
}
|
||||
}
|
||||
Lang = Locale:new({
|
||||
phrases = Translations,
|
||||
warnOnMissing = true
|
||||
})
|
82
resources/[renewed]/Renewed-Banking/locales/fr.lua
Normal file
82
resources/[renewed]/Renewed-Banking/locales/fr.lua
Normal file
@ -0,0 +1,82 @@
|
||||
Translations = {
|
||||
time = {
|
||||
weeks = "%{time} Plusieurs semaines",
|
||||
aweek = "Il y a une semaine",
|
||||
days = "%{time} il y a quelques jours",
|
||||
aday = "Il y a un jour",
|
||||
hours = "%{time} il y a des heures",
|
||||
ahour = "Il y a une heure",
|
||||
mins = "%{time} il y a quelques minutes",
|
||||
amin = "Il y'a une minute",
|
||||
secs = "Il ya quelques secondes",
|
||||
},
|
||||
logs = {
|
||||
invalid_account = "^6[^4Renewed-Banking^6] ^0 Compte non trouvé (%{account})",
|
||||
broke_account = "^6[^4Renewed-Banking^6] ^0 Compte(%{account}) est trop brisé avec la balance de $%{amount}",
|
||||
illegal_action = "^6[^4Renewed-Banking^6] ^0 %{name} a tenté d'effectuer une action sur un compte qu'il n'a pas créé.",
|
||||
no_account = "^6[^4Renewed-Banking^6] ^0 %{name} a tenté d'effectuer une action sur un compte qu'il n'a pas créé.",
|
||||
existing_account = "^6[^4Renewed-Banking^6] ^0 Compte %{account} existe déjà"
|
||||
},
|
||||
notify = {
|
||||
invalid_amount = "Montant invalide à %{type}",
|
||||
not_enough_money = "Le compte n'a pas assez de fonds!",
|
||||
comp_transaction = "%{name} a %{type} $%{amount}",
|
||||
fail_transfer = "Échec du transfert vers un compte inconnu!",
|
||||
account_taken = "L'ID de compte est déjà utilisé",
|
||||
unknown_player = "Joueur avec ID '%{id}' Ne peut être trouvé.",
|
||||
loading_failed = "Échec du chargement des données bancaires!"
|
||||
},
|
||||
menu = {
|
||||
bank_name = "Banque de Los Santos",
|
||||
view_members = "Voir tous les membres du compte!",
|
||||
no_account = "Compte non trouvé",
|
||||
no_account_txt = "Vous devez être le créateur",
|
||||
manage_members = "Gérer les membres du compte",
|
||||
manage_members_txt = "Afficher les membres existants et ajouter des membres",
|
||||
edit_acc_name = "Modifier le nom du compte",
|
||||
edit_acc_name_txt = "Les transactions ne mettront pas à jour les anciens noms",
|
||||
remove_member_txt = "Supprimer le membre du compte!",
|
||||
add_member = "Ajouter un citoyen au compte",
|
||||
add_member_txt = "Faites attention à qui vous ajoutez(Nécessite une carte d'identité citoyenne)",
|
||||
remove_member = "Êtes-vous sûr de vouloir supprimer Citoyen?",
|
||||
remove_member_txt2 = "ID citoyen: %{id}; Il n'y pas de retour en arriere.",
|
||||
back = "Retourner",
|
||||
view_bank = "Afficher le compte bancaire",
|
||||
manage_bank = "Gérer le compte bancaire",
|
||||
create_account = "Créer un nouveau compte",
|
||||
create_account_txt = "Créez un nouveau sous-compte bancaire!",
|
||||
manage_account = "Gérer les comptes existants",
|
||||
manage_account_txt = "Voir les comptes existants!",
|
||||
account_id = "identifiant de compte (SANS ESPACES)",
|
||||
change_account_name = "Modifier le nom du compte",
|
||||
citizen_id = "Citoyen / ID d'État",
|
||||
add_account_member = "Ajouter un membre de compte"
|
||||
},
|
||||
ui = {
|
||||
account_title = " Compte / ",
|
||||
account = " Compte ",
|
||||
amount = "Montant",
|
||||
comment = "Commentaire",
|
||||
transfer = "ID d'entreprise ou de citoyen",
|
||||
cancel = "Annulé",
|
||||
confirm = "Soumettre",
|
||||
cash = "Cash: $",
|
||||
transactions = "Transactions",
|
||||
bank_name = "Banque Los Santos",
|
||||
select_account = "Sélectionnez n'importe quel compte",
|
||||
message = "Message",
|
||||
accounts = "Comptes",
|
||||
balance = "Solde disponible",
|
||||
frozen = "Statut du compte: gelé",
|
||||
org = "Organisme",
|
||||
personal = "Personnel",
|
||||
personal_acc = "Compte Personnel / ",
|
||||
deposit_but = "Verser",
|
||||
withdraw_but = "Se désister",
|
||||
transfer_but = "Transférer",
|
||||
}
|
||||
}
|
||||
Lang = Locale:new({
|
||||
phrases = Translations,
|
||||
warnOnMissing = true
|
||||
})
|
82
resources/[renewed]/Renewed-Banking/locales/it.lua
Normal file
82
resources/[renewed]/Renewed-Banking/locales/it.lua
Normal file
@ -0,0 +1,82 @@
|
||||
Translations = {
|
||||
time = {
|
||||
weeks = "%{time} settimane fà",
|
||||
aweek = "Una settimana fà",
|
||||
days = "%{time} giorni fà",
|
||||
aday = "Un giorno fà",
|
||||
hours = "%{time} ore fà",
|
||||
ahour = "Un ora fà",
|
||||
mins = "%{time} minuti fà",
|
||||
amin = "Un minuto fà",
|
||||
secs = "Alcuni secondi fà",
|
||||
},
|
||||
logs = {
|
||||
invalid_account = "^6[^4Renewed-Banking^6] ^0 Il conto non è stato trovato (%{account})",
|
||||
broke_account = "^6[^4Renewed-Banking^6] ^0 Il conto (%{account}) è troppo in negativo, ha un saldo di $%{amount}",
|
||||
illegal_action = "^6[^4Renewed-Banking^6] ^0 %{name} ha tentato di eseguire un'azione su un account non creato.",
|
||||
no_account = "^6[^4Renewed-Banking^6] ^0 %{name} ha tentato di eseguire un'azione su un account non creato.",
|
||||
existing_account = "^6[^4Renewed-Banking^6] ^0 Il conto %{account} è già esistente."
|
||||
},
|
||||
notify = {
|
||||
invalid_amount = "Importo non valido per %{type}",
|
||||
not_enough_money = "Il conto non ha fondi sufficienti!",
|
||||
comp_transaction = "%{name} ha %{type} $%{amount}",
|
||||
fail_transfer = "Non è stato possibile eseguire il trasferimento al conto sconosciuto!",
|
||||
account_taken = "L\'ID conto è già in uso",
|
||||
unknown_player = "Il giocatore con l\'ID '%{id}' non è stato trovato.",
|
||||
loading_failed = "Impossibile caricare i dati bancari!"
|
||||
},
|
||||
menu = {
|
||||
bank_name = "Banca di Los Santos",
|
||||
view_members = "Visualizza tutti i membri del conto!",
|
||||
no_account = "Conto non trovato",
|
||||
no_account_txt = "Devi essere il creatore",
|
||||
manage_members = "Gestione membri del conto",
|
||||
manage_members_txt = "Visualizza & Aggiungi Membri",
|
||||
edit_acc_name = "Cambia il nome del conto",
|
||||
edit_acc_name_txt = "Le transazioni non aggiornano i nomi vecchi",
|
||||
remove_member_txt = "Rimuovi membri dal conto!",
|
||||
add_member = "Aggiungi cittadino al conto",
|
||||
add_member_txt = "Fai attenzione a chi aggiungi (Richiede il Citizen ID)",
|
||||
remove_member = "Sei sicuro di voler rimuovere questo cittadino?",
|
||||
remove_member_txt2 = "CitizenID: %{id}; Non è possibile tornare indietro.",
|
||||
back = "Indietro",
|
||||
view_bank = "Vedi conto bancario",
|
||||
manage_bank = "Gestisci conto bancario",
|
||||
create_account = "Crea un nuovo conto",
|
||||
create_account_txt = "Crea un nuovo conto secondario!",
|
||||
manage_account = "Gestisci un conto esistente",
|
||||
manage_account_txt = "Vedi i conti esistenti!",
|
||||
account_id = "ID Conto (SENZA SPAZI)",
|
||||
change_account_name = "Cambia il nome del conto",
|
||||
citizen_id = "Citizen/State ID",
|
||||
add_account_member = "Aggiungi un membro al conto"
|
||||
},
|
||||
ui = {
|
||||
account_title = " Conto / ",
|
||||
account = " Conto ",
|
||||
amount = "Quantità",
|
||||
comment = "Nota",
|
||||
transfer = "Azienda o Citizen ID",
|
||||
cancel = "Annulla",
|
||||
confirm = "Conferma",
|
||||
cash = "Contanti: $",
|
||||
transactions = "Transazioni",
|
||||
bank_name = "Banca di Los Santos",
|
||||
select_account = "Seleziona un conto",
|
||||
message = "Messaggio",
|
||||
accounts = "Conti",
|
||||
balance = "Saldo attuale",
|
||||
frozen = "Stato conto: Congelato",
|
||||
org = "Organizzazione",
|
||||
personal = "Personale",
|
||||
personal_acc = "Account Personale / ",
|
||||
deposit_but = "Depositare",
|
||||
withdraw_but = "Ritirare",
|
||||
transfer_but = "Trasferimento",
|
||||
}
|
||||
}
|
||||
Lang = Locale:new({
|
||||
phrases = Translations,
|
||||
warnOnMissing = true
|
||||
})
|
82
resources/[renewed]/Renewed-Banking/locales/nl.lua
Normal file
82
resources/[renewed]/Renewed-Banking/locales/nl.lua
Normal file
@ -0,0 +1,82 @@
|
||||
Translations = {
|
||||
time = {
|
||||
weeks = "%{time} weken geleden",
|
||||
aweek = "Een week geleden",
|
||||
days = "%{time} dagen geleden",
|
||||
aday = "Een dag geleden",
|
||||
hours = "%{time} uren geleden",
|
||||
ahour = "Een uur geleden",
|
||||
mins = "%{time} minuten geleden",
|
||||
amin = "Een minuut geleden",
|
||||
secs = "Een paar seconden geleden",
|
||||
},
|
||||
logs = {
|
||||
invalid_account = "^6[^4Renewed-Banking^6] ^0 Acount niet gevonden (%{account})",
|
||||
broke_account = "^6[^4Renewed-Banking^6] ^0 Acount(%{account}) is te arm, met saldo van €%{amount}",
|
||||
illegal_action = "^6[^4Renewed-Banking^6] ^0 %{name} heeft geprobeerd een actie uit te voeren op een acount dat niet door deze persoon is gemaakt.",
|
||||
no_account = "^6[^4Renewed-Banking^6] ^0 %{name} heeft geprobeerd een actie uit te voeren op een acount dat niet door deze persoon is gemaakt.",
|
||||
existing_account = "^6[^4Renewed-Banking^6] ^0 Acount %{account} bestaat al"
|
||||
},
|
||||
notify = {
|
||||
invalid_amount = "Ongeldig bedrag voor %{type}",
|
||||
not_enough_money = "Rekening heeft niet genoeg saldo!",
|
||||
comp_transaction = "%{name} heeft %{type} €%{amount}",
|
||||
fail_transfer = "Overschrijving mislukt. Acount is onbekend!",
|
||||
account_taken = "Acount-ID is al in gebruik",
|
||||
unknown_player = "Burger met ID '%{id}' kan niet worden gevonden.",
|
||||
loading_failed = "Kan bankgegevens niet laden!"
|
||||
},
|
||||
menu = {
|
||||
bank_name = "Los Santos Bankieren",
|
||||
view_members = "Bekijk alle acountleden!",
|
||||
no_account = "Acount Niet Gevonden",
|
||||
no_account_txt = "Jij moet de eigenaar zijn",
|
||||
manage_members = "Acountleden Beheren",
|
||||
manage_members_txt = "Bekijk bestaande & voeg leden toe",
|
||||
edit_acc_name = "Acountnaam wijzigen",
|
||||
edit_acc_name_txt = "Transacties updaten oude namen niet",
|
||||
remove_member_txt = "Acountlid verwijderen!",
|
||||
add_member = "Burger toevoegen aan acount",
|
||||
add_member_txt = "Wees voorzichtig met wie u toevoegt (burger-ID vereist)",
|
||||
remove_member = "Weet je zeker dat je deze burger wilt verwijderen?",
|
||||
remove_member_txt2 = "Burger-ID: %{id}; Er is geen weg meer terug.",
|
||||
back = "Ga Terug",
|
||||
view_bank = "Bankrekening bekijken",
|
||||
manage_bank = "Bankrekening beheren",
|
||||
create_account = "Creëer een nieuw acount",
|
||||
create_account_txt = "Maak een nieuwe subbankrekening aan!",
|
||||
manage_account = "Bestaande acounts beheren",
|
||||
manage_account_txt = "Bekijk bestaande acounts!",
|
||||
account_id = "Acount-ID (GEEN SPATIES)",
|
||||
change_account_name = "Acountnaam wijzigen",
|
||||
citizen_id = "Burger/Staat ID",
|
||||
add_account_member = "Acountlid toevoegen"
|
||||
},
|
||||
ui = {
|
||||
account_title = " Acount / ",
|
||||
account = " Acount ",
|
||||
amount = "Hoeveelheid",
|
||||
comment = "Opmerking",
|
||||
transfer = "Bedrijfs of burger-ID",
|
||||
cancel = "Annuleren",
|
||||
confirm = "Verzenden",
|
||||
cash = "Contant: €",
|
||||
transactions = "Transacties",
|
||||
bank_name = "Los Santos Bank",
|
||||
select_account = "Selecteer een account",
|
||||
message = "Bericht",
|
||||
accounts = "Acounts",
|
||||
balance = "Beschikbare saldo",
|
||||
frozen = "Accountstatus: Bevroren",
|
||||
org = "Organisatie",
|
||||
personal = "Persoonlijk",
|
||||
personal_acc = "Persoonlijk account / ",
|
||||
deposit_but = "Storten",
|
||||
withdraw_but = "Opnemen",
|
||||
transfer_but = "Overschrijven",
|
||||
}
|
||||
}
|
||||
Lang = Locale:new({
|
||||
phrases = Translations,
|
||||
warnOnMissing = true
|
||||
})
|
82
resources/[renewed]/Renewed-Banking/locales/ro.lua
Normal file
82
resources/[renewed]/Renewed-Banking/locales/ro.lua
Normal file
@ -0,0 +1,82 @@
|
||||
Translations = {
|
||||
time = {
|
||||
weeks = "Acum %{time} saptamani",
|
||||
aweek = "Acum o saptamana",
|
||||
days = "Acum %{time} zile",
|
||||
aday = "Acum o zi",
|
||||
hours = "Acum %{time} ore",
|
||||
ahour = "Acum o ora",
|
||||
mins = "Acum %{time} minute",
|
||||
amin = "Acum un minut",
|
||||
secs = "Acum cateva secunde",
|
||||
},
|
||||
logs = {
|
||||
invalid_account = "^6[^4Renewed-Banking^6] ^0 Contul nu a fost gasit (%{account})",
|
||||
broke_account = "^6[^4Renewed-Banking^6] ^0 Contul (%{account}) nu are destul fonduri: $%{amount}",
|
||||
illegal_action = "^6[^4Renewed-Banking^6] ^0 %{name} a incercat sa efectueze o actiune intr-un cont pe care nu l-a creat!",
|
||||
no_account = "^6[^4Renewed-Banking^6] ^0 %{name} a incercat sa efectueze o actiune intr-un cont pe care nu l-a creat!",
|
||||
existing_account = "^6[^4Renewed-Banking^6] ^0 Contul %{account} deja exista"
|
||||
},
|
||||
notify = {
|
||||
invalid_amount = "Suma invalida %{type}",
|
||||
not_enough_money = "Nu ai destule fonduri!",
|
||||
comp_transaction = "%{name} has %{type} $%{amount}",
|
||||
fail_transfer = "Nu s-au putut transfera intr-un cont necunoscut!",
|
||||
account_taken = "Un cont cu acest ID exista deja!",
|
||||
unknown_player = "Persoana cu ID-ul '%{id}' nu a putut fi gasita.",
|
||||
loading_failed = "Nu s-au incarcat datele bancare!"
|
||||
},
|
||||
menu = {
|
||||
bank_name = "Banca Los Santos",
|
||||
view_members = "Vizulizeaza toti membrii contului!",
|
||||
no_account = "Contul nu a fost gasit",
|
||||
no_account_txt = "Trebuie sa detii acest cont",
|
||||
manage_members = "Management Membrii Cont",
|
||||
manage_members_txt = "Membri Existenti & Adauga Membri",
|
||||
edit_acc_name = "Schimba Numele Contului",
|
||||
edit_acc_name_txt = "Tranzactiile nu vor actualiza numele vechi",
|
||||
remove_member_txt = "Sterge Membru!",
|
||||
add_member = "Adauga Membri",
|
||||
add_member_txt = "Ai grija pe cine adaugi(Necesar Citizen ID)",
|
||||
remove_member = "Esti sigur ca vrei sa stergi persoana?",
|
||||
remove_member_txt2 = "Citizen ID: %{id}; Aceasta actiune este irevirsibila.",
|
||||
back = "Inapoi",
|
||||
view_bank = "Vezi Cont Bancar",
|
||||
manage_bank = "Management Conturi Bancare",
|
||||
create_account = "Creeaza Un Cont Nou",
|
||||
create_account_txt = "Creeaza un cont bancar secundar!",
|
||||
manage_account = "Management Conturi Existente",
|
||||
manage_account_txt = "Vezi conturi existente!",
|
||||
account_id = "ID Cont (FARA SPATIU)",
|
||||
change_account_name = "Schimba Numele Contului",
|
||||
citizen_id = "Citizen/ID Stat",
|
||||
add_account_member = "Adauga Membru"
|
||||
},
|
||||
ui = {
|
||||
account_title = " Cont / ",
|
||||
account = " Cont ",
|
||||
amount = "Suma",
|
||||
comment = "Descriere",
|
||||
transfer = "Nume business sau Citizen ID",
|
||||
cancel = "Anuleaza",
|
||||
confirm = "Confirma",
|
||||
cash = "Cash: $",
|
||||
transactions = "Tranzactii",
|
||||
bank_name = "Banca Los Santos",
|
||||
select_account = "Selecteaza un cont",
|
||||
message = "Mesaj",
|
||||
accounts = "Conturi",
|
||||
balance = "Balanta Valabila",
|
||||
frozen = "Status Cont: Inghetat",
|
||||
org = "Organizare",
|
||||
personal = "Personal",
|
||||
personal_acc = "Cont Personal / ",
|
||||
deposit_but = "Depozit",
|
||||
withdraw_but = "Retrage",
|
||||
transfer_but = "Transfer",
|
||||
}
|
||||
}
|
||||
Lang = Locale:new({
|
||||
phrases = Translations,
|
||||
warnOnMissing = true
|
||||
})
|
82
resources/[renewed]/Renewed-Banking/locales/sv.lua
Normal file
82
resources/[renewed]/Renewed-Banking/locales/sv.lua
Normal file
@ -0,0 +1,82 @@
|
||||
Translations = {
|
||||
time = {
|
||||
weeks = "%{time} veckor sedan",
|
||||
aweek = "En vecka sedan",
|
||||
days = "%{time} dagar sedan",
|
||||
aday = "Igår",
|
||||
hours = "%{time} timmar sedan",
|
||||
ahour = "En timme sen",
|
||||
mins = "%{time} minuter sedan",
|
||||
amin = "En minut sen",
|
||||
secs = "Några sekunder sedan"
|
||||
},
|
||||
logs = {
|
||||
invalid_account = "^6[^4Renewed-Banking^6] ^0 Inget konto hittades (%{account})",
|
||||
broke_account = "^6[^4Renewed-Banking^6] ^0 Konto(%{account}) har för låg balans. Nuvarande balans: $%{amount}",
|
||||
illegal_action = "^6[^4Renewed-Banking^6] ^0 %{name} har försökt göra något mot ett konto dom inte skapat.",
|
||||
no_account = "^6[^4Renewed-Banking^6] ^0 %{name} har försökt göra något mot ett konto dom inte skapat.",
|
||||
existing_account = "^6[^4Renewed-Banking^6] ^0 Konto %{account} finns redan!"
|
||||
},
|
||||
notify = {
|
||||
invalid_amount = "Ogiltig summa till %{type}",
|
||||
not_enough_money = "Kontot har för låg balans!",
|
||||
comp_transaction = "%{name} har %{type} $%{amount}",
|
||||
fail_transfer = "Misslyckad överföring till ogiltigt konto!",
|
||||
account_taken = "Konto ID används redan!",
|
||||
unknown_player = "Person med ID '%{id}' kunde inte hittas!",
|
||||
loading_failed = "Misslyckades att ladda bank information!"
|
||||
},
|
||||
menu = {
|
||||
bank_name = "Handelsbanken",
|
||||
view_members = "Visa alla kontots medlemmar!",
|
||||
no_account = "Konto kunde inte hittas",
|
||||
no_account_txt = "Du måste vara kontoägaren",
|
||||
manage_members = "Hantera kontots medlemmar",
|
||||
manage_members_txt = "Visa existerande & Lägg till medlemmar",
|
||||
edit_acc_name = "Ändra kontots namn",
|
||||
edit_acc_name_txt = "Transaktioner kommer inte att uppdatera gamla namn",
|
||||
remove_member_txt = "Ta bort konto medlem!",
|
||||
add_member = "Lägg till person till kontot",
|
||||
add_member_txt = "Var försiktig med vem du lägger till(Kräver Medborgar ID)",
|
||||
remove_member = "Är du säker på att du vill ta bort personen?",
|
||||
remove_member_txt2 = "Medborgar ID: %{id}; Detta kan inte ångras.",
|
||||
back = "Tillbaka",
|
||||
view_bank = "Visa bankkonto",
|
||||
manage_bank = "Hantera bankkonto",
|
||||
create_account = "Skapa nytt bankkonto",
|
||||
create_account_txt = "Skapa ett nytt undre bankkonto!",
|
||||
manage_account = "Hantera existerande konton",
|
||||
manage_account_txt = "Visa existerande konton!",
|
||||
account_id = "Konto ID (Inga mellanrum)",
|
||||
change_account_name = "Ändra konto namn",
|
||||
citizen_id = "Medborgar/Statligt ID",
|
||||
add_account_member = "Lägg till konto medlem"
|
||||
},
|
||||
ui = {
|
||||
account_title = " Konto / ",
|
||||
account = " Konto ",
|
||||
amount = "Summa",
|
||||
comment = "Kommentar",
|
||||
transfer = "Företags eller Medborgar ID",
|
||||
cancel = "Avbryt",
|
||||
confirm = "Skicka",
|
||||
cash = "Pengar: kr",
|
||||
transactions = "Betalningar",
|
||||
bank_name = "Handelsbanken",
|
||||
select_account = "Välj ett konto",
|
||||
message = "Meddelande",
|
||||
accounts = "Konton",
|
||||
balance = "Tillgänglig balans",
|
||||
frozen = "Konto status: Fryst",
|
||||
org = "Organisation",
|
||||
personal = "Personligt",
|
||||
personal_acc = "Personligt konto / ",
|
||||
deposit_but = "Sätt in",
|
||||
withdraw_but = "Ta ut",
|
||||
transfer_but = "Överför"
|
||||
}
|
||||
}
|
||||
Lang = Locale:new({
|
||||
phrases = Translations,
|
||||
warnOnMissing = true
|
||||
})
|
653
resources/[renewed]/Renewed-Banking/server/main.lua
Normal file
653
resources/[renewed]/Renewed-Banking/server/main.lua
Normal file
@ -0,0 +1,653 @@
|
||||
local QBCore = exports['qb-core']:GetCoreObject()
|
||||
|
||||
-- if not LoadResourceFile("Renewed-Banking", 'web/public/build/bundle.js') then
|
||||
-- error('Unable to load UI. Build Renewed-Banking or download the latest release.\n ^https://github.com/Renewed-Scripts/Renewed-Banking/releases/latest/download/Renewed-Banking.rar^0\n If you are using a custom build of the UI, please make sure the resource name is Renewed-Banking (you may not rename the resource).')
|
||||
-- end
|
||||
|
||||
local cachedAccounts = {}
|
||||
local cachedPlayers = {}
|
||||
|
||||
CreateThread(function()
|
||||
MySQL.query('SELECT * FROM bank_accounts_new', {}, function(accounts)
|
||||
for _,v in pairs (accounts) do
|
||||
local job = v.id
|
||||
v.auth = json.decode(v.auth)
|
||||
cachedAccounts[job] = { -- cachedAccounts[#cachedAccounts+1]
|
||||
id = job,
|
||||
type = Lang:t("ui.org"),
|
||||
name = QBCore.Shared.Jobs[job] and QBCore.Shared.Jobs[job].label or QBCore.Shared.Gangs[job] and QBCore.Shared.Gangs[job].label or job,
|
||||
frozen = v.isFrozen == 1,
|
||||
amount = v.amount,
|
||||
transactions = json.decode(v.transactions),
|
||||
auth = {},
|
||||
creator = v.creator
|
||||
}
|
||||
if #v.auth >= 1 then
|
||||
for k=1, #v.auth do
|
||||
cachedAccounts[job].auth[v.auth[k]] = true
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
end)
|
||||
|
||||
local function getTimeElapsed(seconds)
|
||||
local retData
|
||||
local minutes = math.floor(seconds / 60)
|
||||
local hours = math.floor(minutes / 60)
|
||||
local days = math.floor(hours / 24)
|
||||
local weeks = math.floor(days / 7)
|
||||
|
||||
if weeks ~= 0 and weeks > 1 then
|
||||
retData = Lang:t("time.weeks",{time=weeks})
|
||||
elseif weeks ~= 0 and weeks == 1 then
|
||||
retData = Lang:t("time.aweek")
|
||||
elseif days ~= 0 and days > 1 then
|
||||
retData = Lang:t("time.days",{time=days})
|
||||
elseif days ~= 0 and days == 1 then
|
||||
retData = Lang:t("time.aday")
|
||||
elseif hours ~= 0 and hours > 1 then
|
||||
retData = Lang:t("time.hours",{time=hours})
|
||||
elseif hours ~= 0 and hours == 1 then
|
||||
retData = Lang:t("time.ahour")
|
||||
elseif minutes ~= 0 and minutes > 1 then
|
||||
retData = Lang:t("time.mins",{time=minutes})
|
||||
elseif minutes ~= 0 and minutes == 1 then
|
||||
retData = Lang:t("time.amin")
|
||||
else
|
||||
retData = Lang:t("time.secs")
|
||||
end
|
||||
return retData
|
||||
end
|
||||
|
||||
local function updatePlayerAccount(cid)
|
||||
MySQL.query('SELECT * FROM player_transactions WHERE id = @id ', {['@id'] = cid}, function(account)
|
||||
local query = '%' .. cid .. '%'
|
||||
MySQL.query("SELECT * FROM bank_accounts_new WHERE auth LIKE ? ", {query}, function(shared)
|
||||
cachedPlayers[cid] = {
|
||||
isFrozen = 0,
|
||||
transactions = #account > 0 and json.decode(account[1].transactions) or {},
|
||||
accounts = {}
|
||||
}
|
||||
|
||||
if #shared >= 1 then
|
||||
for k=1, #shared do
|
||||
cachedPlayers[cid].accounts[#cachedPlayers[cid].accounts+1] = shared[k].id
|
||||
end
|
||||
end
|
||||
end)
|
||||
end)
|
||||
end
|
||||
|
||||
local function getBankData(source)
|
||||
local Player = QBCore.Functions.GetPlayer(source)
|
||||
local bankData = {}
|
||||
local time = os.time()
|
||||
local cid = Player.PlayerData.citizenid
|
||||
if not cachedPlayers[cid] then updatePlayerAccount(cid) end
|
||||
|
||||
bankData[#bankData+1] = {
|
||||
id = cid,
|
||||
type = Lang:t("ui.personal"),
|
||||
name = ("%s %s"):format(Player.PlayerData.charinfo.firstname, Player.PlayerData.charinfo.lastname),
|
||||
frozen = cachedPlayers[cid].isFrozen,
|
||||
amount = Player.PlayerData.money.bank,
|
||||
cash = Player.PlayerData.money.cash,
|
||||
transactions = json.decode(json.encode(cachedPlayers[cid].transactions)),
|
||||
}
|
||||
|
||||
for k=1, #bankData[1].transactions do
|
||||
bankData[1].transactions[k].time = getTimeElapsed(time-bankData[1].transactions[k].time)
|
||||
end
|
||||
|
||||
if config.renewedMultiJob then
|
||||
local jobs = exports['qb-phone']:getJobs(cid)
|
||||
|
||||
for k,v in pairs(jobs) do
|
||||
if cachedAccounts[k] then
|
||||
local job = json.decode(json.encode(cachedAccounts[k]))
|
||||
if job and QBCore.Shared.Jobs[k].grades[tostring(v.grade)].bankAuth then
|
||||
for i=1, #job.transactions do
|
||||
job.transactions[i].time = getTimeElapsed(time-job.transactions[i].time)
|
||||
end
|
||||
bankData[#bankData+1] = job
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
local job = json.decode(json.encode(cachedAccounts[Player.PlayerData.job.name]))
|
||||
if job and QBCore.Shared.Jobs[Player.PlayerData.job.name].grades[tostring(Player.PlayerData.job.grade.level)].bankAuth then
|
||||
for k=1, #job.transactions do
|
||||
job.transactions[k].time = getTimeElapsed(time-job.transactions[k].time)
|
||||
end
|
||||
bankData[#bankData+1] = job
|
||||
end
|
||||
end
|
||||
|
||||
local gang = json.decode(json.encode(cachedAccounts[Player.PlayerData.gang.name]))
|
||||
if gang and QBCore.Shared.Gangs[Player.PlayerData.gang.name].grades[tostring(Player.PlayerData.gang.grade.level)].bankAuth then
|
||||
for k=1, #gang.transactions do
|
||||
gang.transactions[k].time = getTimeElapsed(time-gang.transactions[k].time)
|
||||
end
|
||||
bankData[#bankData+1] = gang
|
||||
end
|
||||
|
||||
local sharedAccounts = cachedPlayers[cid].accounts
|
||||
for k=1, #sharedAccounts do
|
||||
local sAccount = json.decode(json.encode(cachedAccounts[sharedAccounts[k]]))
|
||||
for i=1, #sAccount.transactions do
|
||||
sAccount.transactions[i].time = getTimeElapsed(time-sAccount.transactions[i].time)
|
||||
end
|
||||
bankData[#bankData+1] = sAccount
|
||||
end
|
||||
|
||||
return bankData
|
||||
end
|
||||
|
||||
QBCore.Functions.CreateCallback("renewed-banking:server:initalizeBanking", function(source, cb)
|
||||
local bankData = getBankData(source)
|
||||
cb(bankData)
|
||||
end)
|
||||
|
||||
RegisterNetEvent('QBCore:Server:OnPlayerLoaded', function()
|
||||
local Player = QBCore.Functions.GetPlayer(source)
|
||||
local cid = Player.PlayerData.citizenid
|
||||
updatePlayerAccount(cid)
|
||||
end)
|
||||
|
||||
-- Events
|
||||
AddEventHandler('onResourceStart', function(resourceName)
|
||||
if resourceName == GetCurrentResourceName() then
|
||||
for _, v in pairs(QBCore.Functions.GetPlayers()) do
|
||||
local Player = QBCore.Functions.GetPlayer(v)
|
||||
if Player then
|
||||
local cid = Player.PlayerData.citizenid
|
||||
updatePlayerAccount(cid)
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
local function genTransactionID()
|
||||
local template ='xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'
|
||||
return string.gsub(template, '[xy]', function (c)
|
||||
local v = (c == 'x') and math.random(0, 0xf) or math.random(8, 0xb)
|
||||
return string.format('%x', v)
|
||||
end)
|
||||
end
|
||||
|
||||
local function handleTransaction(account, title, amount, message, issuer, receiver, type, transID)
|
||||
local transaction = {
|
||||
trans_id = transID or genTransactionID(),
|
||||
title = title,
|
||||
amount = amount,
|
||||
trans_type = type,
|
||||
receiver = receiver,
|
||||
message = message,
|
||||
issuer = issuer,
|
||||
time = os.time()
|
||||
}
|
||||
if cachedAccounts[account] then
|
||||
table.insert(cachedAccounts[account].transactions, 1, transaction)
|
||||
MySQL.query("INSERT INTO bank_accounts_new (id, transactions) VALUES (:id, :transactions) ON DUPLICATE KEY UPDATE transactions = :transactions",{
|
||||
['id'] = account,
|
||||
['transactions'] = json.encode(cachedAccounts[account].transactions)
|
||||
})
|
||||
elseif cachedPlayers[account] then
|
||||
table.insert(cachedPlayers[account].transactions, 1, transaction)
|
||||
MySQL.query("INSERT INTO player_transactions (id, transactions) VALUES (:id, :transactions) ON DUPLICATE KEY UPDATE transactions = :transactions",{
|
||||
['id'] = account,
|
||||
['transactions'] = json.encode(cachedPlayers[account].transactions)
|
||||
})
|
||||
else
|
||||
print(Lang:t("logs.invalid_account",{account=account}))
|
||||
end
|
||||
return transaction
|
||||
end exports("handleTransaction", handleTransaction)
|
||||
|
||||
local function getAccountMoney(account)
|
||||
if not cachedAccounts[account] then
|
||||
Lang:t("logs.invalid_account",{account=account})
|
||||
return false
|
||||
end
|
||||
return cachedAccounts[account].amount
|
||||
end exports('getAccountMoney', getAccountMoney)
|
||||
|
||||
local function updateBalance(account)
|
||||
MySQL.query("UPDATE bank_accounts_new SET amount = ? WHERE id = ?",{ cachedAccounts[account].amount, account })
|
||||
end
|
||||
|
||||
local function addAccountMoney(account, amount)
|
||||
if not cachedAccounts[account] then
|
||||
Lang:t("logs.invalid_account",{account=account})
|
||||
return false
|
||||
end
|
||||
cachedAccounts[account].amount += amount
|
||||
updateBalance(account)
|
||||
return true
|
||||
end exports('addAccountMoney', addAccountMoney)
|
||||
|
||||
QBCore.Functions.CreateCallback("Renewed-Banking:server:deposit", function(source, cb, data)
|
||||
local Player = QBCore.Functions.GetPlayer(source)
|
||||
local amount = tonumber(data.amount)
|
||||
if not amount or amount < 1 then
|
||||
QBCore.Functions.Notify(source, Lang:t("notify.invalid_amount",{type="deposit"}), 'error', 5000)
|
||||
cb(false)
|
||||
return
|
||||
end
|
||||
local name = ("%s %s"):format(Player.PlayerData.charinfo.firstname, Player.PlayerData.charinfo.lastname)
|
||||
if not data.comment or data.comment == "" then data.comment = Lang:t("notify.comp_transaction",{name = name, type="deposited", amount = amount}) end
|
||||
if Player.Functions.RemoveMoney('cash', amount, data.comment) then
|
||||
if cachedAccounts[data.fromAccount] then
|
||||
addAccountMoney(data.fromAccount, amount)
|
||||
else
|
||||
Player.Functions.AddMoney('bank', amount, data.comment)
|
||||
end
|
||||
handleTransaction(data.fromAccount,Lang:t("ui.personal_acc") .. data.fromAccount, amount, data.comment, name, data.fromAccount, "deposit")
|
||||
local bankData = getBankData(source)
|
||||
cb(bankData)
|
||||
else
|
||||
TriggerClientEvent('Renewed-Banking:client:sendNotification', source, Lang:t("notify.not_enough_money"))
|
||||
cb(false)
|
||||
end
|
||||
end)
|
||||
|
||||
local function removeAccountMoney(account, amount)
|
||||
if not cachedAccounts[account] then
|
||||
print(Lang:t("logs.invalid_account",{account=account}))
|
||||
return false
|
||||
end
|
||||
if cachedAccounts[account].amount < amount then
|
||||
print(Lang:t("logs.broke_account",{account=account, amount=amount}))
|
||||
return false
|
||||
end
|
||||
|
||||
cachedAccounts[account].amount -= amount
|
||||
updateBalance(account)
|
||||
return true
|
||||
end exports('removeAccountMoney', removeAccountMoney)
|
||||
|
||||
QBCore.Functions.CreateCallback("Renewed-Banking:server:withdraw", function(source, cb, data)
|
||||
local Player = QBCore.Functions.GetPlayer(source)
|
||||
local amount = tonumber(data.amount)
|
||||
if not amount or amount < 1 then
|
||||
QBCore.Functions.Notify(source, Lang:t("notify.invalid_amount",{type="withdraw"}), 'error', 5000)
|
||||
cb(false)
|
||||
return
|
||||
end
|
||||
local name = ("%s %s"):format(Player.PlayerData.charinfo.firstname, Player.PlayerData.charinfo.lastname)
|
||||
if not data.comment or data.comment == "" then data.comment = Lang:t("notify.comp_transaction",{name = name, type="withdrawed", amount = amount}) end
|
||||
|
||||
local canWithdraw
|
||||
if cachedAccounts[data.fromAccount] then
|
||||
canWithdraw = removeAccountMoney(data.fromAccount, amount)
|
||||
else
|
||||
canWithdraw = Player.PlayerData.money.bank >= amount and Player.Functions.RemoveMoney('bank', amount, data.comment) or false
|
||||
end
|
||||
if canWithdraw then
|
||||
Player.Functions.AddMoney('cash', amount, data.comment)
|
||||
handleTransaction(data.fromAccount,Lang:t("ui.personal_acc") .. data.fromAccount, amount, data.comment, data.fromAccount, name, "withdraw")
|
||||
local bankData = getBankData(source)
|
||||
cb(bankData)
|
||||
else
|
||||
TriggerClientEvent('Renewed-Banking:client:sendNotification', source, Lang:t("notify.not_enough_money"))
|
||||
cb(false)
|
||||
end
|
||||
end)
|
||||
|
||||
local function getPlayerData(source, id)
|
||||
local Player = QBCore.Functions.GetPlayer(tonumber(id))
|
||||
if not Player then Player = QBCore.Functions.GetPlayerByCitizenId(id) end
|
||||
if not Player then
|
||||
Player = QBCore.Functions.GetOfflinePlayerByCitizenId(id)
|
||||
if Player and not cachedPlayers[Player.PlayerData.citizenid] then
|
||||
local pushingP = promise.new()
|
||||
MySQL.query('SELECT * FROM player_transactions WHERE id = @id ', {['@id'] = id}, function(account)
|
||||
local resolve = account[1] and json.decode(account[1].transactions) or {}
|
||||
pushingP:resolve(resolve)
|
||||
end)
|
||||
local offlineTrans = Citizen.Await(pushingP)
|
||||
cachedPlayers[id] = {transactions = offlineTrans}
|
||||
end
|
||||
end
|
||||
if not Player then
|
||||
local msg = ("Cannot Find Account(%s)"):format(id)
|
||||
print(Lang:t("logs.invalid_account",{account=id}))
|
||||
if source then
|
||||
QBCore.Functions.Notify(source, msg, 'error', 5000)
|
||||
end
|
||||
end
|
||||
return Player
|
||||
end
|
||||
|
||||
QBCore.Functions.CreateCallback("Renewed-Banking:server:transfer", function(source, cb, data)
|
||||
local Player = QBCore.Functions.GetPlayer(source)
|
||||
local amount = tonumber(data.amount)
|
||||
if not amount or amount < 1 then
|
||||
QBCore.Functions.Notify(source, Lang:t("notify.invalid_amount",{type="transfer"}), 'error', 5000)
|
||||
cb(false)
|
||||
return
|
||||
end
|
||||
if cachedAccounts[data.fromAccount] then
|
||||
if not data.comment or data.comment == "" then data.comment = Lang:t("notify.comp_transaction",{name = data.fromAccount, type="transfered", amount = amount}) end
|
||||
if cachedAccounts[data.stateid] then
|
||||
local canTransfer = removeAccountMoney(data.fromAccount, amount)
|
||||
if canTransfer then
|
||||
addAccountMoney(data.stateid, amount)
|
||||
local title = ("%s / %s"):format(cachedAccounts[data.fromAccount].name, data.fromAccount)
|
||||
local transaction = handleTransaction(data.fromAccount, title, amount, data.comment, cachedAccounts[data.fromAccount].name, cachedAccounts[data.stateid].name, "withdraw")
|
||||
handleTransaction(data.stateid, title, amount, data.comment, cachedAccounts[data.fromAccount].name, cachedAccounts[data.stateid].name, "deposit", transaction.trans_id)
|
||||
else
|
||||
TriggerClientEvent('Renewed-Banking:client:sendNotification', source, Lang:t("notify.not_enough_money"))
|
||||
cb(false)
|
||||
return
|
||||
end
|
||||
else
|
||||
local Player2 = getPlayerData(source, data.stateid)
|
||||
if not Player2 then
|
||||
TriggerClientEvent('Renewed-Banking:client:sendNotification', source, Lang:t("notify.fail_transfer"))
|
||||
cb(false)
|
||||
return
|
||||
end
|
||||
local canTransfer = removeAccountMoney(data.fromAccount, amount)
|
||||
if canTransfer then
|
||||
Player2.Functions.AddMoney('bank', amount, data.comment)
|
||||
local name = ("%s %s"):format(Player2.PlayerData.charinfo.firstname, Player2.PlayerData.charinfo.lastname)
|
||||
local transaction = handleTransaction(data.fromAccount, ("%s / %s"):format(cachedAccounts[data.fromAccount].name, data.fromAccount), amount, data.comment, cachedAccounts[data.fromAccount].name, name, "withdraw")
|
||||
handleTransaction(data.stateid, ("%s / %s"):format(cachedAccounts[data.fromAccount].name, data.fromAccount), amount, data.comment, cachedAccounts[data.fromAccount].name, name, "deposit", transaction.trans_id)
|
||||
else
|
||||
TriggerClientEvent('Renewed-Banking:client:sendNotification', source, Lang:t("notify.not_enough_money"))
|
||||
cb(false)
|
||||
return
|
||||
end
|
||||
end
|
||||
else
|
||||
local name = ("%s %s"):format(Player.PlayerData.charinfo.firstname, Player.PlayerData.charinfo.lastname)
|
||||
if not data.comment or data.comment == "" then data.comment = Lang:t("notify.comp_transaction",{name = data.fromAccount, type="transfered", amount = amount}) end
|
||||
if cachedAccounts[data.stateid] then
|
||||
if Player.PlayerData.money.bank >= amount and Player.Functions.RemoveMoney('bank', amount, data.comment) then
|
||||
addAccountMoney(data.stateid, amount)
|
||||
local transaction = handleTransaction(data.fromAccount, Lang:t("ui.personal_acc") .. data.fromAccount, amount, data.comment, name, cachedAccounts[data.stateid].name, "withdraw")
|
||||
handleTransaction(data.stateid, Lang:t("ui.personal_acc") .. data.fromAccount, amount, data.comment, name, cachedAccounts[data.stateid].name, "deposit", transaction.trans_id)
|
||||
else
|
||||
TriggerClientEvent('Renewed-Banking:client:sendNotification', source, Lang:t("notify.not_enough_money"))
|
||||
cb(false)
|
||||
return
|
||||
end
|
||||
else
|
||||
local Player2 = getPlayerData(source, data.stateid)
|
||||
if not Player2 then
|
||||
TriggerClientEvent('Renewed-Banking:client:sendNotification', source, Lang:t("notify.fail_transfer"))
|
||||
cb(false)
|
||||
return
|
||||
end
|
||||
|
||||
if Player.PlayerData.money.bank >= amount and Player.Functions.RemoveMoney('bank', amount, data.comment) then
|
||||
Player2.Functions.AddMoney('bank', amount, data.comment)
|
||||
local name2 = ("%s %s"):format(Player2.PlayerData.charinfo.firstname, Player2.PlayerData.charinfo.lastname)
|
||||
local transaction = handleTransaction(data.fromAccount, Lang:t("ui.personal_acc") .. data.fromAccount, amount, data.comment, name, name2, "withdraw")
|
||||
handleTransaction(data.stateid, Lang:t("ui.personal_acc") .. data.fromAccount, amount, data.comment, name, name2, "deposit", transaction.trans_id)
|
||||
else
|
||||
TriggerClientEvent('Renewed-Banking:client:sendNotification', source, Lang:t("notify.not_enough_money"))
|
||||
cb(false)
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
local bankData = getBankData(source)
|
||||
cb(bankData)
|
||||
end)
|
||||
|
||||
RegisterNetEvent('Renewed-Banking:server:createNewAccount', function(accountid)
|
||||
local Player = QBCore.Functions.GetPlayer(source)
|
||||
if cachedAccounts[accountid] then QBCore.Functions.Notify(source, Lang:t("notify.account_taken"), "error") return end
|
||||
cachedAccounts[accountid] = {
|
||||
id = accountid,
|
||||
type = Lang:t("ui.org"),
|
||||
name = accountid,
|
||||
frozen = 0,
|
||||
amount = 0,
|
||||
transactions = {},
|
||||
auth = { [Player.PlayerData.citizenid] = true },
|
||||
creator = Player.PlayerData.citizenid
|
||||
|
||||
}
|
||||
cachedPlayers[Player.PlayerData.citizenid].accounts[#cachedPlayers[Player.PlayerData.citizenid].accounts+1] = accountid
|
||||
MySQL.query("INSERT INTO bank_accounts_new (id, amount, transactions, auth, isFrozen, creator) VALUES (:id, :amount, :transactions, :auth, :isFrozen, :creator) ",{
|
||||
['id'] = accountid,
|
||||
['amount'] = cachedAccounts[accountid].amount,
|
||||
['transactions'] = json.encode(cachedAccounts[accountid].transactions),
|
||||
['auth'] = json.encode({Player.PlayerData.citizenid}),
|
||||
['isFrozen'] = cachedAccounts[accountid].frozen,
|
||||
['creator'] = Player.PlayerData.citizenid
|
||||
})
|
||||
end)
|
||||
|
||||
RegisterNetEvent("Renewed-Banking:server:getPlayerAccounts", function()
|
||||
local Player = QBCore.Functions.GetPlayer(source)
|
||||
local accounts = cachedPlayers[Player.PlayerData.citizenid].accounts
|
||||
local data = {}
|
||||
if #accounts >= 1 then
|
||||
for k=1, #accounts do
|
||||
if cachedAccounts[accounts[k]].creator == Player.PlayerData.citizenid then
|
||||
data[#data+1] = accounts[k]
|
||||
end
|
||||
end
|
||||
end
|
||||
TriggerClientEvent("Renewed-Banking:client:accountsMenu", source, data)
|
||||
end)
|
||||
|
||||
RegisterNetEvent("Renewed-Banking:server:viewMemberManagement", function(data)
|
||||
local Player = QBCore.Functions.GetPlayer(source)
|
||||
|
||||
local account = data.account
|
||||
local retData = {
|
||||
account = account,
|
||||
members = {}
|
||||
}
|
||||
|
||||
for k,_ in pairs(cachedAccounts[account].auth) do
|
||||
local Player2 = getPlayerData(source, k)
|
||||
if Player.PlayerData.citizenid ~= Player2.PlayerData.citizenid then
|
||||
local charInfo = Player2.PlayerData.charinfo
|
||||
retData.members[k] = ("%s %s"):format(charInfo.firstname, charInfo.lastname)
|
||||
end
|
||||
end
|
||||
|
||||
TriggerClientEvent("Renewed-Banking:client:viewMemberManagement", Player.PlayerData.source, retData)
|
||||
end)
|
||||
|
||||
RegisterNetEvent('Renewed-Banking:server:addAccountMember', function(account, member)
|
||||
local Player = QBCore.Functions.GetPlayer(source)
|
||||
|
||||
if Player.PlayerData.citizenid ~= cachedAccounts[account].creator then print(Lang:t("logs.illegal_action", {name=GetPlayerName(source)})) return end
|
||||
local Player2 = getPlayerData(source, member)
|
||||
if not Player2 then return end
|
||||
|
||||
local targetCID = Player2.PlayerData.citizenid
|
||||
if not Player2.Offline and cachedPlayers[targetCID] then
|
||||
cachedPlayers[targetCID].accounts[#cachedPlayers[targetCID].accounts+1] = account
|
||||
end
|
||||
|
||||
local auth = {}
|
||||
for k in pairs(cachedAccounts[account].auth) do auth[#auth+1] = k end
|
||||
auth[#auth+1] = targetCID
|
||||
cachedAccounts[account].auth[targetCID] = true
|
||||
MySQL.update('UPDATE bank_accounts_new SET auth = ? WHERE id = ?',{json.encode(auth), account})
|
||||
end)
|
||||
|
||||
RegisterNetEvent('Renewed-Banking:server:removeAccountMember', function(data)
|
||||
local Player = QBCore.Functions.GetPlayer(source)
|
||||
if Player.PlayerData.citizenid ~= cachedAccounts[data.account].creator then print(Lang:t("logs.illegal_action", {name=GetPlayerName(source)})) return end
|
||||
local Player2 = getPlayerData(source, data.cid)
|
||||
if not Player2 then return end
|
||||
|
||||
local targetCID = Player2.PlayerData.citizenid
|
||||
local tmp = {}
|
||||
for k in pairs(cachedAccounts[data.account].auth) do
|
||||
if targetCID ~= k then
|
||||
tmp[#tmp+1] = k
|
||||
end
|
||||
end
|
||||
|
||||
if not Player2.Offline and cachedPlayers[targetCID] then
|
||||
local newAccount = {}
|
||||
if #cachedPlayers[targetCID].accounts >= 1 then
|
||||
for k=1, #cachedPlayers[targetCID].accounts do
|
||||
if cachedPlayers[targetCID].accounts[k] ~= data.account then
|
||||
newAccount[#newAccount+1] = cachedPlayers[targetCID].accounts[k]
|
||||
end
|
||||
end
|
||||
end
|
||||
cachedPlayers[targetCID].accounts = newAccount
|
||||
end
|
||||
cachedAccounts[data.account].auth[targetCID] = nil
|
||||
MySQL.update('UPDATE bank_accounts_new SET auth = ? WHERE id = ?',{json.encode(tmp), data.account})
|
||||
end)
|
||||
|
||||
local split = QBCore.Shared.SplitStr
|
||||
local function updateAccountName(account, newName, src)
|
||||
if not split then split = QBCore.Shared.SplitStr end
|
||||
if not account or not newName then return false end
|
||||
if not cachedAccounts[account] then
|
||||
local getTranslation = Lang:t("logs.invalid_account",{account=account})
|
||||
print(getTranslation)
|
||||
if src then QBCore.Functions.Notify(src, split(getTranslation, '0')[2], 'error', 5000) end
|
||||
return false
|
||||
end
|
||||
if cachedAccounts[newName] then
|
||||
local getTranslation = Lang:t("logs.existing_account",{account=account})
|
||||
print(getTranslation)
|
||||
if src then QBCore.Functions.Notify(src, split(getTranslation, '0')[2], 'error', 5000) end
|
||||
return false
|
||||
end
|
||||
if src then
|
||||
local Player = QBCore.Functions.GetPlayer(src)
|
||||
if Player.PlayerData.citizenid ~= cachedAccounts[account].creator then
|
||||
local getTranslation = Lang:t("logs.illegal_action", {name=GetPlayerName(src)})
|
||||
print(getTranslation)
|
||||
QBCore.Functions.Notify(src, split(getTranslation, '0')[2], 'error', 5000)
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
cachedAccounts[newName] = json.decode(json.encode(cachedAccounts[account]))
|
||||
cachedAccounts[newName].id = newName
|
||||
cachedAccounts[newName].name = newName
|
||||
cachedAccounts[account] = nil
|
||||
|
||||
for _, v in pairs(QBCore.Functions.GetPlayers()) do
|
||||
local Player2 = QBCore.Functions.GetPlayer(v)
|
||||
if Player2 then
|
||||
local cid = Player2.PlayerData.citizenid
|
||||
if #cachedPlayers[cid].accounts >= 1 then
|
||||
for k=1, #cachedPlayers[cid].accounts do
|
||||
if cachedPlayers[cid].accounts[k] == account then
|
||||
table.remove(cachedPlayers[cid].accounts, k)
|
||||
cachedPlayers[cid].accounts[#cachedPlayers[cid].accounts+1] = newName
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
MySQL.update('UPDATE bank_accounts_new SET id = ? WHERE id = ?',{newName, account})
|
||||
return true
|
||||
end
|
||||
|
||||
RegisterNetEvent('Renewed-Banking:server:changeAccountName', function(account, newName)
|
||||
updateAccountName(account, newName, source)
|
||||
end) exports("changeAccountName", updateAccountName)-- Should only use this on very secure backends to avoid anyone using this as this is a server side ONLY export --
|
||||
|
||||
local function addAccountMember(account, member)
|
||||
if not account or not member then return end
|
||||
|
||||
if not cachedAccounts[account] then print(Lang:t("logs.invalid_account",{account=account})) return end
|
||||
|
||||
local Player2 = getPlayerData(false, member)
|
||||
if not Player2 then return end
|
||||
|
||||
local targetCID = Player2.PlayerData.citizenid
|
||||
if not Player2.Offline and cachedPlayers[targetCID] then
|
||||
cachedPlayers[targetCID].accounts[#cachedPlayers[targetCID].accounts+1] = account
|
||||
end
|
||||
|
||||
local auth = {}
|
||||
for k, _ in pairs(cachedAccounts[account].auth) do auth[#auth+1] = k end
|
||||
auth[#auth+1] = targetCID
|
||||
cachedAccounts[account].auth[targetCID] = true
|
||||
MySQL.update('UPDATE bank_accounts_new SET auth = ? WHERE id = ?',{json.encode(auth), account})
|
||||
|
||||
end exports("addAccountMember", addAccountMember)
|
||||
|
||||
local function removeAccountMember(account, member)
|
||||
local Player2 = getPlayerData(false, member)
|
||||
|
||||
if not Player2 then return end
|
||||
if not cachedAccounts[account] then print(Lang:t("logs.invalid_account",{account=account})) return end
|
||||
|
||||
local targetCID = Player2.PlayerData.citizenid
|
||||
|
||||
local tmp = {}
|
||||
for k in pairs(cachedAccounts[account].auth) do
|
||||
if targetCID ~= k then
|
||||
tmp[#tmp+1] = k
|
||||
end
|
||||
end
|
||||
|
||||
if not Player2.Offline and cachedPlayers[targetCID] then
|
||||
local newAccount = {}
|
||||
if #cachedPlayers[targetCID].accounts >= 1 then
|
||||
for k=1, #cachedPlayers[targetCID].accounts do
|
||||
if cachedPlayers[targetCID].accounts[k] ~= account then
|
||||
newAccount[#newAccount+1] = cachedPlayers[targetCID].accounts[k]
|
||||
end
|
||||
end
|
||||
end
|
||||
cachedPlayers[targetCID].accounts = newAccount
|
||||
end
|
||||
|
||||
cachedAccounts[account].auth[targetCID] = nil
|
||||
|
||||
MySQL.update('UPDATE bank_accounts_new SET auth = ? WHERE id = ?',{json.encode(tmp), account})
|
||||
end exports("removeAccountMember", removeAccountMember)
|
||||
|
||||
exports("getAccountTransactions", function(account)
|
||||
if cachedAccounts[account] then
|
||||
return cachedAccounts[account].transactions
|
||||
elseif cachedPlayers[account] then
|
||||
return cachedPlayers[account].transactions
|
||||
end
|
||||
print(Lang:t("logs.invalid_account",{account=account}))
|
||||
return false
|
||||
end)
|
||||
|
||||
QBCore.Commands.Add('givecash', Lang:t('menu.givecash'), {{name = 'id', help = 'Player ID'}, {name = 'amount', help = 'Amount'}}, true, function(source, args)
|
||||
local src = source
|
||||
local id = tonumber(args[1])
|
||||
local amount = math.ceil(tonumber(args[2]))
|
||||
local Player = QBCore.Functions.GetPlayer(src)
|
||||
if not Player then return end
|
||||
if not id or not amount then QBCore.Functions.Notify(src, Lang:t('menu.givecash'), 'error', 5000) return end
|
||||
|
||||
local iPlayer = QBCore.Functions.GetPlayer(id)
|
||||
if not iPlayer then QBCore.Functions.Notify(src, Lang:t('notify.unknown_player', {id=id}), 'error', 5000) return end
|
||||
|
||||
if Player.PlayerData.metadata["isdead"] then QBCore.Functions.Notify(src, Lang:t('notify.dead'), 'error', 5000) return end
|
||||
local distance = Player.PlayerData.metadata["inlaststand"] and 3.0 or 10.0
|
||||
if #(GetEntityCoords(GetPlayerPed(src)) - GetEntityCoords(GetPlayerPed(id))) > distance then QBCore.Functions.Notify(src, Lang:t('notify.too_far_away'), 'error', 5000) return end
|
||||
if amount < 0 then QBCore.Functions.Notify(src, Lang:t('notify.invalid_amount', {type="give"}), 'error', 5000) return end
|
||||
|
||||
if Player.Functions.RemoveMoney('cash', amount) then
|
||||
if iPlayer.Functions.AddMoney('cash', amount) then
|
||||
local nameA = ("%s %s"):format(Player.PlayerData.charinfo.firstname, Player.PlayerData.charinfo.lastname)
|
||||
local nameB = ("%s %s"):format(iPlayer.PlayerData.charinfo.firstname, iPlayer.PlayerData.charinfo.lastname)
|
||||
QBCore.Functions.Notify(src, Lang:t('notify.give_cash',{id = nameB, cash = tostring(amount)}), 'success', 5000)
|
||||
QBCore.Functions.Notify(id, Lang:t('notify.received_cash',{id = nameA, cash = tostring(amount)}), 'success', 5000)
|
||||
else -- Return player cash
|
||||
Player.Functions.AddMoney('cash', amount)
|
||||
end
|
||||
else
|
||||
QBCore.Functions.Notify(id, Lang:t('notify.not_enough_money'), 'error', 5000)
|
||||
end
|
||||
end)
|
347
resources/[renewed]/Renewed-Banking/web/public/build/bundle.css
Normal file
347
resources/[renewed]/Renewed-Banking/web/public/build/bundle.css
Normal file
@ -0,0 +1,347 @@
|
||||
.main.svelte-xwmgc0 {
|
||||
overflow: hidden;
|
||||
width: 60%;
|
||||
height: 60%;
|
||||
bottom: 20%;
|
||||
left: 20%;
|
||||
padding: 1%;
|
||||
position: absolute;
|
||||
background-color: #17212e;
|
||||
border-radius: 3px 3px 3px 3px;
|
||||
background-size: cover;
|
||||
background-position: center;
|
||||
opacity: 1;
|
||||
border: 2px solid #51515183;
|
||||
}
|
||||
|
||||
section.svelte-xwmgc0 {
|
||||
display: flex;
|
||||
gap: 4rem;
|
||||
height: calc(100% - 2rem)
|
||||
}
|
||||
|
||||
h5.svelte-xwmgc0 {
|
||||
font-size: 1.3rem;
|
||||
color: #74B5CD;
|
||||
font-family: 'roboto';
|
||||
}
|
||||
|
||||
.popup-container.svelte-1ou14c8.svelte-1ou14c8 {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
background-color: rgba(255, 255, 255, 0.3);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center
|
||||
}
|
||||
|
||||
.popup-content.svelte-1ou14c8.svelte-1ou14c8 {
|
||||
max-width: 50rem;
|
||||
width: 100%;
|
||||
padding: 5rem;
|
||||
border-radius: 3px;
|
||||
border: 2px solid #51515183;
|
||||
background-color: #131e2b !important;
|
||||
}
|
||||
|
||||
h2.svelte-1ou14c8.svelte-1ou14c8 {
|
||||
margin-bottom: 3rem;
|
||||
text-align: center;
|
||||
font-size: 1.5rem;
|
||||
color: #a8afb7;
|
||||
}
|
||||
|
||||
.form-row.svelte-1ou14c8.svelte-1ou14c8 {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.5rem;
|
||||
color: var(--clr-grey);
|
||||
margin-bottom: 2rem
|
||||
}
|
||||
|
||||
.form-row.svelte-1ou14c8 label.svelte-1ou14c8,
|
||||
.form-row.svelte-1ou14c8 input.svelte-1ou14c8 {
|
||||
font-size: 1.2rem;
|
||||
color: #a8afb7;
|
||||
font-family: inherit;
|
||||
}
|
||||
|
||||
.form-row.svelte-1ou14c8 input.svelte-1ou14c8 {
|
||||
padding: 0.8rem 0;
|
||||
background-color: transparent;
|
||||
border: none;
|
||||
border-bottom: 1px solid
|
||||
}
|
||||
|
||||
.notificaion-container.svelte-aywcjm {
|
||||
width: 15%;
|
||||
box-sizing: border-box;
|
||||
padding: 10px 8px;
|
||||
margin: 5px 0px;
|
||||
position: absolute;
|
||||
left: 5%;
|
||||
top: 4%
|
||||
}
|
||||
|
||||
.notificaion-content.svelte-aywcjm {
|
||||
background-color: #131e2b !important;
|
||||
padding: 2rem;
|
||||
border-radius: 1rem;
|
||||
font-size: 1em
|
||||
}
|
||||
|
||||
.loading-container.svelte-1ao9gz5.svelte-1ao9gz5 {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center
|
||||
}
|
||||
|
||||
.loading-content.svelte-1ao9gz5.svelte-1ao9gz5 {
|
||||
max-width: 50rem;
|
||||
max-height: 25rem;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: #131e2b !important;
|
||||
padding: 5rem;
|
||||
border-radius: 4px;
|
||||
border: 2px solid #51515183;
|
||||
}
|
||||
|
||||
.loading-spinner.svelte-1ao9gz5.svelte-1ao9gz5 {
|
||||
color: official;
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
left: 40%;
|
||||
top: 25%
|
||||
}
|
||||
|
||||
.loading-spinner.svelte-1ao9gz5 div.svelte-1ao9gz5 {
|
||||
transform-origin: 40px 40px;
|
||||
animation: svelte-1ao9gz5-loading-spinner 1.2s linear infinite
|
||||
}
|
||||
|
||||
.loading-spinner.svelte-1ao9gz5 div.svelte-1ao9gz5:after {
|
||||
content: " ";
|
||||
display: block;
|
||||
position: absolute;
|
||||
top: 3px;
|
||||
left: 37px;
|
||||
width: 6px;
|
||||
height: 18px;
|
||||
border-radius: 20%;
|
||||
background: #fff
|
||||
}
|
||||
|
||||
.loading-spinner.svelte-1ao9gz5 div.svelte-1ao9gz5:nth-child(1) {
|
||||
transform: rotate(0deg);
|
||||
animation-delay: -1.1s
|
||||
}
|
||||
|
||||
.loading-spinner.svelte-1ao9gz5 div.svelte-1ao9gz5:nth-child(2) {
|
||||
transform: rotate(30deg);
|
||||
animation-delay: -1s
|
||||
}
|
||||
|
||||
.loading-spinner.svelte-1ao9gz5 div.svelte-1ao9gz5:nth-child(3) {
|
||||
transform: rotate(60deg);
|
||||
animation-delay: -0.9s
|
||||
}
|
||||
|
||||
.loading-spinner.svelte-1ao9gz5 div.svelte-1ao9gz5:nth-child(4) {
|
||||
transform: rotate(90deg);
|
||||
animation-delay: -0.8s
|
||||
}
|
||||
|
||||
.loading-spinner.svelte-1ao9gz5 div.svelte-1ao9gz5:nth-child(5) {
|
||||
transform: rotate(120deg);
|
||||
animation-delay: -0.7s
|
||||
}
|
||||
|
||||
.loading-spinner.svelte-1ao9gz5 div.svelte-1ao9gz5:nth-child(6) {
|
||||
transform: rotate(150deg);
|
||||
animation-delay: -0.6s
|
||||
}
|
||||
|
||||
.loading-spinner.svelte-1ao9gz5 div.svelte-1ao9gz5:nth-child(7) {
|
||||
transform: rotate(180deg);
|
||||
animation-delay: -0.5s
|
||||
}
|
||||
|
||||
.loading-spinner.svelte-1ao9gz5 div.svelte-1ao9gz5:nth-child(8) {
|
||||
transform: rotate(210deg);
|
||||
animation-delay: -0.4s
|
||||
}
|
||||
|
||||
.loading-spinner.svelte-1ao9gz5 div.svelte-1ao9gz5:nth-child(9) {
|
||||
transform: rotate(240deg);
|
||||
animation-delay: -0.3s
|
||||
}
|
||||
|
||||
.loading-spinner.svelte-1ao9gz5 div.svelte-1ao9gz5:nth-child(10) {
|
||||
transform: rotate(270deg);
|
||||
animation-delay: -0.2s
|
||||
}
|
||||
|
||||
.loading-spinner.svelte-1ao9gz5 div.svelte-1ao9gz5:nth-child(11) {
|
||||
transform: rotate(300deg);
|
||||
animation-delay: -0.1s
|
||||
}
|
||||
|
||||
.loading-spinner.svelte-1ao9gz5 div.svelte-1ao9gz5:nth-child(12) {
|
||||
transform: rotate(330deg);
|
||||
animation-delay: 0s
|
||||
}
|
||||
|
||||
@keyframes svelte-1ao9gz5-loading-spinner {
|
||||
0% {
|
||||
opacity: 1
|
||||
}
|
||||
100% {
|
||||
opacity: 0
|
||||
}
|
||||
}
|
||||
|
||||
aside.svelte-1psnybp {
|
||||
flex: 0 0 25%
|
||||
}
|
||||
|
||||
.transactions-container.svelte-mhvyj0.svelte-mhvyj0 {
|
||||
flex: 1 1 75%;
|
||||
transform: translateY(-0.6rem);
|
||||
margin-left: -2%;
|
||||
}
|
||||
|
||||
h3.svelte-mhvyj0.svelte-mhvyj0 {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin-bottom: -0.5%;
|
||||
padding-top: 6px;
|
||||
}
|
||||
|
||||
h3.svelte-mhvyj0 div.svelte-mhvyj0 {
|
||||
display: flex;
|
||||
align-items: center
|
||||
}
|
||||
|
||||
h3.svelte-mhvyj0 img.svelte-mhvyj0 {
|
||||
width: 3rem;
|
||||
margin-right: 1rem
|
||||
}
|
||||
|
||||
.account.svelte-11vvjn0.svelte-11vvjn0 {
|
||||
padding: 0.6rem;
|
||||
border-radius: 3px;
|
||||
cursor: pointer;
|
||||
border: 2px solid #51515183;
|
||||
background-color: #131e2b !important;
|
||||
}
|
||||
|
||||
.account.svelte-11vvjn0.svelte-11vvjn0:not(:last-child) {
|
||||
margin-bottom: 1.5rem
|
||||
}
|
||||
|
||||
h4.svelte-11vvjn0.svelte-11vvjn0 {
|
||||
font-family: system-ui;
|
||||
font-size: 1.4rem;
|
||||
margin-bottom: 0.5rem;
|
||||
color: #a8afb7;
|
||||
}
|
||||
|
||||
h5.svelte-11vvjn0.svelte-11vvjn0 {
|
||||
font-size: 1.1rem;
|
||||
color: #a8afb7;
|
||||
font-family: inherit;
|
||||
}
|
||||
|
||||
h5.svelte-11vvjn0 span.svelte-11vvjn0 {
|
||||
margin-top: 0.3rem
|
||||
}
|
||||
|
||||
.price.svelte-11vvjn0.svelte-11vvjn0 {
|
||||
text-align: right;
|
||||
margin-bottom: 1rem;
|
||||
color: #a8afb7;
|
||||
font-family: inherit;
|
||||
}
|
||||
|
||||
.price.svelte-11vvjn0 strong.svelte-11vvjn0 {
|
||||
font-size: 1.4rem;
|
||||
color: #6DB1CA;
|
||||
}
|
||||
|
||||
.btns-group.svelte-11vvjn0.svelte-11vvjn0 {
|
||||
display: flex;
|
||||
justify-content: space-between
|
||||
}
|
||||
|
||||
.transaction.svelte-w3ny0j.svelte-w3ny0j {
|
||||
padding: 1rem;
|
||||
border-radius: 2px;
|
||||
font-size: 1.5rem;
|
||||
font-weight: 300;
|
||||
background-color: #131e2b !important;
|
||||
border: 2px solid #51515183;
|
||||
}
|
||||
|
||||
.transaction.svelte-w3ny0j.svelte-w3ny0j:not(:last-child) {
|
||||
margin-bottom: 1.5rem
|
||||
}
|
||||
|
||||
.transaction.svelte-w3ny0j h5.svelte-w3ny0j {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding-bottom: 0.5rem;
|
||||
margin-bottom: 1rem;
|
||||
border-bottom: 2px solid #939191ba;
|
||||
font-family: system-ui;
|
||||
font-size: 1.4rem;
|
||||
color: #a8afb7;
|
||||
}
|
||||
|
||||
.transaction.svelte-w3ny0j h4.svelte-w3ny0j {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
font-size: 1.2rem;
|
||||
color: #a8afb7;
|
||||
}
|
||||
|
||||
.transaction.svelte-w3ny0j h4 span.svelte-w3ny0j:first-child {
|
||||
font-family: inherit;
|
||||
font-size: 1.2rem;
|
||||
color: var(--clr-green)
|
||||
}
|
||||
|
||||
.transaction.svelte-w3ny0j h4 span.withdraw.svelte-w3ny0j {
|
||||
color: var(--clr-orange);
|
||||
font-family: inherit;
|
||||
font-size: 1.2rem;
|
||||
}
|
||||
|
||||
.transaction.svelte-w3ny0j h4 span.svelte-w3ny0j:nth-child(2) {
|
||||
margin-right: auto;
|
||||
margin-left: 15rem;
|
||||
color: #6DB1CA;
|
||||
}
|
||||
|
||||
.transaction.svelte-w3ny0j h6.svelte-w3ny0j {
|
||||
color: #88BCD3;
|
||||
padding: 0.5rem;
|
||||
margin: 1rem 0 1.5rem;
|
||||
background-color: #1d2a3a;
|
||||
border-radius: 4px;
|
||||
font-size: 10px;
|
||||
}
|
||||
|
||||
.transaction.svelte-w3ny0j h6 span.svelte-w3ny0j {
|
||||
margin-top: 0.5rem
|
||||
}
|
593
resources/[renewed]/Renewed-Banking/web/public/build/bundle.js
Normal file
593
resources/[renewed]/Renewed-Banking/web/public/build/bundle.js
Normal file
@ -0,0 +1,593 @@
|
||||
var app = function() {
|
||||
"use strict";
|
||||
|
||||
function t() {}
|
||||
|
||||
function n(t) { return t() }
|
||||
|
||||
function e() { return Object.create(null) }
|
||||
|
||||
function s(t) { t.forEach(n) }
|
||||
|
||||
function c(t) { return "function" == typeof t }
|
||||
|
||||
function o(t, n) { return t != t ? n == n : t !== n || t && "object" == typeof t || "function" == typeof t }
|
||||
let r, a;
|
||||
|
||||
function i(n, e, s) { n.$$.on_destroy.push(function(n, ...e) { if (null == n) return t; const s = n.subscribe(...e); return s.unsubscribe ? () => s.unsubscribe() : s }(e, s)) }
|
||||
|
||||
function l(t, n, e, s) { return t[1] && s ? function(t, n) { for (const e in n) t[e] = n[e]; return t }(e.ctx.slice(), t[1](s(n))) : e.ctx }
|
||||
|
||||
function u(t, n) { t.appendChild(n) }
|
||||
|
||||
function f(t, n, e) { t.insertBefore(n, e || null) }
|
||||
|
||||
function d(t) { t.parentNode.removeChild(t) }
|
||||
|
||||
function p(t) { return document.createElement(t) }
|
||||
|
||||
function m(t) { return document.createTextNode(t) }
|
||||
|
||||
function g() { return m(" ") }
|
||||
|
||||
function v() { return m("") }
|
||||
|
||||
function $(t, n, e, s) { return t.addEventListener(n, e, s), () => t.removeEventListener(n, e, s) }
|
||||
|
||||
function h(t, n, e) { null == e ? t.removeAttribute(n) : t.getAttribute(n) !== e && t.setAttribute(n, e) }
|
||||
|
||||
function y(t) { return "" === t ? null : +t }
|
||||
|
||||
function b(t, n) { n = "" + n, t.wholeText !== n && (t.data = n) }
|
||||
|
||||
function w(t, n) { t.value = null == n ? "" : n }
|
||||
|
||||
function _(t, n, e) { t.classList[e ? "add" : "remove"](n) }
|
||||
|
||||
function x(t) { a = t }
|
||||
|
||||
function j() { if (!a) throw new Error("Function called outside component initialization"); return a }
|
||||
|
||||
function k(t) { j().$$.on_mount.push(t) }
|
||||
const z = [],
|
||||
E = [],
|
||||
T = [],
|
||||
L = [],
|
||||
M = Promise.resolve();
|
||||
let N = !1;
|
||||
|
||||
function S(t) { T.push(t) }
|
||||
const C = new Set;
|
||||
let O = 0;
|
||||
|
||||
function U() {
|
||||
const t = a;
|
||||
do {
|
||||
for (; O < z.length;) {
|
||||
const t = z[O];
|
||||
O++, x(t), A(t.$$)
|
||||
}
|
||||
for (x(null), z.length = 0, O = 0; E.length;) E.pop()();
|
||||
for (let t = 0; t < T.length; t += 1) {
|
||||
const n = T[t];
|
||||
C.has(n) || (C.add(n), n())
|
||||
}
|
||||
T.length = 0
|
||||
} while (z.length);
|
||||
for (; L.length;) L.pop()();
|
||||
N = !1, C.clear(), x(t)
|
||||
}
|
||||
|
||||
function A(t) {
|
||||
if (null !== t.fragment) {
|
||||
t.update(), s(t.before_update);
|
||||
const n = t.dirty;
|
||||
t.dirty = [-1], t.fragment && t.fragment.p(t.ctx, n), t.after_update.forEach(S)
|
||||
}
|
||||
}
|
||||
const P = new Set;
|
||||
let V;
|
||||
|
||||
function B() { V = { r: 0, c: [], p: V } }
|
||||
|
||||
function I() { V.r || s(V.c), V = V.p }
|
||||
|
||||
function Y(t, n) { t && t.i && (P.delete(t), t.i(n)) }
|
||||
|
||||
function F(t, n, e, s) {
|
||||
if (t && t.o) {
|
||||
if (P.has(t)) return;
|
||||
P.add(t), V.c.push((() => { P.delete(t), s && (e && t.d(1), s()) })), t.o(n)
|
||||
} else s && s()
|
||||
}
|
||||
|
||||
function Z(t, n) { F(t, 1, 1, (() => { n.delete(t.key) })) }
|
||||
|
||||
function R(t, n, e, s, c, o, r, a, i, l, u, f) {
|
||||
let d = t.length,
|
||||
p = o.length,
|
||||
m = d;
|
||||
const g = {};
|
||||
for (; m--;) g[t[m].key] = m;
|
||||
const v = [],
|
||||
$ = new Map,
|
||||
h = new Map;
|
||||
for (m = p; m--;) {
|
||||
const t = f(c, o, m),
|
||||
a = e(t);
|
||||
let i = r.get(a);
|
||||
i ? s && i.p(t, n) : (i = l(a, t), i.c()), $.set(a, v[m] = i), a in g && h.set(a, Math.abs(m - g[a]))
|
||||
}
|
||||
const y = new Set,
|
||||
b = new Set;
|
||||
|
||||
function w(t) { Y(t, 1), t.m(a, u), r.set(t.key, t), u = t.first, p-- }
|
||||
for (; d && p;) {
|
||||
const n = v[p - 1],
|
||||
e = t[d - 1],
|
||||
s = n.key,
|
||||
c = e.key;
|
||||
n === e ? (u = n.first, d--, p--) : $.has(c) ? !r.has(s) || y.has(s) ? w(n) : b.has(c) ? d-- : h.get(s) > h.get(c) ? (b.add(s), w(n)) : (y.add(c), d--) : (i(e, r), d--)
|
||||
}
|
||||
for (; d--;) {
|
||||
const n = t[d];
|
||||
$.has(n.key) || i(n, r)
|
||||
}
|
||||
for (; p;) w(v[p - 1]);
|
||||
return v
|
||||
}
|
||||
|
||||
function W(t) { t && t.c() }
|
||||
|
||||
function X(t, e, o, r) {
|
||||
const { fragment: a, on_mount: i, on_destroy: l, after_update: u } = t.$$;
|
||||
a && a.m(e, o), r || S((() => {
|
||||
const e = i.map(n).filter(c);
|
||||
l ? l.push(...e) : s(e), t.$$.on_mount = []
|
||||
})), u.forEach(S)
|
||||
}
|
||||
|
||||
function q(t, n) {
|
||||
const e = t.$$;
|
||||
null !== e.fragment && (s(e.on_destroy), e.fragment && e.fragment.d(n), e.on_destroy = e.fragment = null, e.ctx = [])
|
||||
}
|
||||
|
||||
function H(t, n) {-1 === t.$$.dirty[0] && (z.push(t), N || (N = !0, M.then(U)), t.$$.dirty.fill(0)), t.$$.dirty[n / 31 | 0] |= 1 << n % 31 }
|
||||
|
||||
function J(n, c, o, r, i, l, u, f = [-1]) {
|
||||
const p = a;
|
||||
x(n);
|
||||
const m = n.$$ = { fragment: null, ctx: null, props: l, update: t, not_equal: i, bound: e(), on_mount: [], on_destroy: [], on_disconnect: [], before_update: [], after_update: [], context: new Map(c.context || (p ? p.$$.context : [])), callbacks: e(), dirty: f, skip_bound: !1, root: c.target || p.$$.root };
|
||||
u && u(m.root);
|
||||
let g = !1;
|
||||
if (m.ctx = o ? o(n, c.props || {}, ((t, e, ...s) => { const c = s.length ? s[0] : e; return m.ctx && i(m.ctx[t], m.ctx[t] = c) && (!m.skip_bound && m.bound[t] && m.bound[t](c), g && H(n, t)), e })) : [], m.update(), g = !0, s(m.before_update), m.fragment = !!r && r(m.ctx), c.target) {
|
||||
if (c.hydrate) {
|
||||
const t = function(t) { return Array.from(t.childNodes) }(c.target);
|
||||
m.fragment && m.fragment.l(t), t.forEach(d)
|
||||
} else m.fragment && m.fragment.c();
|
||||
c.intro && Y(n.$$.fragment), X(n, c.target, c.anchor, c.customElement), U()
|
||||
}
|
||||
x(p)
|
||||
}
|
||||
class D {
|
||||
$destroy() { q(this, 1), this.$destroy = t }
|
||||
$on(t, n) { const e = this.$$.callbacks[t] || (this.$$.callbacks[t] = []); return e.push(n), () => { const t = e.indexOf(n); - 1 !== t && e.splice(t, 1) } }
|
||||
$set(t) {
|
||||
var n;
|
||||
this.$$set && (n = t, 0 !== Object.keys(n).length) && (this.$$.skip_bound = !0, this.$$set(t), this.$$.skip_bound = !1)
|
||||
}
|
||||
}
|
||||
const G = atob("UmVuZXdlZC1CYW5raW5n");
|
||||
async function K(t, n = {}) {
|
||||
const e = { method: "post", headers: { "Content-Type": "application/json; charset=UTF-8" }, body: JSON.stringify(n) },
|
||||
s = await fetch(`https://${G}/${t}`, e);
|
||||
return await s.json()
|
||||
}
|
||||
const Q = [];
|
||||
|
||||
function tt(n, e = t) {
|
||||
let s;
|
||||
const c = new Set;
|
||||
|
||||
function r(t) {
|
||||
if (o(n, t) && (n = t, s)) {
|
||||
const t = !Q.length;
|
||||
for (const t of c) t[1](), Q.push(t, n);
|
||||
if (t) {
|
||||
for (let t = 0; t < Q.length; t += 2) Q[t][0](Q[t + 1]);
|
||||
Q.length = 0
|
||||
}
|
||||
}
|
||||
}
|
||||
return { set: r, update: function(t) { r(t(n)) }, subscribe: function(o, a = t) { const i = [o, a]; return c.add(i), 1 === c.size && (s = e(r) || t), o(n), () => { c.delete(i), 0 === c.size && (s(), s = null) } } }
|
||||
}
|
||||
const nt = tt(!1),
|
||||
et = tt(!1),
|
||||
st = tt("");
|
||||
let ct = tt(null);
|
||||
const ot = tt(!1);
|
||||
let rt = tt({ account: {}, actionType: "" });
|
||||
const at = tt([]),
|
||||
it = tt([]);
|
||||
|
||||
function lt(t, n) {
|
||||
const e = e => { e.data.action === t && n(e.data) };
|
||||
var s;
|
||||
k((() => window.addEventListener("message", e))), s = () => window.removeEventListener("message", e), j().$$.on_destroy.push(s)
|
||||
}
|
||||
|
||||
function ut(t) {
|
||||
let n;
|
||||
const e = t[2].default,
|
||||
s = function(t, n, e, s) { if (t) { const c = l(t, n, e, s); return t[0](c) } }(e, t, t[1], null);
|
||||
return {
|
||||
c() { s && s.c() },
|
||||
m(t, e) { s && s.m(t, e), n = !0 },
|
||||
p(t, c) {
|
||||
s && s.p && (!n || 2 & c) && function(t, n, e, s, c, o) {
|
||||
if (c) {
|
||||
const r = l(n, e, s, o);
|
||||
t.p(r, c)
|
||||
}
|
||||
}(s, e, t, t[1], n ? function(t, n, e, s) {
|
||||
if (t[2] && s) {
|
||||
const c = t[2](s(e));
|
||||
if (void 0 === n.dirty) return c;
|
||||
if ("object" == typeof c) {
|
||||
const t = [],
|
||||
e = Math.max(n.dirty.length, c.length);
|
||||
for (let s = 0; s < e; s += 1) t[s] = n.dirty[s] | c[s];
|
||||
return t
|
||||
}
|
||||
return n.dirty | c
|
||||
}
|
||||
return n.dirty
|
||||
}(e, t[1], c, null) : function(t) {
|
||||
if (t.ctx.length > 32) {
|
||||
const n = [],
|
||||
e = t.ctx.length / 32;
|
||||
for (let t = 0; t < e; t++) n[t] = -1;
|
||||
return n
|
||||
}
|
||||
return -1
|
||||
}(t[1]), null)
|
||||
},
|
||||
i(t) { n || (Y(s, t), n = !0) },
|
||||
o(t) { F(s, t), n = !1 },
|
||||
d(t) { s && s.d(t) }
|
||||
}
|
||||
}
|
||||
|
||||
function ft(t) { let n, e, s = t[0] && ut(t); return { c() { s && s.c(), n = v() }, m(t, c) { s && s.m(t, c), f(t, n, c), e = !0 }, p(t, [e]) { t[0] ? s ? (s.p(t, e), 1 & e && Y(s, 1)) : (s = ut(t), s.c(), Y(s, 1), s.m(n.parentNode, n)) : s && (B(), F(s, 1, 1, (() => { s = null })), I()) }, i(t) { e || (Y(s), e = !0) }, o(t) { F(s), e = !1 }, d(t) { s && s.d(t), t && d(n) } } }
|
||||
|
||||
function dt(t, n, e) { let s, { $$slots: c = {}, $$scope: o } = n; return nt.subscribe((t => { e(0, s = t) })), lt("setVisible", (t => { at.set(t.accounts), ct.update((() => t.accounts[0].id)), nt.set(t.status), et.set(t.loading), ot.set(t.atm) })), lt("setLoading", (t => { et.set(t.status) })), lt("notify", (t => { st.set(t.status), setTimeout((() => { st.set("") }), 3500) })), lt("updateLocale", (t => { it.set(t.translations) })), k((() => { const t = t => { s && ["Escape"].includes(t.code) && (K("closeInterface"), nt.set(!1), rt.update((t => Object.assign(Object.assign({}, t), { actionType: "" })))) }; return window.addEventListener("keydown", t), () => window.removeEventListener("keydown", t) })), t.$$set = t => { "$$scope" in t && e(1, o = t.$$scope) }, [s, o, c] }
|
||||
class pt extends D { constructor(t) { super(), J(this, t, dt, ft, o, {}) } }
|
||||
|
||||
function mt(t) { return t.toLocaleString("da-DK", { style: "currency", currency: "DKK" }) }
|
||||
const gt = (t, n = 1e3) => {
|
||||
if (!window.invokeNative)
|
||||
for (const e of t) setTimeout((() => { window.dispatchEvent(new MessageEvent("message", { data: { action: e.action, data: e.data } })) }), n)
|
||||
};
|
||||
|
||||
function vt(t) { let n, e = t[2].frozen + ""; return { c() { n = m(e) }, m(t, e) { f(t, n, e) }, p(t, s) { 4 & s && e !== (e = t[2].frozen + "") && b(n, e) }, d(t) { t && d(n) } } }
|
||||
|
||||
function $t(t) {
|
||||
let n, e, c, o, r, a, i, l, v = t[2].withdraw_but + "",
|
||||
y = t[2].transfer_but + "",
|
||||
w = !t[1] && ht(t);
|
||||
return { c() { w && w.c(), n = g(), e = p("button"), c = m(v), o = g(), r = p("button"), a = m(y), h(e, "class", "btn btn-orange"), h(r, "class", "btn btn-grey") }, m(s, d) { w && w.m(s, d), f(s, n, d), f(s, e, d), u(e, c), f(s, o, d), f(s, r, d), u(r, a), i || (l = [$(e, "click", t[6]), $(r, "click", t[7])], i = !0) }, p(t, e) { t[1] ? w && (w.d(1), w = null) : w ? w.p(t, e) : (w = ht(t), w.c(), w.m(n.parentNode, n)), 4 & e && v !== (v = t[2].withdraw_but + "") && b(c, v), 4 & e && y !== (y = t[2].transfer_but + "") && b(a, y) }, d(t) { w && w.d(t), t && d(n), t && d(e), t && d(o), t && d(r), i = !1, s(l) } }
|
||||
}
|
||||
|
||||
function ht(t) { let n, e, s, c, o = t[2].deposit_but + ""; return { c() { n = p("button"), e = m(o), h(n, "class", "btn btn-green") }, m(o, r) { f(o, n, r), u(n, e), s || (c = $(n, "click", t[5]), s = !0) }, p(t, n) { 4 & n && o !== (o = t[2].deposit_but + "") && b(e, o) }, d(t) { t && d(n), s = !1, c() } } }
|
||||
|
||||
function yt(n) {
|
||||
let e, s, c, o, r, a, i, l, v, y, w, _, x, j, k, z, E, T, L, M, N, S, C, O, U, A, P, V = n[0].type + "",
|
||||
B = n[2].account + "",
|
||||
I = n[0].id + "",
|
||||
Y = n[0].type + "",
|
||||
F = n[2].account + "",
|
||||
Z = n[0].name + "",
|
||||
R = mt(n[0].amount) + "",
|
||||
W = n[2].balance + "";
|
||||
|
||||
function X(t, n) { return t[0].isFrozen ? vt : $t }
|
||||
let q = X(n),
|
||||
H = q(n);
|
||||
return { c() { e = p("section"), s = p("h4"), c = m(V), o = m(B), r = m("/ "), a = m(I), i = g(), l = p("h5"), v = m(Y), y = m(F), w = p("br"), _ = g(), x = p("span"), j = m(Z), k = g(), z = p("div"), E = p("strong"), T = m(R), L = g(), M = p("br"), N = g(), S = p("span"), C = m(W), O = g(), U = p("div"), H.c(), h(s, "class", "svelte-11vvjn0"), h(x, "class", "svelte-11vvjn0"), h(l, "class", "svelte-11vvjn0"), h(E, "class", "svelte-11vvjn0"), h(z, "class", "price svelte-11vvjn0"), h(U, "class", "btns-group svelte-11vvjn0"), h(e, "class", "account svelte-11vvjn0") }, m(t, d) { f(t, e, d), u(e, s), u(s, c), u(s, o), u(s, r), u(s, a), u(e, i), u(e, l), u(l, v), u(l, y), u(l, w), u(l, _), u(l, x), u(x, j), u(e, k), u(e, z), u(z, E), u(E, T), u(z, L), u(z, M), u(z, N), u(z, S), u(S, C), u(e, O), u(e, U), H.m(U, null), A || (P = $(e, "click", n[8]), A = !0) }, p(t, [n]) { 1 & n && V !== (V = t[0].type + "") && b(c, V), 4 & n && B !== (B = t[2].account + "") && b(o, B), 1 & n && I !== (I = t[0].id + "") && b(a, I), 1 & n && Y !== (Y = t[0].type + "") && b(v, Y), 4 & n && F !== (F = t[2].account + "") && b(y, F), 1 & n && Z !== (Z = t[0].name + "") && b(j, Z), 1 & n && R !== (R = mt(t[0].amount) + "") && b(T, R), 4 & n && W !== (W = t[2].balance + "") && b(C, W), q === (q = X(t)) && H ? H.p(t, n) : (H.d(1), H = q(t), H && (H.c(), H.m(U, null))) }, i: t, o: t, d(t) { t && d(e), H.d(), A = !1, P() } }
|
||||
}
|
||||
|
||||
function bt(t, n, e) {
|
||||
let s, c;
|
||||
i(t, at, (t => e(9, s = t))), i(t, it, (t => e(2, c = t)));
|
||||
let o, { account: r } = n;
|
||||
|
||||
function a(t) { ct.update((() => t)) }
|
||||
|
||||
function l(t, n) {
|
||||
let e = s.find((n => t === n.id));
|
||||
rt.update((() => ({ actionType: n, account: e })))
|
||||
}
|
||||
ot.subscribe((t => { e(1, o = t) }));
|
||||
return t.$$set = t => { "account" in t && e(0, r = t.account) }, [r, o, c, a, l, () => l(r.id, "deposit"), () => l(r.id, "withdraw"), () => l(r.id, "transfer"), () => a(r.id)]
|
||||
}
|
||||
class wt extends D { constructor(t) { super(), J(this, t, bt, yt, o, { account: 0 }) } }
|
||||
|
||||
function _t(t, n, e) { const s = t.slice(); return s[2] = n[e], s }
|
||||
|
||||
function xt(t, n) {
|
||||
let e, s, c;
|
||||
return s = new wt({ props: { account: n[2] } }), {
|
||||
key: t,
|
||||
first: null,
|
||||
c() { e = v(), W(s.$$.fragment), this.first = e },
|
||||
m(t, n) { f(t, e, n), X(s, t, n), c = !0 },
|
||||
p(t, e) {
|
||||
n = t;
|
||||
const c = {};
|
||||
2 & e && (c.account = n[2]), s.$set(c)
|
||||
},
|
||||
i(t) { c || (Y(s.$$.fragment, t), c = !0) },
|
||||
o(t) { F(s.$$.fragment, t), c = !1 },
|
||||
d(t) { t && d(e), q(s, t) }
|
||||
}
|
||||
}
|
||||
|
||||
function jt(t) {
|
||||
let n, e, s, c, o, r, a = t[0].accounts + "",
|
||||
i = [],
|
||||
l = new Map,
|
||||
v = t[1];
|
||||
const $ = t => t[2].id;
|
||||
for (let n = 0; n < v.length; n += 1) {
|
||||
let e = _t(t, v, n),
|
||||
s = $(e);
|
||||
l.set(s, i[n] = xt(s, e))
|
||||
}
|
||||
return {
|
||||
c() {
|
||||
n = p("aside"), e = p("h3"), s = m(a), c = g(), o = p("section");
|
||||
for (let t = 0; t < i.length; t += 1) i[t].c();
|
||||
h(e, "class", "heading"), h(o, "class", "scroller"), h(n, "class", "svelte-1psnybp")
|
||||
},
|
||||
m(t, a) {
|
||||
f(t, n, a), u(n, e), u(e, s), u(n, c), u(n, o);
|
||||
for (let t = 0; t < i.length; t += 1) i[t].m(o, null);
|
||||
r = !0
|
||||
},
|
||||
p(t, [n]) {
|
||||
(!r || 1 & n) && a !== (a = t[0].accounts + "") && b(s, a), 2 & n && (v = t[1], B(), i = R(i, n, $, 1, t, v, l, o, Z, xt, null, _t), I())
|
||||
},
|
||||
i(t) {
|
||||
if (!r) {
|
||||
for (let t = 0; t < v.length; t += 1) Y(i[t]);
|
||||
r = !0
|
||||
}
|
||||
},
|
||||
o(t) {
|
||||
for (let t = 0; t < i.length; t += 1) F(i[t]);
|
||||
r = !1
|
||||
},
|
||||
d(t) { t && d(n); for (let t = 0; t < i.length; t += 1) i[t].d() }
|
||||
}
|
||||
}
|
||||
|
||||
function kt(t, n, e) { let s, c; return i(t, it, (t => e(0, s = t))), i(t, at, (t => e(1, c = t))), [s, c] }
|
||||
class zt extends D { constructor(t) { super(), J(this, t, kt, jt, o, {}) } }
|
||||
|
||||
function Et(t) { let n; return { c() { n = m(" ") }, m(t, e) { f(t, n, e) }, d(t) { t && d(n) } } }
|
||||
|
||||
function Tt(t) { let n; return { c() { n = m("-") }, m(t, e) { f(t, n, e) }, d(t) { t && d(n) } } }
|
||||
|
||||
function Lt(n) {
|
||||
let e, s, c, o, r, a, i, l, v, $, y, w, x, j, k, z, E, T, L, M, N, S, C, O, U, A, P, V, B, I, Y, F, Z = n[0].title + "",
|
||||
R = n[0].trans_type.toUpperCase() + "",
|
||||
W = n[0].trans_id + "",
|
||||
X = mt(n[0].amount) + "",
|
||||
q = n[0].receiver + "",
|
||||
H = n[0].time + "",
|
||||
J = n[0].issuer + "",
|
||||
D = n[1].message + "",
|
||||
G = n[0].message + "";
|
||||
|
||||
function K(t, n) { return "withdraw" === t[0].trans_type ? Tt : Et }
|
||||
let Q = K(n),
|
||||
tt = Q(n);
|
||||
return { c() { e = p("section"), s = p("h5"), c = p("span"), o = m(Z), r = m("\r\n ["), a = m(R), i = m("]"), l = g(), v = p("span"), $ = m(W), y = g(), w = p("h4"), x = p("span"), tt.c(), j = g(), k = m(X), z = g(), E = p("span"), T = m(q), L = g(), M = p("span"), N = m(H), S = g(), C = p("br"), O = g(), U = m(J), A = g(), P = p("h6"), V = m(D), B = g(), I = p("br"), Y = g(), F = m(G), h(c, "class", "svelte-w3ny0j"), h(v, "class", "svelte-w3ny0j"), h(s, "class", "svelte-w3ny0j"), h(x, "class", "svelte-w3ny0j"), _(x, "withdraw", "withdraw" === n[0].trans_type), h(E, "class", "svelte-w3ny0j"), h(M, "class", "svelte-w3ny0j"), h(w, "class", "svelte-w3ny0j"), h(P, "class", "svelte-w3ny0j"), h(e, "class", "transaction svelte-w3ny0j") }, m(t, n) { f(t, e, n), u(e, s), u(s, c), u(c, o), u(c, r), u(c, a), u(c, i), u(s, l), u(s, v), u(v, $), u(e, y), u(e, w), u(w, x), tt.m(x, null), u(x, j), u(x, k), u(w, z), u(w, E), u(E, T), u(w, L), u(w, M), u(M, N), u(M, S), u(M, C), u(M, O), u(M, U), u(e, A), u(e, P), u(P, V), u(P, B), u(P, I), u(P, Y), u(P, F) }, p(t, [n]) { 1 & n && Z !== (Z = t[0].title + "") && b(o, Z), 1 & n && R !== (R = t[0].trans_type.toUpperCase() + "") && b(a, R), 1 & n && W !== (W = t[0].trans_id + "") && b($, W), Q !== (Q = K(t)) && (tt.d(1), tt = Q(t), tt && (tt.c(), tt.m(x, j))), 1 & n && X !== (X = mt(t[0].amount) + "") && b(k, X), 1 & n && _(x, "withdraw", "withdraw" === t[0].trans_type), 1 & n && q !== (q = t[0].receiver + "") && b(T, q), 1 & n && H !== (H = t[0].time + "") && b(N, H), 1 & n && J !== (J = t[0].issuer + "") && b(U, J), 2 & n && D !== (D = t[1].message + "") && b(V, D), 1 & n && G !== (G = t[0].message + "") && b(F, G) }, i: t, o: t, d(t) { t && d(e), tt.d() } }
|
||||
}
|
||||
|
||||
function Mt(t, n, e) {
|
||||
let s;
|
||||
i(t, it, (t => e(1, s = t)));
|
||||
let { transaction: c } = n;
|
||||
return t.$$set = t => { "transaction" in t && e(0, c = t.transaction) }, [c, s]
|
||||
}
|
||||
class Nt extends D { constructor(t) { super(), J(this, t, Mt, Lt, o, { transaction: 0 }) } }
|
||||
|
||||
function St(t, n, e) { const s = t.slice(); return s[4] = n[e], s }
|
||||
|
||||
function Ct(n) { let e, s = n[1].select_account + ""; return { c() { e = m(s) }, m(t, n) { f(t, e, n) }, p(t, n) { 2 & n && s !== (s = t[1].select_account + "") && b(e, s) }, i: t, o: t, d(t) { t && d(e) } } }
|
||||
|
||||
function Ot(t) {
|
||||
let n, e, s = [],
|
||||
c = new Map,
|
||||
o = t[0].transactions;
|
||||
const r = t => t[4].trans_id;
|
||||
for (let n = 0; n < o.length; n += 1) {
|
||||
let e = St(t, o, n),
|
||||
a = r(e);
|
||||
c.set(a, s[n] = Ut(a, e))
|
||||
}
|
||||
return {
|
||||
c() {
|
||||
for (let t = 0; t < s.length; t += 1) s[t].c();
|
||||
n = v()
|
||||
},
|
||||
m(t, c) {
|
||||
for (let n = 0; n < s.length; n += 1) s[n].m(t, c);
|
||||
f(t, n, c), e = !0
|
||||
},
|
||||
p(t, e) { 1 & e && (o = t[0].transactions, B(), s = R(s, e, r, 1, t, o, c, n.parentNode, Z, Ut, n, St), I()) },
|
||||
i(t) {
|
||||
if (!e) {
|
||||
for (let t = 0; t < o.length; t += 1) Y(s[t]);
|
||||
e = !0
|
||||
}
|
||||
},
|
||||
o(t) {
|
||||
for (let t = 0; t < s.length; t += 1) F(s[t]);
|
||||
e = !1
|
||||
},
|
||||
d(t) {
|
||||
for (let n = 0; n < s.length; n += 1) s[n].d(t);
|
||||
t && d(n)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function Ut(t, n) {
|
||||
let e, s, c;
|
||||
return s = new Nt({ props: { transaction: n[4] } }), {
|
||||
key: t,
|
||||
first: null,
|
||||
c() { e = v(), W(s.$$.fragment), this.first = e },
|
||||
m(t, n) { f(t, e, n), X(s, t, n), c = !0 },
|
||||
p(t, e) {
|
||||
n = t;
|
||||
const c = {};
|
||||
1 & e && (c.transaction = n[4]), s.$set(c)
|
||||
},
|
||||
i(t) { c || (Y(s.$$.fragment, t), c = !0) },
|
||||
o(t) { F(s.$$.fragment, t), c = !1 },
|
||||
d(t) { t && d(e), q(s, t) }
|
||||
}
|
||||
}
|
||||
|
||||
function At(t) {
|
||||
let n, e, s, c, o, a, i, l, v, $, y, w, _, x, j, k, z = t[1].transactions + "",
|
||||
E = t[1].bank_name + "";
|
||||
const T = [Ot, Ct],
|
||||
L = [];
|
||||
|
||||
function M(t, n) { return t[0] ? 0 : 1 }
|
||||
return x = M(t), j = L[x] = T[x](t), {
|
||||
c() {
|
||||
var t, u;
|
||||
n = p("section"), e = p("h3"), s = p("span"), c = m(z), o = g(), a = p("div"), i = p("img"), v = g(), $ = p("span"), y = m(E), w = g(), _ = p("section"), j.c(), t = i.src, u = l = "./img/bank.png", r || (r = document.createElement("a")), r.href = u, t !== r.href && h(i, "src", "./img/bank.png"), h(i, "alt", "bang icon"), h(i, "class", "svelte-mhvyj0"), h(a, "class", "svelte-mhvyj0"), h(e, "class", "heading svelte-mhvyj0"), h(_, "class", "scroller"), h(n, "class", "transactions-container svelte-mhvyj0")
|
||||
},
|
||||
m(t, r) { f(t, n, r), u(n, e), u(e, s), u(s, c), u(e, o), u(e, a), u(a, i), u(a, v), u(a, $), u($, y), u(n, w), u(n, _), L[x].m(_, null), k = !0 },
|
||||
p(t, [n]) {
|
||||
(!k || 2 & n) && z !== (z = t[1].transactions + "") && b(c, z), (!k || 2 & n) && E !== (E = t[1].bank_name + "") && b(y, E);
|
||||
let e = x;
|
||||
x = M(t), x === e ? L[x].p(t, n) : (B(), F(L[e], 1, 1, (() => { L[e] = null })), I(), j = L[x], j ? j.p(t, n) : (j = L[x] = T[x](t), j.c()), Y(j, 1), j.m(_, null))
|
||||
},
|
||||
i(t) { k || (Y(j), k = !0) },
|
||||
o(t) { F(j), k = !1 },
|
||||
d(t) { t && d(n), L[x].d() }
|
||||
}
|
||||
}
|
||||
|
||||
function Pt(t, n, e) { let s, c, o, r; return i(t, ct, (t => e(2, c = t))), i(t, at, (t => e(3, o = t))), i(t, it, (t => e(1, r = t))), t.$$.update = () => { 12 & t.$$.dirty && e(0, s = o.find((t => c === t.id))) }, [s, r, c, o] }
|
||||
class Vt extends D { constructor(t) { super(), J(this, t, Pt, At, o, {}) } }
|
||||
|
||||
function Bt(t) {
|
||||
let n, e, s, c, o, r, a, i, l, v, $ = t[0].cash + "",
|
||||
y = t[1][0].cash + "";
|
||||
return s = new zt({}), o = new Vt({}), {
|
||||
c() { n = p("div"), e = p("section"), W(s.$$.fragment), c = g(), W(o.$$.fragment), r = g(), a = p("h5"), i = m($), l = m(y), h(e, "class", "svelte-xwmgc0"), h(a, "class", "svelte-xwmgc0"), h(n, "class", "main svelte-xwmgc0") },
|
||||
m(t, d) { f(t, n, d), u(n, e), X(s, e, null), u(e, c), X(o, e, null), u(n, r), u(n, a), u(a, i), u(a, l), v = !0 },
|
||||
p(t, [n]) {
|
||||
(!v || 1 & n) && $ !== ($ = t[0].cash + "") && b(i, $), (!v || 2 & n) && y !== (y = t[1][0].cash + "") && b(l, y)
|
||||
},
|
||||
i(t) { v || (Y(s.$$.fragment, t), Y(o.$$.fragment, t), v = !0) },
|
||||
o(t) { F(s.$$.fragment, t), F(o.$$.fragment, t), v = !1 },
|
||||
d(t) { t && d(n), q(s), q(o) }
|
||||
}
|
||||
}
|
||||
|
||||
function It(t, n, e) { let s, c; return i(t, it, (t => e(0, s = t))), i(t, at, (t => e(1, c = t))), [s, c] }
|
||||
class Yt extends D { constructor(t) { super(), J(this, t, It, Bt, o, {}) } }
|
||||
|
||||
function Ft(t) { let n, e, s, c, o, r, a, i = t[4].transfer + ""; return { c() { n = p("div"), e = p("label"), s = m(i), c = g(), o = p("input"), h(e, "for", "stateId"), h(e, "class", "svelte-1ou14c8"), h(o, "type", "text"), h(o, "name", "stateId"), h(o, "id", "stateId"), h(o, "placeholder", "#"), h(o, "class", "svelte-1ou14c8"), h(n, "class", "form-row svelte-1ou14c8") }, m(i, l) { f(i, n, l), u(n, e), u(e, s), u(n, c), u(n, o), w(o, t[2]), r || (a = $(o, "input", t[11]), r = !0) }, p(t, n) { 16 & n && i !== (i = t[4].transfer + "") && b(s, i), 4 & n && o.value !== t[2] && w(o, t[2]) }, d(t) { t && d(n), r = !1, a() } } }
|
||||
|
||||
function Zt(n) {
|
||||
let e, c, o, r, a, i, l, v, _, x, j, k, z, E, T, L, M, N, S, C, O, U, A, P, V, B, I, Y, F, Z, R = n[3].account.type + "",
|
||||
W = n[4].account + "",
|
||||
X = n[3].account.id + "",
|
||||
q = n[4].amount + "",
|
||||
H = n[4].comment + "",
|
||||
J = n[4].cancel + "",
|
||||
D = n[4].confirm + "",
|
||||
G = "transfer" === n[3].actionType && Ft(n);
|
||||
return { c() { e = p("section"), c = p("section"), o = p("h2"), r = m(R), a = m(W), i = m("/ "), l = m(X), v = g(), _ = p("form"), x = p("div"), j = p("label"), k = m(q), z = g(), E = p("input"), T = g(), L = p("div"), M = p("label"), N = m(H), S = g(), C = p("input"), O = g(), G && G.c(), U = g(), A = p("div"), P = p("button"), V = m(J), B = g(), I = p("button"), Y = m(D), h(o, "class", "svelte-1ou14c8"), h(j, "for", "amount"), h(j, "class", "svelte-1ou14c8"), h(E, "type", "number"), h(E, "name", "amount"), h(E, "id", "amount"), h(E, "placeholder", "0"), h(E, "class", "svelte-1ou14c8"), h(x, "class", "form-row svelte-1ou14c8"), h(M, "for", "comment"), h(M, "class", "svelte-1ou14c8"), h(C, "type", "text"), h(C, "name", "comment"), h(C, "id", "comment"), h(C, "placeholder", "Kommentar"), h(C, "class", "svelte-1ou14c8"), h(L, "class", "form-row svelte-1ou14c8"), h(P, "type", "button"), h(P, "class", "btn btn-orange"), h(I, "type", "button"), h(I, "class", "btn btn-green"), h(A, "class", "btns-group"), h(_, "action", "#"), h(c, "class", "popup-content svelte-1ou14c8"), h(e, "class", "popup-container svelte-1ou14c8") }, m(t, s) { f(t, e, s), u(e, c), u(c, o), u(o, r), u(o, a), u(o, i), u(o, l), u(c, v), u(c, _), u(_, x), u(x, j), u(j, k), u(x, z), u(x, E), w(E, n[0]), u(_, T), u(_, L), u(L, M), u(M, N), u(L, S), u(L, C), w(C, n[1]), u(_, O), G && G.m(_, null), u(_, U), u(_, A), u(A, P), u(P, V), u(A, B), u(A, I), u(I, Y), F || (Z = [$(E, "input", n[9]), $(C, "input", n[10]), $(P, "click", n[5]), $(I, "click", n[12])], F = !0) }, p(t, [n]) { 8 & n && R !== (R = t[3].account.type + "") && b(r, R), 16 & n && W !== (W = t[4].account + "") && b(a, W), 8 & n && X !== (X = t[3].account.id + "") && b(l, X), 16 & n && q !== (q = t[4].amount + "") && b(k, q), 1 & n && y(E.value) !== t[0] && w(E, t[0]), 16 & n && H !== (H = t[4].comment + "") && b(N, H), 2 & n && C.value !== t[1] && w(C, t[1]), "transfer" === t[3].actionType ? G ? G.p(t, n) : (G = Ft(t), G.c(), G.m(_, U)) : G && (G.d(1), G = null), 16 & n && J !== (J = t[4].cancel + "") && b(V, J), 16 & n && D !== (D = t[4].confirm + "") && b(Y, D) }, i: t, o: t, d(t) { t && d(e), G && G.d(), F = !1, s(Z) } }
|
||||
}
|
||||
|
||||
function Rt(t, n, e) {
|
||||
let s, c, o, r;
|
||||
i(t, rt, (t => e(3, s = t))), i(t, ct, (t => e(7, c = t))), i(t, at, (t => e(8, o = t))), i(t, it, (t => e(4, r = t)));
|
||||
let a = 0,
|
||||
l = "",
|
||||
u = "";
|
||||
|
||||
function f() { rt.update((t => Object.assign(Object.assign({}, t), { actionType: "" }))) }
|
||||
|
||||
function d() { et.set(!0), K(s.actionType, { fromAccount: s.account.id, amount: a, comment: l, stateid: u }).then((t => { setTimeout((() => {!1 !== t && at.set(t), et.set(!1) }), 1e3) })), f() }
|
||||
return t.$$.update = () => { 384 & t.$$.dirty && o.find((t => c === t.id)) }, [a, l, u, s, r, f, d, c, o, function() { a = y(this.value), e(0, a) }, function() { l = this.value, e(1, l) }, function() { u = this.value, e(2, u) }, () => d()]
|
||||
}
|
||||
class Wt extends D { constructor(t) { super(), J(this, t, Rt, Zt, o, {}) } }
|
||||
|
||||
function Xt(n) { let e; return { c() { e = p("section"), e.innerHTML = '<section class="loading-content svelte-1ao9gz5"><div class="loading-spinner svelte-1ao9gz5"><div class="svelte-1ao9gz5"></div> \n <div class="svelte-1ao9gz5"></div> \n <div class="svelte-1ao9gz5"></div> \n <div class="svelte-1ao9gz5"></div> \n <div class="svelte-1ao9gz5"></div> \n <div class="svelte-1ao9gz5"></div> \n <div class="svelte-1ao9gz5"></div> \n <div class="svelte-1ao9gz5"></div> \n <div class="svelte-1ao9gz5"></div> \n <div class="svelte-1ao9gz5"></div> \n <div class="svelte-1ao9gz5"></div> \n <div class="svelte-1ao9gz5"></div></div></section>', h(e, "class", "loading-container svelte-1ao9gz5") }, m(t, n) { f(t, e, n) }, p: t, i: t, o: t, d(t) { t && d(e) } } }
|
||||
class qt extends D { constructor(t) { super(), J(this, t, null, Xt, o, {}) } }
|
||||
|
||||
function Ht(n) {
|
||||
let e, s, c, o, r, a;
|
||||
return {
|
||||
c() {
|
||||
var t, i, l, u;
|
||||
e = p("section"), s = p("section"), c = p("i"), o = g(), r = p("strong"), a = m(n[0]), h(c, "class", "start-icon fa fa-info-circle faa-shake animated fa-2x"), h(r, "class", "font__weight-bold"), t = r, i = "font-size", null === (l = "0.69vw") ? t.style.removeProperty(i) : t.style.setProperty(i, l, u ? "important" : ""), h(s, "class", "notificaion-content svelte-aywcjm"), h(e, "class", "notificaion-container svelte-aywcjm")
|
||||
},
|
||||
m(t, n) { f(t, e, n), u(e, s), u(s, c), u(s, o), u(s, r), u(r, a) },
|
||||
p(t, [n]) { 1 & n && b(a, t[0]) },
|
||||
i: t,
|
||||
o: t,
|
||||
d(t) { t && d(e) }
|
||||
}
|
||||
}
|
||||
|
||||
function Jt(t, n, e) { let s; return i(t, st, (t => e(0, s = t))), [s] }
|
||||
class Dt extends D { constructor(t) { super(), J(this, t, Jt, Ht, o, {}) } }
|
||||
|
||||
function Gt(t) { let n, e; return n = new Wt({}), { c() { W(n.$$.fragment) }, m(t, s) { X(n, t, s), e = !0 }, i(t) { e || (Y(n.$$.fragment, t), e = !0) }, o(t) { F(n.$$.fragment, t), e = !1 }, d(t) { q(n, t) } } }
|
||||
|
||||
function Kt(t) { let n, e; return n = new Dt({}), { c() { W(n.$$.fragment) }, m(t, s) { X(n, t, s), e = !0 }, i(t) { e || (Y(n.$$.fragment, t), e = !0) }, o(t) { F(n.$$.fragment, t), e = !1 }, d(t) { q(n, t) } } }
|
||||
|
||||
function Qt(t) {
|
||||
let n, e, s, c, o;
|
||||
n = new Yt({});
|
||||
let r = "" !== t[0].actionType && Gt(),
|
||||
a = "" !== t[1] && Kt();
|
||||
return { c() { W(n.$$.fragment), e = g(), r && r.c(), s = g(), a && a.c(), c = v() }, m(t, i) { X(n, t, i), f(t, e, i), r && r.m(t, i), f(t, s, i), a && a.m(t, i), f(t, c, i), o = !0 }, p(t, n) { "" !== t[0].actionType ? r ? 1 & n && Y(r, 1) : (r = Gt(), r.c(), Y(r, 1), r.m(s.parentNode, s)) : r && (B(), F(r, 1, 1, (() => { r = null })), I()), "" !== t[1] ? a ? 2 & n && Y(a, 1) : (a = Kt(), a.c(), Y(a, 1), a.m(c.parentNode, c)) : a && (B(), F(a, 1, 1, (() => { a = null })), I()) }, i(t) { o || (Y(n.$$.fragment, t), Y(r), Y(a), o = !0) }, o(t) { F(n.$$.fragment, t), F(r), F(a), o = !1 }, d(t) { q(n, t), t && d(e), r && r.d(t), t && d(s), a && a.d(t), t && d(c) } }
|
||||
}
|
||||
|
||||
function tn(t) { let n, e; return n = new qt({}), { c() { W(n.$$.fragment) }, m(t, s) { X(n, t, s), e = !0 }, i(t) { e || (Y(n.$$.fragment, t), e = !0) }, o(t) { F(n.$$.fragment, t), e = !1 }, d(t) { q(n, t) } } }
|
||||
|
||||
function nn(t) {
|
||||
let n, e, s, c, o, r;
|
||||
s = new pt({ props: { $$slots: { default: [Qt] }, $$scope: { ctx: t } } });
|
||||
let a = t[2] && tn();
|
||||
return {
|
||||
c() { n = p("link"), e = g(), W(s.$$.fragment), c = g(), a && a.c(), o = v(), h(n, "rel", "stylesheet"), h(n, "href", "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.2/css/all.min.css"), h(n, "integrity", "sha512-1sCRPdkRXhBV2PBLUdRb4tMg1w2YPf37qatUFeS7zlBy7jJI8Lf4VHwWfZZfpXtYSLy85pkm9GaYVYMfw5BC1A=="), h(n, "crossorigin", "anonymous"), h(n, "referrerpolicy", "no-referrer") },
|
||||
m(t, i) { u(document.head, n), f(t, e, i), X(s, t, i), f(t, c, i), a && a.m(t, i), f(t, o, i), r = !0 },
|
||||
p(t, [n]) {
|
||||
const e = {};
|
||||
11 & n && (e.$$scope = { dirty: n, ctx: t }), s.$set(e), t[2] ? a ? 4 & n && Y(a, 1) : (a = tn(), a.c(), Y(a, 1), a.m(o.parentNode, o)) : a && (B(), F(a, 1, 1, (() => { a = null })), I())
|
||||
},
|
||||
i(t) { r || (Y(s.$$.fragment, t), Y(a), r = !0) },
|
||||
o(t) { F(s.$$.fragment, t), F(a), r = !1 },
|
||||
d(t) { d(n), t && d(e), q(s, t), t && d(c), a && a.d(t), t && d(o) }
|
||||
}
|
||||
}
|
||||
|
||||
function en(t, n, e) { let s, c, o; return i(t, rt, (t => e(0, s = t))), i(t, st, (t => e(1, c = t))), i(t, et, (t => e(2, o = t))), gt([{ action: "setVisible", data: !0 }]), [s, c, o] }
|
||||
return new class extends D { constructor(t) { super(), J(this, t, en, nn, o, {}) } }({ target: document.body })
|
||||
}();
|
||||
//# sourceMappingURL=bundle.js.map
|
File diff suppressed because one or more lines are too long
125
resources/[renewed]/Renewed-Banking/web/public/global.css
Normal file
125
resources/[renewed]/Renewed-Banking/web/public/global.css
Normal file
@ -0,0 +1,125 @@
|
||||
:root {
|
||||
--clr-primary: #1e3956;
|
||||
--clr-primary-light: #2e475d;
|
||||
--clr-primary-dark: transparant;
|
||||
--clr-green: #93f074;
|
||||
--clr-orange: #f5a067;
|
||||
--clr-grey: #dfe1d6;
|
||||
--font-family: "Roboto", sans-serif;
|
||||
}
|
||||
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
a,
|
||||
img,
|
||||
button,
|
||||
input,
|
||||
label,
|
||||
select,
|
||||
span,
|
||||
i {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
a {
|
||||
text-decoration: none;
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
ul {
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
html {
|
||||
font-size: 62.5%;
|
||||
}
|
||||
|
||||
body {
|
||||
min-height: 100vh;
|
||||
font-family: var(--font-family);
|
||||
background-color: var(--clr-primary-dark);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
h3.heading {
|
||||
font-size: 1.7rem;
|
||||
margin-bottom: 2.2rem;
|
||||
/*margin-left: 2%;*/
|
||||
}
|
||||
|
||||
.btn {
|
||||
text-decoration: none;
|
||||
text-transform: uppercase;
|
||||
border: none;
|
||||
border-radius: 5px;
|
||||
cursor: pointer;
|
||||
font-size: 1rem;
|
||||
padding: 0.6rem 1rem;
|
||||
transition: 0.25s;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.btn-grey {
|
||||
background-color: var(--clr-grey);
|
||||
border: 2px solid var(--clr-grey);
|
||||
}
|
||||
|
||||
.btn-orange {
|
||||
background-color: var(--clr-orange);
|
||||
border: 2px solid var(--clr-orange);
|
||||
}
|
||||
|
||||
.btn-green {
|
||||
background-color: var(--clr-green);
|
||||
border: 2px solid var(--clr-green);
|
||||
}
|
||||
|
||||
.btn-grey:is(:hover, :focus, :focus-within) {
|
||||
color: #000;
|
||||
border: 2px solid #51515183;
|
||||
background-color: var(--clr-grey);
|
||||
}
|
||||
|
||||
.btn-orange:is(:hover, :focus, :focus-within) {
|
||||
background-color: var(--clr-orange);
|
||||
color: #000;
|
||||
border: 2px solid #51515183;
|
||||
}
|
||||
|
||||
.btn-green:is(:hover, :focus, :focus-within) {
|
||||
background-color: var(--clr-green);
|
||||
color: #000;
|
||||
border: 2px solid #51515183;
|
||||
}
|
||||
|
||||
.scroller {
|
||||
--size: 3rem;
|
||||
overflow-y: scroll;
|
||||
margin: auto 0;
|
||||
height: calc(100% - 10rem);
|
||||
margin-top: calc(var(--size) / 2);
|
||||
}
|
||||
|
||||
.scroller::-webkit-scrollbar {
|
||||
display: none;
|
||||
}
|
||||
|
||||
|
||||
/* Hide scrollbar for IE, Edge and Firefox */
|
||||
|
||||
.scroller {
|
||||
-ms-overflow-style: none;
|
||||
/* IE and Edge */
|
||||
scrollbar-width: none;
|
||||
/* Firefox */
|
||||
}
|
BIN
resources/[renewed]/Renewed-Banking/web/public/img/bank.png
Normal file
BIN
resources/[renewed]/Renewed-Banking/web/public/img/bank.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.4 KiB |
23
resources/[renewed]/Renewed-Banking/web/public/index.html
Normal file
23
resources/[renewed]/Renewed-Banking/web/public/index.html
Normal file
@ -0,0 +1,23 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1" />
|
||||
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
||||
<link
|
||||
href="https://fonts.googleapis.com/css2?family=Roboto:wght@100;300;400;500;700;900&display=swap"
|
||||
rel="stylesheet"
|
||||
/>
|
||||
|
||||
<link rel="stylesheet" href="./global.css" />
|
||||
<link rel="stylesheet" href="./build/bundle.css" />
|
||||
|
||||
<script defer src="./build/bundle.js"></script>
|
||||
|
||||
<title>Svelte app</title>
|
||||
</head>
|
||||
|
||||
<body></body>
|
||||
</html>
|
674
resources/[renewed]/Renewed-Weaponscarry/LICENSE
Normal file
674
resources/[renewed]/Renewed-Weaponscarry/LICENSE
Normal file
@ -0,0 +1,674 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
94
resources/[renewed]/Renewed-Weaponscarry/README.md
Normal file
94
resources/[renewed]/Renewed-Weaponscarry/README.md
Normal file
@ -0,0 +1,94 @@
|
||||
# Renewed Weapons and Carry Script
|
||||
<a href='https://ko-fi.com/FjamZoo' target='_blank'><img height='35' style='border:0px;height:46px;' src='https://az743702.vo.msecnd.net/cdn/kofi3.png?v=0' border='0' alt='Buy Me a Coffee at ko-fi.com' />
|
||||
</a>
|
||||
|
||||
[Renewed Discord](https://discord.gg/P3RMrbwA8n)
|
||||
|
||||
# Description
|
||||
|
||||
Welcome to Renewed Weapons and Carry Script, this script allows user to define Player slots when it comes to weapons / items on the players back along with a few other features such as.
|
||||
|
||||
Carrying items that can affect how the player reacts such as stopping them from sprint, getting in vehicles and much more!
|
||||
|
||||
[Preview](https://streamable.com/deh7tk)
|
||||
|
||||
# How to install
|
||||
Step 3 and 4 are skippable if you do not use qb-apartments or dont use qb-apartments with routing buckets
|
||||
|
||||
1. Download the latest version of the script
|
||||
2. Extract the files to your server root directory
|
||||
3. Head over to your qb-apartments and add this `exports['Renewed-Weaponscarry']:toggleProps()` to line 256 right under Wait(250) in the function EnterApartment
|
||||
4. Now scroll down till you find `local function LeaveApartment` and past this right under it around line 317 `exports['Renewed-Weaponscarry']:toggleProps()`
|
||||
5. Add the following line to your server.cfg file `ensure Renewed-Weaponscarry`
|
||||
6. ENJOY!
|
||||
|
||||
# Additional Information // Exports
|
||||
|
||||
1. `exports["Renewed-Weaponscarry"]:GetPlayerCarryItems()` - Returns a table of all the items the player is carrying
|
||||
|
||||
2. `exports["Renewed-Weaponscarry"]:toggleProps()` - Toggles the props for the player and wont load them untill they are toggled back on OR if they are in their apartments
|
||||
|
||||
3. `exports["Renewed-Weaponscarry"]:refreshProps()` - Refreshes the props for the player toggle this at at the END of your refreshskin events to make sure the props get removed and refreshed the proper way
|
||||
|
||||
4. `exports["Renewed-Weaponscarry"]:isCarryingObject()` - Returns true if the player is carrying an any item
|
||||
|
||||
5. `exports["Renewed-Weaponscarry"]:makeObjectBusy(item, toggle)` - This acts as if the particular item was removed or used by the player, this is useful for items that can be used multiple times such as a fishing rod, this would allow the player to when they start using the rod for it to be removed on the back untill they are done using it
|
||||
|
||||
6. `exports["Renewed-Weaponscarry"]:carryProp(item)` - Acts as if the player was given x item to carry, this DOES NOT work with weapons on back ONLY CARRYABLE items
|
||||
|
||||
7. `exports["Renewed-Weaponscarry"]:removeProp(item)` - Acts as if x item was removed from the player, this DOES NOT work with weapons on back ONLY CARRYABLE items
|
||||
|
||||
8. `exports["Renewed-Weaponscarry"]:isCarryingAnObject(item)` - Returns true if the players is carrying a specific item
|
||||
|
||||
# How to add new Items
|
||||
|
||||
Here's everything you need to know about adding new items to the script
|
||||
|
||||
## Creating a new Player Slot
|
||||
First off you would need to create a new player slot, this is done by adding a new line to the `local PlayerSlots` table, here's an example of how it would look like
|
||||
|
||||
```lua
|
||||
[6] = { -- More contraband that will be on a player somewhere
|
||||
[1] = {bone = 24817, x = -0.38, y = -0.24, z = 0.15, xr = 0.0, yr = 92.0, zr = -13.0},
|
||||
[2] = {bone = 24817, x = -0.37, y = -0.24, z = 0.15, xr = 0.0, yr = 92.0, zr = 13.0},
|
||||
},
|
||||
|
||||
x = the x position of the Players Slot, y = y etc. you get the idea.
|
||||
It can be quite hard to get the actual placements I have used this one and I would highly recommend it
|
||||
https://forum.cfx.re/t/paid-dev-tool-prop-attach-to-ped-tool/4782266
|
||||
```
|
||||
|
||||
Note that this is actually not real placements just a showcase of how its done
|
||||
|
||||
## Adding a new Weapon
|
||||
Here you must have have a PlayerSlot thats ready and defined heres an example of how to add a new weapon, in this case I will use player slot number 1 which is used for bigger weapons that should stick out of the players back.
|
||||
|
||||
```lua
|
||||
["weapon_rpg"] = { model = "w_lr_rpg", hash = joaat("w_lr_rpg"), tier = 1},
|
||||
```
|
||||
|
||||
The name in the brackets is the actual name of the weapon thats in your shared. The model name is the name of the model of the gun in this case I found a RPG model. The hash is the hash of the weapon, and the tier is the player slot it should be in, in this case 1
|
||||
|
||||
If the prop for some reason do not fit the slot you can add a custom offset by adding x = smt or y = smt or z = smt or xr = smt or yr = smt or zr = smt, just depends on how the rotation of the item you are trying to add is different from the other items in the slot.
|
||||
|
||||
## Adding a new Carryable Item
|
||||
Here's how you add a new item to be Carryable, in this demonstration I used a oil barrel that can be used to whatever you would want or just as a cool prop to hold.
|
||||
|
||||
```lua
|
||||
["oil_barrel"] = { carry = true, model = "prop_barrel_exp_01a", bone = 28422, x = 0.01, y = -0.27, z = 0.27, xr = 3.0, yr = 0.0, zr = 0.0, blockAttack = true, blockCar = true, blockRun = true, dict = "anim@heists@box_carry@", anim = "idle" },
|
||||
|
||||
If an item you want to carry then make sure it says carry = true.
|
||||
The model is the model of the item you want to carry, in this case I used a oil barrel.
|
||||
The bone is the bone you want the item to be attached to, in this case I used the bone 28422
|
||||
the xyr and xr yr zr are all the cordinates and rotations which you can find by using the tool above.
|
||||
blockAttack = true means that the player will not be able to attack while carrying this item
|
||||
blockCar = true means that the player will not be able to get in a vehicle while carrying this item
|
||||
blockRun = true means that the player will not be able to run or jump while carrying this item
|
||||
dict = Optional. If not set, will request the default directory
|
||||
anim = Optional. If not set, will play the default animation. If set to "none", will not play an animation.
|
||||
```
|
||||
|
||||
|
||||
### Misc Information.
|
||||
How to locate the different props I normally use this website: https://forge.plebmasters.de/
|
||||
For bones its either trial or error with the tool above or you can use this website: https://wiki.rage.mp/index.php?title=Bones
|
618
resources/[renewed]/Renewed-Weaponscarry/client/main.lua
Normal file
618
resources/[renewed]/Renewed-Weaponscarry/client/main.lua
Normal file
@ -0,0 +1,618 @@
|
||||
local QBCore = exports['qb-core']:GetCoreObject()
|
||||
|
||||
--[[
|
||||
This is PlayerSlots here we define the Category of the weapons that goes on the Player
|
||||
This means that instead of giving each weapon a designated slot on the back, we can just add a weapon with the designated slot
|
||||
This will also allow for weapons to feel and look more natural when added.
|
||||
|
||||
All items that go on your back -> MUST have a SLOT CATEGORY, everything that we CARRY must have Carry = true
|
||||
]]
|
||||
local PlayerSlots = {
|
||||
[1] = { -- Bigger weapons such as bats, crowbars, Assaultrifles, and also good place for wet weed.
|
||||
[1] = { bone = 24817, x = 0.04, y = -0.15, z = 0.12, xr = 0.0, yr = 0.0, zr = 0.0, isBusy = false },
|
||||
[2] = { bone = 24817, x = 0.04, y = -0.17, z = 0.02, xr = 0.0, yr = 0.0, zr = 0.0, isBusy = false },
|
||||
[3] = { bone = 24817, x = 0.04, y = -0.15, z = -0.12, xr = 0.0, yr = 0.0, zr = 0.0, isBusy = false },
|
||||
},
|
||||
|
||||
[2] = { -- Use this for katana knives etc. stuff that goes sideways on the players body
|
||||
[1] = { bone = 24817, x = -0.13, y = -0.16, z = -0.14, xr = 5.0, yr = 62.0, zr = 0.0, isBusy = false },
|
||||
[2] = { bone = 24817, x = -0.13, y = -0.15, z = 0.10, xr = 5.0, yr = 124.0, zr = 0.0, isBusy = false },
|
||||
},
|
||||
|
||||
[3] = { -- Contraband like Drugs and shit
|
||||
[1] = { bone = 24817, x = -0.28, y = -0.14, z = 0.15, xr = 0.0, yr = 92.0, zr = -13.0 },
|
||||
[2] = { bone = 24817, x = -0.27, y = -0.14, z = 0.15, xr = 0.0, yr = 92.0, zr = 13.0 },
|
||||
},
|
||||
|
||||
[4] = { -- I use this for the pelts for hunting
|
||||
[1] = { bone = 24817, x = -0.18, y = -0.26, z = -0.02, xr = 0.0, yr = 91.0, zr = 5.0 },
|
||||
[2] = { bone = 24817, x = 0.10, y = -0.26, z = -0.02, xr = 0.0, yr = 91.0, zr = 5.0 },
|
||||
[3] = { bone = 24817, x = 0.38, y = -0.21, z = -0.02, xr = 0.0, yr = 91.0, zr = 5.0 },
|
||||
},
|
||||
|
||||
[5] = { -- I use this for chains, make sure your CHAIN is a CUSTOM prop, will NOT work with a clothing item, if you want to add a CHAIN make sure to have a chain = true as it will not work the same as weapons --
|
||||
[1] = { bone = 10706, x = 0.11, y = 0.080, z = -0.473, xr = -366.0, yr = 19.0, zr = -163.0 },
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
|
||||
-- Add your items here --
|
||||
local props = {
|
||||
---- ** Drugs ** ----
|
||||
-- Weed
|
||||
["wetbud"] = { model = "bkr_prop_weed_drying_02a", hash = joaat("bkr_prop_weed_drying_02a"), tier = 1, yr = 90.0 }, -- This is more of an item that deserves a
|
||||
|
||||
-- meth
|
||||
["meth"] = { model = "hei_prop_pill_bag_01", hash = joaat("hei_prop_pill_bag_01"), tier = 3 },
|
||||
|
||||
["pack1"] = { carry = true, model = "prop_cs_box_clothes", bone = 28422, x = 0.01, y = -0.02, z = -0.14, xr = 0.0, yr = 0.0, zr = 0.0, blockAttack = true, blockCar = true, blockRun = true},
|
||||
["pack2"] = { carry = true, model = "prop_cs_cardbox_01", bone = 28422, x = 0.01, y = -0.02, z = -0.12, xr = 0.0, yr = 0.0, zr = 0.0, blockAttack = true, blockCar = true, blockRun = true},
|
||||
["pack3"] = { carry = true, model = "prop_hat_box_06", bone = 28422, x = 0.01, y = -0.02, z = -0.17, xr = 0.0, yr = 0.0, zr = -90.0, blockAttack = true, blockCar = true, blockRun = true},
|
||||
|
||||
-- Contraband
|
||||
["markedbills"] = { model = "prop_money_bag_01", hash = joaat("prop_money_bag_01"), tier = 3, x = -0.47, zr = 0 }, -- If you put any x,y,z,xr,yr,zr it will offset it from the slots to make it fit perfectly
|
||||
|
||||
-- Custom Weapons Tier 1
|
||||
-- ["weapon_assaultrifle"] = { model = "w_ar_assaultrifle", hash = joaat("weapon_assaultrifle"), tier = 1 },
|
||||
-- ["weapon_carbinerifle"] = { model = "w_ar_carbinerifle", hash = joaat("weapon_carbinerifle"), tier = 1 },
|
||||
-- ["weapon_advancedrifle"] = { model = "w_ar_advancedrifle", hash = joaat("weapon_advancedrifle"), tier = 1 },
|
||||
-- ["weapon_combatpdw"] = { model = "w_sb_mpx", hash = joaat("weapon_combatpdw"), tier = 1 },
|
||||
-- ["weapon_compactrifle"] = { model = "w_ar_draco", hash = joaat("weapon_compactrifle"), tier = 1 },
|
||||
-- ["weapon_m4"] = { model = "w_ar_m4", hash = joaat("weapon_m4"), tier = 1 },
|
||||
|
||||
|
||||
-- tier2
|
||||
-- ["weapon_bats"] = { model = "w_me_baseball_bat_barbed", hash = joaat("weapon_bats"), tier = 2 },
|
||||
-- ["weapon_katana"] = { model = "katana_sheath", hash = joaat("weapon_katana"), tier = 2, zr = -90.0, xr = -40.0,
|
||||
-- y = -0.14, x = 0.2, z = -0.08 },
|
||||
-- ["weapon_golfclub"] = { model = "w_me_gclub", hash = joaat("weapon_golfclub"), tier = 2 },
|
||||
-- ["weapon_battleaxe"] = { model = "w_me_battleaxe", hash = joaat("weapon_battleaxe"), tier = 2 },
|
||||
-- ["weapon_crowbar"] = { model = "w_me_crowbar", hash = joaat("weapon_crowbar"), tier = 2 },
|
||||
-- ["weapon_wrench"] = { model = "w_me_wrench", hash = joaat("weapon_wrench"), tier = 2 },
|
||||
|
||||
-- These Utilize the NoPixel pelts from their packages get them here: https://3dstore.nopixel.net/package/5141816 --
|
||||
["deer_pelt_1"] = { model = "hunting_pelt_01_a", hash = joaat("hunting_pelt_01_a"), tier = 4 },
|
||||
["deer_pelt_2"] = { model = "hunting_pelt_01_b", hash = joaat("hunting_pelt_01_b"), tier = 4 },
|
||||
["deer_pelt_3"] = { model = "hunting_pelt_01_c", hash = joaat("hunting_pelt_01_c"), tier = 4 },
|
||||
|
||||
|
||||
-- I use these for my house robbery when they steal the objects --
|
||||
["telescope"] = { carry = true, model = "prop_t_telescope_01b", bone = 24817, x = -0.23, y = 0.43, z = 0.05,
|
||||
xr = -10.0, yr = 93.0, zr = 0.0, blockAttack = true, blockCar = true, blockRun = true, },
|
||||
["pcequipment"] = { carry = true, model = "prop_dyn_pc_02", bone = 24817, x = 0.09, y = 0.43, z = 0.05, xr = 91.0,
|
||||
yr = 0.0, zr = -265.0, blockAttack = true, blockCar = true, blockRun = true },
|
||||
["coffeemaker"] = { carry = true, model = "prop_coffee_mac_02", bone = 24817, x = 0.00, y = 0.43, z = 0.05,
|
||||
xr = 91.0, yr = 0.0, zr = -265.0, blockAttack = true, blockCar = true, blockRun = true },
|
||||
["musicequipment"] = { carry = true, model = "prop_speaker_06", bone = 24817, x = 0.00, y = 0.43, z = 0.05, xr = 91.0,
|
||||
yr = 0.0, zr = -265.0, blockAttack = true, blockCar = true, blockRun = true },
|
||||
["microwave"] = { carry = true, model = "prop_microwave_1", bone = 24817, x = -0.20, y = 0.43, z = 0.05, xr = 91.0,
|
||||
yr = 0.0, zr = -265.0, blockAttack = true, blockCar = true, blockRun = true },
|
||||
|
||||
}
|
||||
|
||||
local items_attatched = {}
|
||||
local itemSlots = {}
|
||||
local override = false
|
||||
|
||||
local PlayerData = QBCore.Functions.GetPlayerData()
|
||||
|
||||
local FullyLoaded = LocalPlayer.state.isLoggedIn
|
||||
|
||||
|
||||
|
||||
local function loadmodel(hash)
|
||||
if HasModelLoaded(hash) then return end
|
||||
RequestModel(hash)
|
||||
while not HasModelLoaded(hash) do
|
||||
Wait(0)
|
||||
end
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
-- ** Weapon Functions ** --
|
||||
|
||||
|
||||
local function getFreeSlot(tier)
|
||||
local amount = 0
|
||||
|
||||
for i = 1, #PlayerSlots[tier] do
|
||||
if not PlayerSlots[tier][i].isBusy then
|
||||
amount = amount + 1
|
||||
end
|
||||
end
|
||||
|
||||
return amount
|
||||
end
|
||||
|
||||
local function UseSlot(tier)
|
||||
local slot = nil
|
||||
for i = 1, #PlayerSlots[tier] do
|
||||
if not PlayerSlots[tier][i].isBusy then
|
||||
PlayerSlots[tier][i].isBusy = true
|
||||
slot = i
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
return slot
|
||||
end
|
||||
|
||||
local function calcOffsets(x, y, z, xr, yr, zr, item)
|
||||
local X, Y, Z, XR, YR, ZR = x, y, z, xr, yr, zr
|
||||
|
||||
if props[item].x then
|
||||
X = props[item].x
|
||||
end
|
||||
|
||||
if props[item].y then
|
||||
Y = props[item].y
|
||||
end
|
||||
|
||||
if props[item].z then
|
||||
Z = props[item].z
|
||||
end
|
||||
|
||||
if props[item].xr then
|
||||
XR = props[item].xr
|
||||
end
|
||||
|
||||
|
||||
if props[item].yr then
|
||||
YR = props[item].yr
|
||||
end
|
||||
|
||||
if props[item].zr then
|
||||
ZR = props[item].zr
|
||||
end
|
||||
|
||||
return X, Y, Z, XR, YR, ZR
|
||||
end
|
||||
|
||||
local function AttachWeapon(attachModel, modelHash, tier, item)
|
||||
local hash = joaat(attachModel)
|
||||
local slot = UseSlot(tier)
|
||||
if not slot then return end
|
||||
|
||||
local v = PlayerSlots[tier][slot]
|
||||
local bone = GetPedBoneIndex(PlayerPedId(), v.bone)
|
||||
|
||||
loadmodel(hash)
|
||||
|
||||
items_attatched[attachModel] = {
|
||||
hash = modelHash,
|
||||
handle = CreateObject(attachModel, 1.0, 1.0, 1.0, true, true, false),
|
||||
slot = slot,
|
||||
tier = tier
|
||||
}
|
||||
|
||||
local x, y, z, xr, yr, zr = calcOffsets(v.x, v.y, v.z, v.xr, v.yr, v.zr, item)
|
||||
|
||||
AttachEntityToEntity(items_attatched[attachModel].handle, PlayerPedId(), bone, x, y, z, xr, yr, zr, 1, 1, 0, 0, 2, 1)
|
||||
SetModelAsNoLongerNeeded(hash)
|
||||
SetEntityCompletelyDisableCollision(items_attatched[attachModel].handle, false, true)
|
||||
end
|
||||
|
||||
local WeapDelete = false
|
||||
local function DeleteWeapon(item)
|
||||
local ped = PlayerPedId()
|
||||
local hash = items_attatched[item].hash
|
||||
if WeapDelete then return end
|
||||
|
||||
WeapDelete = true
|
||||
local wait = 0 -- if above 3 seconds then return this function
|
||||
while GetSelectedPedWeapon(ped) ~= hash do
|
||||
Wait(100)
|
||||
wait = wait + 1
|
||||
if wait >= 30 then return end -- If they figure out a way to spam then this we just return the function
|
||||
end
|
||||
|
||||
if items_attatched[item] then
|
||||
|
||||
DeleteObject(items_attatched[item].handle)
|
||||
|
||||
if items_attatched[item].slot then
|
||||
PlayerSlots[items_attatched[item].tier][items_attatched[item].slot].isBusy = false
|
||||
end
|
||||
|
||||
items_attatched[item] = nil
|
||||
|
||||
end
|
||||
WeapDelete = false
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
local carryingBox = nil
|
||||
|
||||
local function requestAnimDict(animDict)
|
||||
if not HasAnimDictLoaded(animDict) then
|
||||
RequestAnimDict(animDict)
|
||||
|
||||
while not HasAnimDictLoaded(animDict) do
|
||||
Wait(0)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function doAnim(item)
|
||||
if carryingBox then return end -- Only allow the function to be run once at a time
|
||||
carryingBox = item
|
||||
local ped = PlayerPedId()
|
||||
local dict, anim = props[item].dict or 'anim@heists@box_carry@', props[item].anim or 'idle'
|
||||
if not anim or not dict then return end
|
||||
|
||||
requestAnimDict(dict)
|
||||
CreateThread(function()
|
||||
while carryingBox do
|
||||
if not IsEntityPlayingAnim(ped, dict, anim, 3) then
|
||||
TaskPlayAnim(ped, dict, anim, 8.0, -8, -1, 49, 0, 0, 0, 0)
|
||||
end
|
||||
|
||||
if props[carryingBox].blockAttack then
|
||||
DisableControlAction(0, 24, true) -- disable attack
|
||||
DisableControlAction(0, 25, true) -- disable aim
|
||||
DisableControlAction(0, 47, true) -- disable weapon
|
||||
DisableControlAction(0, 58, true) -- disable weapon
|
||||
DisableControlAction(0, 263, true) -- disable melee
|
||||
DisableControlAction(0, 264, true) -- disable melee
|
||||
DisableControlAction(0, 257, true) -- disable melee
|
||||
DisableControlAction(0, 140, true) -- disable melee
|
||||
DisableControlAction(0, 141, true) -- disable melee
|
||||
DisableControlAction(0, 142, true) -- disable melee
|
||||
DisableControlAction(0, 143, true) -- disable melee
|
||||
end
|
||||
|
||||
if props[carryingBox].blockCar and IsPedGettingIntoAVehicle(ped) then
|
||||
ClearPedTasksImmediately(ped) -- Stops all tasks for the ped
|
||||
end
|
||||
|
||||
if props[carryingBox].blockRun then
|
||||
DisableControlAction(0, 22, true) -- disable jumping
|
||||
DisableControlAction(0, 21, true) -- disable sprinting
|
||||
end
|
||||
|
||||
Wait(1)
|
||||
end
|
||||
|
||||
ClearPedTasks(ped)
|
||||
end)
|
||||
end
|
||||
|
||||
local function AttatchProp(item)
|
||||
if carryingBox then return end
|
||||
local ped = PlayerPedId()
|
||||
local attachModel = props[item].model
|
||||
local hash = joaat(props[item].model)
|
||||
local bone = GetPedBoneIndex(ped, props[item].bone)
|
||||
SetCurrentPedWeapon(ped, 0xA2719263)
|
||||
loadmodel(hash)
|
||||
|
||||
items_attatched[attachModel] = {
|
||||
hash = hash,
|
||||
handle = CreateObject(attachModel, 1.0, 1.0, 1.0, true, true, false),
|
||||
carry = true
|
||||
}
|
||||
|
||||
local x, y, z, xr, yr, zr = props[item].x, props[item].y, props[item].z, props[item].xr, props[item].yr, props[item].zr
|
||||
AttachEntityToEntity(items_attatched[attachModel].handle, ped, bone, x, y, z, xr, yr, zr, 1, 1, 0, 0, 2, 1)
|
||||
SetModelAsNoLongerNeeded(hash)
|
||||
SetEntityCompletelyDisableCollision(items_attatched[attachModel].handle, false, true)
|
||||
doAnim(item)
|
||||
end
|
||||
|
||||
local tempBox = nil
|
||||
|
||||
-- Exports to trick the script into thinking we got an item we can carry --
|
||||
local function carryProp(item)
|
||||
if not item then return print("ITEM NOT DEFINED") end
|
||||
if not props[item] then return print("ITEM NOT REGISTERED IN THE CONFIG") end
|
||||
if carryingBox then return print("PED IS ALREADY CARRYING AN OBJECT") end
|
||||
tempBox = item
|
||||
AttatchProp(item)
|
||||
end
|
||||
|
||||
exports('carryProp', carryProp)
|
||||
|
||||
local function removeProp(item)
|
||||
if not item then return print("ITEM NOT DEFINED") end
|
||||
if not props[item] then return print("ITEM NOT REGISTERED IN THE CONFIG") end
|
||||
if carryingBox ~= item then return print("Item is not whats being carried...") end
|
||||
DeleteObject(items_attatched[props[item].model].handle)
|
||||
items_attatched[props[item].model] = nil
|
||||
carryingBox = nil
|
||||
tempBox = nil
|
||||
end
|
||||
|
||||
exports('removeProp', removeProp)
|
||||
|
||||
|
||||
|
||||
local carryingChain = nil
|
||||
|
||||
local function AttatchChain(attachModel, modelHash, tier, item)
|
||||
if carryingChain then return end
|
||||
carryingChain = attachModel
|
||||
local slot = UseSlot(tier)
|
||||
if not slot then return end
|
||||
|
||||
local v = PlayerSlots[tier][slot]
|
||||
local bone = GetPedBoneIndex(PlayerPedId(), v.bone)
|
||||
|
||||
loadmodel(modelHash)
|
||||
|
||||
ClearPedTasks(PlayerPedId())
|
||||
|
||||
|
||||
items_attatched[attachModel] = {
|
||||
hash = modelHash,
|
||||
handle = CreateObject(attachModel, 1.0, 1.0, 1.0, true, true, false),
|
||||
slot = slot,
|
||||
tier = tier,
|
||||
chain = true,
|
||||
}
|
||||
|
||||
local x, y, z, xr, yr, zr = calcOffsets(v.x, v.y, v.z, v.xr, v.yr, v.zr, item)
|
||||
|
||||
AttachEntityToEntity(items_attatched[attachModel].handle, PlayerPedId(), bone, x, y, z, xr, yr, zr, 1, 1, 0, 0, 2, 1)
|
||||
SetModelAsNoLongerNeeded(modelHash)
|
||||
SetEntityCompletelyDisableCollision(items_attatched[attachModel].handle, false, true)
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
--** Generic Functions **--
|
||||
|
||||
local function getItemByhash(hash)
|
||||
for k, v in pairs(props) do
|
||||
if v.hash == hash or hash == joaat(v.model) then
|
||||
return k
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function removeItems()
|
||||
if items_attatched then
|
||||
for k, v in pairs(items_attatched) do
|
||||
local hasitem = false
|
||||
local item = getItemByhash(v.hash)
|
||||
if item then
|
||||
if tempBox ~= item then
|
||||
if itemSlots[item] then
|
||||
hasitem = true
|
||||
end
|
||||
|
||||
if not hasitem or (props[item] and props[item].busy) then
|
||||
DeleteObject(v.handle)
|
||||
|
||||
if v.slot then
|
||||
PlayerSlots[v.tier][v.slot].isBusy = false
|
||||
end
|
||||
|
||||
if v.chain then
|
||||
carryingChain = nil
|
||||
end
|
||||
|
||||
if v.carry then
|
||||
carryingBox = nil
|
||||
end
|
||||
|
||||
items_attatched[k] = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local PlayerId = PlayerId()
|
||||
local doingCheck = false
|
||||
local function DoItemCheck()
|
||||
if not FullyLoaded then return end
|
||||
if doingCheck then return end
|
||||
if IsPedShooting(ped) or IsPlayerFreeAiming(PlayerId) then return end -- reduces the shooting spamming
|
||||
doingCheck = true
|
||||
Wait(math.random(1, 100)) -- When shooting a gun, the event is called HUNDREDS of times, this here is to prevent that from affecting the players MS too much at a time.
|
||||
local ped = PlayerPedId()
|
||||
local items = PlayerData.items
|
||||
itemSlots = {}
|
||||
if items then
|
||||
for _, item in pairs(items) do
|
||||
item.name = item.name:lower()
|
||||
if item and item.name and props and props[item.name] and not itemSlots[item.name] then
|
||||
itemSlots[item.name] = props[item.name]
|
||||
if props[item.name].carry then
|
||||
if not carryingBox then
|
||||
AttatchProp(item.name)
|
||||
end
|
||||
elseif props[item.name].chain then
|
||||
if not carryingChain then
|
||||
AttatchChain(props[item.name].model, props[item.name].hash, props[item.name].tier, item.name)
|
||||
end
|
||||
elseif not items_attatched[props[item.name].model] and GetSelectedPedWeapon(ped) ~= props[item.name].hash and
|
||||
getFreeSlot(props[item.name].tier) >= 1 then
|
||||
AttachWeapon(props[item.name].model, props[item.name].hash, props[item.name].tier, item.name)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
removeItems()
|
||||
|
||||
Wait(math.random(1, 100)) -- When shooting a gun, the event is called HUNDREDS of times, this here is to prevent that from affecting the players MS too much at a time.
|
||||
doingCheck = false
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
-- ** EXPORTS ** --
|
||||
local function toggleProps()
|
||||
if override then
|
||||
if items_attatched then
|
||||
for k, v in pairs(items_attatched) do
|
||||
|
||||
DeleteObject(v.handle)
|
||||
|
||||
if v.slot then
|
||||
PlayerSlots[v.tier][v.slot].isBusy = false
|
||||
end
|
||||
|
||||
if v.carry then
|
||||
carryingBox = nil
|
||||
end
|
||||
|
||||
if v.chain then
|
||||
carryingChain = nil
|
||||
end
|
||||
|
||||
items_attatched[k] = nil
|
||||
end
|
||||
end
|
||||
override = false
|
||||
else
|
||||
override = true
|
||||
|
||||
if items_attatched then
|
||||
for k, v in pairs(items_attatched) do
|
||||
|
||||
DeleteObject(v.handle)
|
||||
|
||||
if v.slot then
|
||||
PlayerSlots[v.tier][v.slot].isBusy = false
|
||||
end
|
||||
|
||||
if v.carry then
|
||||
carryingBox = nil
|
||||
end
|
||||
|
||||
if v.chain then
|
||||
carryingChain = nil
|
||||
end
|
||||
|
||||
items_attatched[k] = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
exports("toggleProps", toggleProps)
|
||||
|
||||
local function isCarryingObject()
|
||||
return carryingBox ~= nil and true or false
|
||||
end
|
||||
|
||||
exports('isCarryingObject', isCarryingObject)
|
||||
|
||||
local function isCarryingAnObject(item)
|
||||
if items_attatched[props[item].model] then return true else return false end
|
||||
end
|
||||
|
||||
exports('isCarryingAnObject', isCarryingAnObject)
|
||||
|
||||
local function GetPlayerCarryItems()
|
||||
return items_attatched
|
||||
end
|
||||
|
||||
exports('GetPlayerCarryItems', GetPlayerCarryItems)
|
||||
|
||||
local function refreshProps()
|
||||
if not FullyLoaded then return end
|
||||
if items_attatched then
|
||||
for k, v in pairs(items_attatched) do
|
||||
DeleteObject(v.handle)
|
||||
|
||||
if v.slot then
|
||||
PlayerSlots[v.tier][v.slot].isBusy = false
|
||||
end
|
||||
|
||||
if v.carry then
|
||||
carryingBox = nil
|
||||
end
|
||||
|
||||
if v.chain then
|
||||
carryingChain = nil
|
||||
end
|
||||
|
||||
items_attatched[k] = nil
|
||||
end
|
||||
end
|
||||
|
||||
DoItemCheck()
|
||||
end
|
||||
|
||||
exports('refreshProps', refreshProps)
|
||||
|
||||
local function makeObjectBusy(item, state)
|
||||
if not FullyLoaded then return end
|
||||
if not item or not state then return print("YOU ARE MISSING ARGS FOR THIS EXPORT") end
|
||||
if not props[item] then return print("ITEM: " .. item .. " DOES NOT EXIST") end
|
||||
if props[item] and props[item].busy == nil then return print("ITEM: " .. item .. " CANNOT BE SET TO BUSY") end
|
||||
props[item].busy = state
|
||||
DoItemCheck()
|
||||
end
|
||||
|
||||
exports('makeObjectBusy', makeObjectBusy)
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
-- ** GENERIC EVENTS ** --
|
||||
AddEventHandler('ox_inventory:currentWeapon', function(data)
|
||||
if not FullyLoaded then return end
|
||||
if override then return end
|
||||
if data then
|
||||
data.name = data.name:lower()
|
||||
if props[data.name] and items_attatched[props[data.name].model] then
|
||||
DeleteWeapon(props[data.name].model)
|
||||
end
|
||||
else
|
||||
Wait(1000)
|
||||
DoItemCheck()
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterNetEvent('weapons:client:SetCurrentWeapon', function(data)
|
||||
if data and LocalPlayer.state.isLoggedIn then
|
||||
if props[data.name] and items_attatched[props[data.name].model] then
|
||||
DeleteWeapon(props[data.name].model)
|
||||
end
|
||||
elseif not data and LocalPlayer.state.isLoggedIn then
|
||||
Wait(1000)
|
||||
if not override then DoItemCheck() elseif override and PlayerData.metadata.inside.apartment.apartmentId then DoItemCheck() end
|
||||
end
|
||||
end)
|
||||
|
||||
-- Handles state right when the player selects their character and location.
|
||||
RegisterNetEvent('QBCore:Client:OnPlayerLoaded', function()
|
||||
Wait(20000)
|
||||
PlayerData = QBCore.Functions.GetPlayerData()
|
||||
FullyLoaded = true
|
||||
Wait(250)
|
||||
if not override then DoItemCheck() elseif override and PlayerData.metadata.inside.apartment.apartmentId then DoItemCheck() end
|
||||
end)
|
||||
|
||||
-- Resets state on logout, in case of character change.
|
||||
RegisterNetEvent('QBCore:Client:OnPlayerUnload', function()
|
||||
PlayerData = nil
|
||||
FullyLoaded = false
|
||||
end)
|
||||
|
||||
-- Handles state when PlayerData is changed. We're just looking for inventory updates.
|
||||
RegisterNetEvent('QBCore:Player:SetPlayerData', function(val)
|
||||
PlayerData = val
|
||||
Wait(50)
|
||||
if not override then DoItemCheck() elseif override and PlayerData.metadata.inside.apartment.apartmentId then DoItemCheck() end
|
||||
end)
|
||||
|
||||
-- Handles state if resource is restarted live.
|
||||
AddEventHandler('onResourceStart', function(resource)
|
||||
if GetCurrentResourceName() == resource then
|
||||
Wait(100)
|
||||
if not FullyLoaded then return end
|
||||
DoItemCheck()
|
||||
end
|
||||
end)
|
||||
|
||||
AddEventHandler('onResourceStop', function(resource)
|
||||
if resource == GetCurrentResourceName() then
|
||||
for key, attached_object in pairs(items_attatched) do
|
||||
DeleteObject(attached_object.handle)
|
||||
items_attatched[key] = nil
|
||||
end
|
||||
end
|
||||
end)
|
13
resources/[renewed]/Renewed-Weaponscarry/fxmanifest.lua
Normal file
13
resources/[renewed]/Renewed-Weaponscarry/fxmanifest.lua
Normal file
@ -0,0 +1,13 @@
|
||||
fx_version 'cerulean'
|
||||
game 'gta5'
|
||||
|
||||
author 'Renewed Scripts'
|
||||
description 'Renewed Weapons and Carry script allow you to give your players weapons on their back and carry items all in 1 resource with ultra low performance hit between 0.00 and 0.01'
|
||||
version '1.0.0'
|
||||
|
||||
lua54 'yes'
|
||||
|
||||
client_scripts {
|
||||
'client/*.lua'
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user