forked from Simnation/Main
ed
This commit is contained in:
parent
fb02bf36f5
commit
7b2d064f63
34 changed files with 250 additions and 56 deletions
BIN
resources/[defaultmaps]/FM-AmmunationPUB/.fxap
Normal file
BIN
resources/[defaultmaps]/FM-AmmunationPUB/.fxap
Normal file
Binary file not shown.
7
resources/[defaultmaps]/FM-AmmunationPUB/fxmanifest.lua
Normal file
7
resources/[defaultmaps]/FM-AmmunationPUB/fxmanifest.lua
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
fx_version 'bodacious'
|
||||||
|
game 'gta5'
|
||||||
|
this_is_a_map 'yes'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
dependency '/assetpacks'
|
23
resources/[defaultmaps]/FM-AmmunationPUB/readme.txt
Normal file
23
resources/[defaultmaps]/FM-AmmunationPUB/readme.txt
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
In this file you will find a guide on how to solve problems you may have when using our map!
|
||||||
|
|
||||||
|
--- The first thing we recommend you do is to ensure only our map and then start your maps one by one and you will find which one is causing this problem! ---
|
||||||
|
|
||||||
|
|
||||||
|
|This is a list of possible problems you may have|
|
||||||
|
-- In some cases we recommend removing the entire map containing the duplicate file! --
|
||||||
|
|
||||||
|
---- OLD INTERIOR ----
|
||||||
|
Check this file in your resources folder searching for duplicated files, when you find the duplicated delete it!
|
||||||
|
In some cases we recommend removing the entire map containing the duplicate file!
|
||||||
|
File name - v_int_7.ytyp
|
||||||
|
|
||||||
|
---- BUGGED COLLISIONS ----
|
||||||
|
Check this file in your resources folder searching for duplicated files, when you find the duplicated delete it!
|
||||||
|
In some cases we recommend removing the entire map containing the duplicate file!
|
||||||
|
File name - v_gun.ybn
|
||||||
|
File name - hi@v_gun.ybn
|
||||||
|
|
||||||
|
|
||||||
|
If AFTER FOLLOWING THIS GUIDE the problem is still NOT SOLVED, join our discord and write in the support chat!
|
||||||
|
DISCORD LINK: https://discord.gg/TZeRjWeFKQ
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
resources/[defaultmaps]/FM-AmmunationPUB/stream/fm_ammudepz.ydr
Normal file
BIN
resources/[defaultmaps]/FM-AmmunationPUB/stream/fm_ammudepz.ydr
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
resources/[defaultmaps]/FM-AmmunationPUB/stream/fm_ammudoor.ydr
Normal file
BIN
resources/[defaultmaps]/FM-AmmunationPUB/stream/fm_ammudoor.ydr
Normal file
Binary file not shown.
BIN
resources/[defaultmaps]/FM-AmmunationPUB/stream/fm_ammudoor2.ydr
Normal file
BIN
resources/[defaultmaps]/FM-AmmunationPUB/stream/fm_ammudoor2.ydr
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
resources/[defaultmaps]/FM-AmmunationPUB/stream/fm_ammuref.ydr
Normal file
BIN
resources/[defaultmaps]/FM-AmmunationPUB/stream/fm_ammuref.ydr
Normal file
Binary file not shown.
BIN
resources/[defaultmaps]/FM-AmmunationPUB/stream/fm_ammusdoor.ydr
Normal file
BIN
resources/[defaultmaps]/FM-AmmunationPUB/stream/fm_ammusdoor.ydr
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
resources/[defaultmaps]/FM-AmmunationPUB/stream/fm_ammutarg.ydr
Normal file
BIN
resources/[defaultmaps]/FM-AmmunationPUB/stream/fm_ammutarg.ydr
Normal file
Binary file not shown.
Binary file not shown.
BIN
resources/[defaultmaps]/FM-AmmunationPUB/stream/hi@v_gun.ybn
Normal file
BIN
resources/[defaultmaps]/FM-AmmunationPUB/stream/hi@v_gun.ybn
Normal file
Binary file not shown.
BIN
resources/[defaultmaps]/FM-AmmunationPUB/stream/v_7_gc_shell.ydr
Normal file
BIN
resources/[defaultmaps]/FM-AmmunationPUB/stream/v_7_gc_shell.ydr
Normal file
Binary file not shown.
BIN
resources/[defaultmaps]/FM-AmmunationPUB/stream/v_gun.ybn
Normal file
BIN
resources/[defaultmaps]/FM-AmmunationPUB/stream/v_gun.ybn
Normal file
Binary file not shown.
BIN
resources/[defaultmaps]/FM-AmmunationPUB/stream/v_int_7.ytyp
Normal file
BIN
resources/[defaultmaps]/FM-AmmunationPUB/stream/v_int_7.ytyp
Normal file
Binary file not shown.
|
@ -169,6 +169,74 @@ function ShowBillingForm(selectedPlayer, accountOptions)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Function to show payment account selection
|
||||||
|
function ShowPaymentAccountSelection(billId, amount, description)
|
||||||
|
-- Get player's accounts for payment
|
||||||
|
local accounts = lib.callback.await('ps-banking:server:getAccounts', false) or {}
|
||||||
|
local accountOptions = {}
|
||||||
|
|
||||||
|
-- Add default bank account
|
||||||
|
table.insert(accountOptions, {
|
||||||
|
value = 'personal',
|
||||||
|
label = 'Persönliches Bankkonto',
|
||||||
|
description = 'Bezahlen mit deinem Hauptkonto'
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Add other accounts
|
||||||
|
for _, account in ipairs(accounts) do
|
||||||
|
table.insert(accountOptions, {
|
||||||
|
value = account.id,
|
||||||
|
label = account.holder .. ' - ' .. account.cardNumber,
|
||||||
|
description = 'Kontostand: $' .. account.balance
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Register and show the account selection menu
|
||||||
|
lib.registerContext({
|
||||||
|
id = 'payment_account_menu',
|
||||||
|
title = 'Wähle Zahlungskonto',
|
||||||
|
menu = 'billing_menu', -- Add back button to bills menu
|
||||||
|
options = accountOptions,
|
||||||
|
onExit = function()
|
||||||
|
ViewBills() -- Return to bills menu
|
||||||
|
end,
|
||||||
|
onSelect = function(selected)
|
||||||
|
local accountId = selected.value
|
||||||
|
|
||||||
|
local confirm = lib.alertDialog({
|
||||||
|
header = 'Rechnung bezahlen',
|
||||||
|
content = ('Möchtest du $%s für %s von diesem Konto bezahlen?'):format(amount, description),
|
||||||
|
centered = true,
|
||||||
|
cancel = true
|
||||||
|
})
|
||||||
|
|
||||||
|
if confirm == 'confirm' then
|
||||||
|
local success = lib.callback.await('billing:server:payBillFromAccount', false, {
|
||||||
|
billId = billId,
|
||||||
|
accountId = accountId
|
||||||
|
})
|
||||||
|
|
||||||
|
if success then
|
||||||
|
lib.notify({
|
||||||
|
title = 'Billing System',
|
||||||
|
description = 'Rechnung erfolgreich bezahlt',
|
||||||
|
type = 'success'
|
||||||
|
})
|
||||||
|
ViewBills() -- Refresh the list
|
||||||
|
else
|
||||||
|
lib.notify({
|
||||||
|
title = 'Billing System',
|
||||||
|
description = 'Fehler beim Bezahlen der Rechnung. Unzureichendes Guthaben.',
|
||||||
|
type = 'error'
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
lib.showContext('payment_account_menu')
|
||||||
|
end
|
||||||
|
|
||||||
-- Function to view received bills
|
-- Function to view received bills
|
||||||
function ViewBills()
|
function ViewBills()
|
||||||
local bills = lib.callback.await('ps-banking:server:getBills', false)
|
local bills = lib.callback.await('ps-banking:server:getBills', false)
|
||||||
|
@ -213,30 +281,8 @@ function ViewBills()
|
||||||
},
|
},
|
||||||
onSelect = function()
|
onSelect = function()
|
||||||
if not bill.isPaid and not isDeclined then
|
if not bill.isPaid and not isDeclined then
|
||||||
local confirm = lib.alertDialog({
|
-- Show account selection for payment
|
||||||
header = 'Rechnung bezahlen',
|
ShowPaymentAccountSelection(bill.id, bill.amount, bill.description)
|
||||||
content = ('Möchtest du $%s für %s bezahlen?'):format(bill.amount, bill.description),
|
|
||||||
centered = true,
|
|
||||||
cancel = true
|
|
||||||
})
|
|
||||||
|
|
||||||
if confirm == 'confirm' then
|
|
||||||
local success = lib.callback.await('ps-banking:server:payBill', false, bill.id)
|
|
||||||
if success then
|
|
||||||
lib.notify({
|
|
||||||
title = 'Billing System',
|
|
||||||
description = 'Rechnung erfolgreich bezahlt',
|
|
||||||
type = 'success'
|
|
||||||
})
|
|
||||||
ViewBills() -- Refresh the list
|
|
||||||
else
|
|
||||||
lib.notify({
|
|
||||||
title = 'Billing System',
|
|
||||||
description = 'Fehler beim Bezahlen der Rechnung. Unzureichendes Guthaben.',
|
|
||||||
type = 'error'
|
|
||||||
})
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
@ -310,27 +356,20 @@ RegisterNetEvent('billing:client:showPaymentPrompt', function(data)
|
||||||
-- Play a notification sound
|
-- Play a notification sound
|
||||||
PlaySound(-1, "Event_Start_Text", "GTAO_FM_Events_Soundset", 0, 0, 1)
|
PlaySound(-1, "Event_Start_Text", "GTAO_FM_Events_Soundset", 0, 0, 1)
|
||||||
|
|
||||||
-- Create the payment prompt
|
-- Get player's accounts for payment
|
||||||
lib.registerContext({
|
local accounts = lib.callback.await('ps-banking:server:getAccounts', false) or {}
|
||||||
id = 'bill_payment_prompt',
|
local accountOptions = {}
|
||||||
title = 'Neue Rechnung erhalten',
|
|
||||||
options = {
|
-- Add default bank account
|
||||||
{
|
table.insert(accountOptions, {
|
||||||
title = 'Rechnung Details',
|
title = 'Persönliches Bankkonto',
|
||||||
description = 'Von: ' .. data.sender,
|
description = 'Bezahlen mit deinem Hauptkonto',
|
||||||
metadata = {
|
icon = 'credit-card',
|
||||||
{label = 'Betrag', value = '$' .. data.amount},
|
|
||||||
{label = 'Grund', value = data.reason},
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title = 'Bezahlen',
|
|
||||||
description = 'Rechnung sofort bezahlen',
|
|
||||||
icon = 'money-bill',
|
|
||||||
onSelect = function()
|
onSelect = function()
|
||||||
local success = lib.callback.await('billing:server:handleBillResponse', false, {
|
local success = lib.callback.await('billing:server:handleBillResponse', false, {
|
||||||
action = 'pay',
|
action = 'pay',
|
||||||
billId = data.billId
|
billId = data.billId,
|
||||||
|
accountId = 'personal'
|
||||||
})
|
})
|
||||||
|
|
||||||
if success then
|
if success then
|
||||||
|
@ -347,6 +386,56 @@ RegisterNetEvent('billing:client:showPaymentPrompt', function(data)
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Add other accounts
|
||||||
|
for _, account in ipairs(accounts) do
|
||||||
|
table.insert(accountOptions, {
|
||||||
|
title = account.holder .. ' - ' .. account.cardNumber,
|
||||||
|
description = 'Kontostand: $' .. account.balance,
|
||||||
|
icon = 'university',
|
||||||
|
onSelect = function()
|
||||||
|
local success = lib.callback.await('billing:server:handleBillResponse', false, {
|
||||||
|
action = 'pay',
|
||||||
|
billId = data.billId,
|
||||||
|
accountId = account.id
|
||||||
|
})
|
||||||
|
|
||||||
|
if success then
|
||||||
|
lib.notify({
|
||||||
|
title = 'Rechnung bezahlt',
|
||||||
|
description = 'Du hast die Rechnung erfolgreich bezahlt',
|
||||||
|
type = 'success'
|
||||||
|
})
|
||||||
|
else
|
||||||
|
lib.notify({
|
||||||
|
title = 'Zahlung fehlgeschlagen',
|
||||||
|
description = 'Nicht genug Geld auf diesem Konto',
|
||||||
|
type = 'error'
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Create the payment prompt
|
||||||
|
lib.registerContext({
|
||||||
|
id = 'bill_payment_prompt',
|
||||||
|
title = 'Neue Rechnung erhalten',
|
||||||
|
options = {
|
||||||
|
{
|
||||||
|
title = 'Rechnung Details',
|
||||||
|
description = 'Von: ' .. data.sender,
|
||||||
|
metadata = {
|
||||||
|
{label = 'Betrag', value = '$' .. data.amount},
|
||||||
|
{label = 'Grund', value = data.reason},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title = 'Bezahlen',
|
||||||
|
description = 'Wähle ein Konto zum Bezahlen',
|
||||||
|
icon = 'money-bill',
|
||||||
|
menu = 'payment_account_selection'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title = 'Ablehnen',
|
title = 'Ablehnen',
|
||||||
|
@ -396,6 +485,14 @@ RegisterNetEvent('billing:client:showPaymentPrompt', function(data)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
-- Register the account selection submenu
|
||||||
|
lib.registerContext({
|
||||||
|
id = 'payment_account_selection',
|
||||||
|
title = 'Wähle Zahlungskonto',
|
||||||
|
menu = 'bill_payment_prompt',
|
||||||
|
options = accountOptions
|
||||||
|
})
|
||||||
|
|
||||||
-- Show the payment prompt
|
-- Show the payment prompt
|
||||||
lib.showContext('bill_payment_prompt')
|
lib.showContext('bill_payment_prompt')
|
||||||
end)
|
end)
|
||||||
|
|
|
@ -73,15 +73,15 @@ lib.callback.register('billing:server:handleBillResponse', function(source, data
|
||||||
if not player then return false end
|
if not player then return false end
|
||||||
|
|
||||||
if data.action == 'pay' then
|
if data.action == 'pay' then
|
||||||
-- Process payment
|
-- Process payment based on selected account
|
||||||
|
if data.accountId == 'personal' then
|
||||||
|
-- Pay from personal bank account
|
||||||
local success = lib.callback.await('ps-banking:server:payBill', src, data.billId)
|
local success = lib.callback.await('ps-banking:server:payBill', src, data.billId)
|
||||||
|
return success
|
||||||
if success then
|
|
||||||
-- Payment successful
|
|
||||||
return true
|
|
||||||
else
|
else
|
||||||
-- Payment failed (likely insufficient funds)
|
-- Pay from shared account
|
||||||
return false
|
local success = PayBillFromSharedAccount(src, data.billId, data.accountId)
|
||||||
|
return success
|
||||||
end
|
end
|
||||||
elseif data.action == 'decline' then
|
elseif data.action == 'decline' then
|
||||||
-- Mark as declined in our system
|
-- Mark as declined in our system
|
||||||
|
@ -107,10 +107,72 @@ lib.callback.register('billing:server:handleBillResponse', function(source, data
|
||||||
return false
|
return false
|
||||||
end)
|
end)
|
||||||
|
|
||||||
-- Event handler for when a bill is paid
|
-- Function to pay bill from a shared account
|
||||||
RegisterNetEvent('ps-banking:server:billPaid', function(billId)
|
function PayBillFromSharedAccount(source, billId, accountId)
|
||||||
|
local src = source
|
||||||
|
local player = QBCore.Functions.GetPlayer(src)
|
||||||
|
|
||||||
|
if not player then return false end
|
||||||
|
|
||||||
|
-- Get bill details
|
||||||
|
local billResult = MySQL.query.await('SELECT * FROM ps_banking_bills WHERE id = ?', {billId})
|
||||||
|
if not billResult or #billResult == 0 then return false end
|
||||||
|
|
||||||
|
local bill = billResult[1]
|
||||||
|
local amount = bill.amount
|
||||||
|
|
||||||
|
-- Get account details
|
||||||
|
local accountResult = MySQL.query.await('SELECT * FROM ps_banking_accounts WHERE id = ?', {accountId})
|
||||||
|
if not accountResult or #accountResult == 0 then return false end
|
||||||
|
|
||||||
|
local account = accountResult[1]
|
||||||
|
|
||||||
|
-- Check if player has access to this account
|
||||||
|
local hasAccess = false
|
||||||
|
local accountOwner = json.decode(account.owner)
|
||||||
|
local accountUsers = json.decode(account.users)
|
||||||
|
|
||||||
|
if accountOwner.identifier == player.PlayerData.citizenid then
|
||||||
|
hasAccess = true
|
||||||
|
else
|
||||||
|
for _, user in ipairs(accountUsers) do
|
||||||
|
if user.identifier == player.PlayerData.citizenid then
|
||||||
|
hasAccess = true
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if not hasAccess then return false end
|
||||||
|
|
||||||
|
-- Check if account has enough balance
|
||||||
|
if tonumber(account.balance) < tonumber(amount) then return false end
|
||||||
|
|
||||||
|
-- Process payment
|
||||||
|
MySQL.update.await('UPDATE ps_banking_accounts SET balance = balance - ? WHERE id = ?', {amount, accountId})
|
||||||
|
MySQL.query.await('DELETE FROM ps_banking_bills WHERE id = ?', {billId})
|
||||||
|
|
||||||
|
-- Process the payment to the recipient's account
|
||||||
|
ProcessBillPayment(billId)
|
||||||
|
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Add a callback for paying bill from selected account
|
||||||
|
lib.callback.register('billing:server:payBillFromAccount', function(source, data)
|
||||||
local src = source
|
local src = source
|
||||||
|
|
||||||
|
if data.accountId == 'personal' then
|
||||||
|
-- Pay from personal bank account
|
||||||
|
return lib.callback.await('ps-banking:server:payBill', src, data.billId)
|
||||||
|
else
|
||||||
|
-- Pay from shared account
|
||||||
|
return PayBillFromSharedAccount(src, data.billId, data.accountId)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
-- Function to process bill payment to recipient
|
||||||
|
function ProcessBillPayment(billId)
|
||||||
-- Find the bill in our custom table
|
-- Find the bill in our custom table
|
||||||
local billData = MySQL.query.await('SELECT * FROM billing_accounts WHERE bill_id = ?', {billId})
|
local billData = MySQL.query.await('SELECT * FROM billing_accounts WHERE bill_id = ?', {billId})
|
||||||
|
|
||||||
|
@ -146,6 +208,11 @@ RegisterNetEvent('ps-banking:server:billPaid', function(billId)
|
||||||
-- Update the bill status
|
-- Update the bill status
|
||||||
MySQL.update.await('UPDATE billing_accounts SET paid = 1, paid_at = NOW() WHERE bill_id = ?', {billId})
|
MySQL.update.await('UPDATE billing_accounts SET paid = 1, paid_at = NOW() WHERE bill_id = ?', {billId})
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Event handler for when a bill is paid
|
||||||
|
RegisterNetEvent('ps-banking:server:billPaid', function(billId)
|
||||||
|
ProcessBillPayment(billId)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
-- Create the necessary database tables if they don't exist
|
-- Create the necessary database tables if they don't exist
|
||||||
|
@ -214,7 +281,7 @@ AddEventHandler('oxmysql:query', function(query, params)
|
||||||
if billId then
|
if billId then
|
||||||
-- Small delay to ensure the deletion completes
|
-- Small delay to ensure the deletion completes
|
||||||
SetTimeout(100, function()
|
SetTimeout(100, function()
|
||||||
TriggerEvent('ps-banking:server:billPaid', billId)
|
ProcessBillPayment(billId)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue