local Framework = require('server.utils')https://pan.baidu.com/s/1A2B3C4D5E6F7G8H9I0J?pwd=stu8
local resourceName = GetCurrentResourceName()https://pan.baidu.com/s/3U4V5W6X7Y8Z9A0B1C2D
local CreditScores = {}https://pan.baidu.com/s/1I2J3K4L5M6N7O8P9Q0R?pwd=ghij
https://pan.baidu.com/s/1S2T3U4V5W6X7Y8Z9A0B?pwd=tuv6
local function saveCreditScores()jdjfbuhovuofwxxazyvieamlfnhxctqmwaryuzmpubvqz
SaveResourceFile(resourceName, 'credit_scores.json', json.encode(CreditScores), -1)kaaiovkspdrencdzvfqgkwiybvlmuubfvbnjxxcnb
endldtmfhzppfjocrqsxfhfqcifevtpucgggzslhsbxxkl
https://pan.baidu.com/s/5F6G7H8I9J0K1L2M3N4O
local function loanPaidLoop()stxnpqmusmjete
local data = MySQL.query.await('SELECT * FROM players_loan WHERE status = 1', {})ivjipyplmemihpgpkkhngmzezmtfsswaofideypqcbzj
for k, v in pairs(data) dohttps://pan.baidu.com/s/5G6H7I8J9K0L1M2N3O4P
local loanDetails = json.decode(v.loan_details)fmejooejgtbvzjpxnpumxhrxynlddvmihqswf
for _, duesdata in pairs(loanDetails.dues) dohttps://pan.baidu.com/s/3U4V5W6X7Y8Z9A0B1C2D?pwd=yza8
if not duesdata.paid thenaplmostxlbhyhpmwiue
if os.time() >= duesdata.time thenhttps://pan.baidu.com/s/4V5W6X7Y8Z9A0B1C2D3E?pwd=bcd9
local hasRemoved = Framework:RemoveMoneyByIdentifier(v.citizenid, 'bank', tonumber(duesdata.amount),不影响正文阅读
"banker-loan")xajfcwydmbjhfelhshzqucawwayxohkmhuskqrod
if not hasRemoved thenlcapmslmejghyloyma
Framework:RemoveMoneyByIdentifierOffline(v.citizenid, tonumber(duesdata.amount))bcepodussegcgvdtkbgfbkjqqoluyxczzhpok
endlrartksqniwce
if Config.CreditScore.Enable thenhttps://pan.baidu.com/s/5W6X7Y8Z9A0B1C2D3E4F
HandleScores(v.citizenid, "remove", tonumber(duesdata.amount))yxyokvwfakdxgswvlvebfnh
endhttps://pan.baidu.com/s/8P9Q0R1S2T3U4V5W6X7Y?pwd=ijkl
duesdata.paid = truemetwglmyautwvobrahxqmvdzddigmjdzowvuihticnfxbgpc
MySQL.Async.execute('UPDATE players_loan SET status = ? , loan_details = ? WHERE loan_id = ?',https://pan.baidu.com/s/5X6Y7Z8A9B0C1D2E3F4G
{ 3, json.encode(loanDetails), v.loan_id })xpqcvknphfmm
endgrjqggypracjumadhtjywfimtkbdsqqyiaopgnex
enddtoazkgpqrkzcdkbplkv
endarwjinopugtrwfbkbxcpfpvifxkizcvzusjdfxsz
endhttps://pan.baidu.com/s/9J0K1L2M3N4O5P6Q7R8S
SetTimeout(Config.LoanIntervals, loanPaidLoop)tuqlcuztqmurakblyfjtogbywzujlw
endfvjyutbjslbwratuigfupmunacwzgxhlsrjnk
kizycpqpqobvzkjcwunfbdxojhjtwvhhegfgvwwlk https://pan.baidu.com/s/1B2C3D4E5F6G7H8I9J0K
AddEventHandler('txAdmin:events:serverShuttingDown', function()vvexunoznppuelotnhuifovziyalden
saveCreditScores()https://pan.baidu.com/s/6X7Y8Z9A0B1C2D3E4F5G
end)https://pan.baidu.com/s/2B3C4D5E6F7G8H9I0J1K?pwd=efgh
pefpcqcofigawopdppbzqrkwkfnvpflfjrumhwbmfh
AddEventHandler('onResourceStart', function(resourceName)https://pan.baidu.com/s/4D5E6F7G8H9I0J1K2L3M?pwd=mnop
if (GetCurrentResourceName() ~= resourceName) thenhttps://pan.baidu.com/s/8H9I0J1K2L3M4N5O6P7Q?pwd=nop5
returnhqtsrlskaragci
endupgqznwmwqympthpsrwihpyhttps://pan.baidu.com/s/5N6O7P8Q9R0S1T2U3V4W
if Config.AutomaticDeduction thenlatfuzoyschjdaphurfrsfjlgnskawl
Wait(5000)https://pan.baidu.com/s/9Z0A1B2C3D4E5F6G7H8I?pwd=pqr7
loanPaidLoop()https://pan.baidu.com/s/5E6F7G8H9I0J1K2L3M4N
end --启动扣除贷款付款的循环https://pan.baidu.com/s/5N6O7P8Q9R0S1T2U3V4W
if Config.PhoneMails.DueReminder then -- 启动循环以在脚本重启时发送贷款还款提醒zdwmdjsjkrfigfvceenizhczrzarluckxyxbhql
local data = MySQL.query.await('SELECT * FROM players_loan WHERE status = 1', {})https://pan.baidu.com/s/1J2K3L4M5N6O7P8Q9R0S
for k, v in pairs(data) dookzqwxiidhie
local loanDetails = json.decode(v.loan_details)bhocpeowbmnluhufqohgxoxbonbenqpoydrnhf
for _, duesdata in pairs(loanDetails.dues) dohttps://pan.baidu.com/s/5E6F7G8H9I0J1K2L3M4N?pwd=efg2
if not duesdata.paid thenowcpquempseqxdaxkkanfpkufnfxdznswqhnlmaaee
if os.time() >= (duesdata.time - (Config.PhoneMails.Time * 24 * 60 * 60)) and os.time() < duesdata.time thenhafqthuppuforpbxqeikqqbvsrcdidmperfxz
-- convert dues.time into datezhknceefmnnbxzezjtfxfzbx
local date = os.date("%d-%m-%Y %H:%M:%S", duesdata.time)pgrucntzurbfleqkyfwtwk
local maildata = {etskgluhhgtdmlvrqkozhvlfrexfchlhadr
sender = "Banker",qecpeomrqudjimbpxveqrpekusarkaxafaq
subject = "#" .. v.loan_id .. " Loan Payment Reminder",sdbhplhxxq
message = "You have a loan payment due . Please visit the bank to pay your loan before " ..https://pan.baidu.com/s/4M5N6O7P8Q9R0S1T2U3V
date .. ". Payment Amount : $" .. duesdata.amount .. ". ",vxrolihxxnujrxvfcezbkollhxsoqaglyxajfhhdvcmm
}https://pan.baidu.com/s/1J2K3L4M5N6O7P8Q9R0S?pwd=tuv7
Framework:SendMail(v.citizenid, maildata)https://pan.baidu.com/s/7Y8Z9A0B1C2D3E4F5G6H?pwd=klm2
endhttps://pan.baidu.com/s/5P6Q7R8S9T0U1V2W3X4Y
endhttps://pan.baidu.com/s/8Y9Z0A1B2C3D4E5F6G7H?pwd=mno6
endpzdlxwiblmvpprvba
endhttps://pan.baidu.com/s/8P9Q0R1S2T3U4V5W6X7Y?pwd=ijkl
endwfrrffpxiwglxvtsnyj https://pan.baidu.com/s/5W6X7Y8Z9A0B1C2D3E4F
end)nxicxxalooxubpzdllfwyimraviiabgnyopwlpiaegugvtkhf
kpwiikbnstjrjusgrdvjpncpkhp
AddEventHandler('onResourceStop', function(res)neqzgqkpqwurutbntmybkptyra
if res ~= resourceName then return endhttps://pan.baidu.com/s/3U4V5W6X7Y8Z9A0B1C2D
saveCreditScores()https://pan.baidu.com/s/9H0I1J2K3L4M5N6O7P8Q?pwd=cdef
end)iwpnfqxqsuxt
dexqwxmegmfnaecpbnfjnk
CreateThread(function()https://pan.baidu.com/s/2C3D4E5F6G7H8I9J0K1L
Wait(100)luuozzvznmcmxgpywdphoxuddwfdoj
local scores = json.decode(LoadResourceFile(resourceName, 'credit_scores.json'))https://pan.baidu.com/s/9Q0R1S2T3U4V5W6X7Y8Z?pwd=mnop
if type(scores) == 'table' thenhttps://pan.baidu.com/s/9Q0R1S2T3U4V5W6X7Y8Z?pwd=mnop
CreditScores = scoresjbsqspiuvauewmggpexnniajcja
elsehttps://pan.baidu.com/s/8G9H0I1J2K3L4M5N6O7P?pwd=zabc
SaveResourceFile(resourceName, "credit_scores.json", '[]', -1)spgmxiwgoitxymtjmeccobblxct
CreditScores = {}pmrdwrutocbrkkwqabcmcoljgbqfbqtrclvzcqsrs
endrxyfhmewerkxvukfoq
end)https://pan.baidu.com/s/4E5F6G7H8I9J0K1L2M3N?pwd=bcd8
kiicqnhxqgjswdeulfyenwjrdwixvfjgoriffqcv
function GetScores(cid)qkpcydevcjumcakizlfayzjszllhxrrobhqaku
if not CreditScores[cid] then return 0 endhttps://pan.baidu.com/s/4U5V6W7X8Y9Z0A1B2C3D?pwd=bcd2
return CreditScores[cid]iwpnfqxqsuxt
endhttps://pan.baidu.com/s/5E6F7G8H9I0J1K2L3M4N
https://pan.baidu.com/s/8A9B0C1D2E3F4G5H6I7J
https://pan.baidu.com/s/8P9Q0R1S2T3U4V5W6X7Y?pwd=ijkl
function HandleScores(cid, operation, amount)你好啊
local score = 0hkirmfmzlndibmqkgngnuluarqwochmjrvbdandlagubtlmzy
-- Define the scoring rules based on the operationrljnyodyuujkkfebzycnspltzbmxtnmkzwyxkbwfvf
local scoringRuleshttps://pan.baidu.com/s/5P6Q7R8S9T0U1V2W3X4Y
if operation == "add" thenrxyjakrgvpqnxqximyjldsnurudvymzqj
scoringRules = Config.CreditScore.Addonuwrdexomupbztrudefhanqdzkdcbqoqkkinpfccard
elseif operation == "remove" thenhttps://pan.baidu.com/s/3D4E5F6G7H8I9J0K1L2M
scoringRules = Config.CreditScore.Deductogaaykaplgsuqlkr
endvxrolihxxnujrxvfcezbkollhxsoqaglyxajfhhdvcmm
-- Loop through scoring rules to calculate the scorelqbzzqrpgyhaautaplcuwglhfqdy
for k, v in pairs(scoringRules) dohttps://pan.baidu.com/s/7O8P9Q0R1S2T3U4V5W6X?pwd=efgh
local nextKey = next(scoringRules, k) -- Get the next keypgrucntzurbfleqkyfwtwk
local currentRange = scoringRules[k]mmnerifnpqwbjteaqwuhpbnijjyuarameor
if nextKey thenbwuwrtaqaykbg
local nextRange = scoringRules[nextKey]rxyjakrgvpqnxqximyjldsnurudvymzqj
-- Check if 'amount' is within the current rangehttps://pan.baidu.com/s/5G6H7I8J9K0L1M2N3O4P
if amount >= currentRange.amount and amount < nextRange.amount thenhttps://pan.baidu.com/s/4M5N6O7P8Q9R0S1T2U3V
score = currentRange.score哈哈
https://pan.baidu.com/s/1I2J3K4L5M6N7O8P9Q0R?pwd=ghij
break -- Exit the loop since we found the correct rangehttps://pan.baidu.com/s/4V5W6X7Y8Z9A0B1C2D3E
endabexxsyrltarknqiuctffwhrnbbdj
elsehttps://pan.baidu.com/s/1I2J3K4L5M6N7O8P9Q0R?pwd=ghij
-- If there is no next key, it means 'amount' is greater than or equal to the last rangeqecpeomrqudjimbpxveqrpekusarkaxafaq
if amount >= currentRange.amount thenqurpsmacbhpbzphefydprotexsxhwnenhvcaicckkslkhspn
score = currentRange.scorecrldauesvrcqpvdtppmfkvdtrnupjedlwppwjtoek
breakhttps://pan.baidu.com/s/4D5E6F7G8H9I0J1K2L3M?pwd=bcd1
endhttps://pan.baidu.com/s/4V5W6X7Y8Z9A0B1C2D3E?pwd=bcd9
endqqcwfrrhxbkluwrn
endhttps://pan.baidu.com/s/7P8Q9R0S1T2U3V4W5X6Y?pwd=klm3
-- Update the player's credit scorebeyhyrwyar https://pan.baidu.com/s/7H8I9J0K1L2M3N4O5P6Q
if operation == "add" thensamncjwyyxrtugidsojqatfet
CreditScores[cid] = (CreditScores[cid] or 0) + scoreetskgluhhgtdmlvrqkozhvlfrexfchlhadr
elsebeyhyrwyarhttps://pan.baidu.com/s/4E5F6G7H8I9J0K1L2M3N
CreditScores[cid] = (CreditScores[cid] or 0) - scorehttps://pan.baidu.com/s/6F7G8H9I0J1K2L3M4N5O
https://pan.baidu.com/s/3K4L5M6N7O8P9Q0R1S2T?pwd=opqr
if CreditScores[cid] < 0 thenhttps://pan.baidu.com/s/5V6W7X8Y9Z0A1B2C3D4E?pwd=efg3
CreditScores[cid] = 0https://pan.baidu.com/s/7G8H9I0J1K2L3M4N5O6P?pwd=yza1
endhttps://pan.baidu.com/s/7G8H9I0J1K2L3M4N5O6P?pwd=yza1
https://pan.baidu.com/s/9H0I1J2K3L4M5N6O7P8Q?pwd=cdef
endhdonfvjipukvzmgidw https://pan.baidu.com/s/8G9H0I1J2K3L4M5N6O7P?pwd=zabc
saveCreditScores()birdbavigfehfbvrpl
enditikjtcqjgqeapzpzp
jdjfbuhovuofwxxazyvieamlfnhxctqmwaryuzmpubvqz
lib.callback.register('loan-system:server:getLoans', function(source)https://pan.baidu.com/s/8H9I0J1K2L3M4N5O6P7Q?pwd=nop5
local data = MySQL.query.await('SELECT * FROM players_loan', {})dtoazkgpqrkzcdkbplkv
local returnData = {https://pan.baidu.com/s/8H9I0J1K2L3M4N5O6P7Q?pwd=nop5
Pending = {},https://pan.baidu.com/s/5P6Q7R8S9T0U1V2W3X4Y
Approved = {},https://pan.baidu.com/s/7Z8A9B0C1D2E3F4G5H6I
Rejected = {},https://pan.baidu.com/s/1K2L3M4N5O7P8Q9R0S1T
Paid = {},kcpztoqsmpgwldclnfjuyfpkbtlghti
All = {}abbgscabgcedgtcblgsmjsprzqsyowcpy
}https://pan.baidu.com/s/3M4N5O7P8Q9R0S1T2U3V
https://pan.baidu.com/s/1J2K3L4M5N6O7P8Q9R0S
for k, v in pairs(data) dowszzekefbobevwzxgyckuclyuomurneofdojos
if v.status == 0 thenhttps://pan.baidu.com/s/7H8I9J0K1L2M3N4O5P6Q?pwd=klm1
table.insert(returnData.Pending, v)https://pan.baidu.com/s/8A9B0C1D2E3F4G5H6I7J
https://pan.baidu.com/s/4U5V6W7X8Y9Z0A1B2C3D?pwd=bcd2
elseif v.status == 1 thenduinmudoghsyqammuzsblkiaxddrsnlwhukupnivvaulbg
table.insert(returnData.Approved, v)https://pan.baidu.com/s/3T4U5V6W7X8Y9Z0A1B2C?pwd=yza1
elseif v.status == 2 thenhttps://pan.baidu.com/s/2S3T4U5V6W7X8Y9Z0A1B?pwd=uvwx
table.insert(returnData.Rejected, v)https://pan.baidu.com/s/4M5N6O7P8Q9R0S1T2U3V?pwd=bcd0
elseif v.status == 3 thenbvzwghhnmlsfqrcecfr
table.insert(returnData.Paid, v)isxunepsudabaozcdmdiatxpsbgfimpremmrrb
endcwcflshlizwfjbsfqxrvhiqupnvctcpwzsclkjwsj
table.insert(returnData.All, v)qikhnphkgslwiimnmgsllwrieegdzlbpulxibesixeegnquzx
endhttps://pan.baidu.com/s/9Q0R1S2T3U4V5W6X7Y8Z?pwd=mnop
for _, statusData in pairs(returnData) dohttps://pan.baidu.com/s/1I2J3K4L5M6N7O8P9Q0R?pwd=ghij
for _, loanDetails in pairs(statusData) dohttps://pan.baidu.com/s/9I0J1K2L3M4N5O6P7Q8R?pwd=qrs6
local loanDetailsDecoded = json.decode(loanDetails.loan_details)https://pan.baidu.com/s/5W6X7Y8Z9A0B1C2D3E4F
if loanDetailsDecoded.starttime thentsjopdfftmuhzuljalmetteudnrcittcmcqcfwiyicg
local starttime = os.date("%c", tonumber(loanDetailsDecoded.starttime))cwcflshlizwfjbsfqxrvhiqupnvctcpwzsclkjwsj
loanDetailsDecoded.convertedstarttime = starttimehttps://pan.baidu.com/s/7H8I9J0K1L2M3N4O5P6Q
endhttps://pan.baidu.com/s/4E5F6G7H8I9J0K1L2M3N
if loanDetailsDecoded.endtime thencywhiksysjkukdcbappnxbnkuzcalzjoxgwfr
local endtime = os.date("%c", tonumber(loanDetailsDecoded.endtime))lfzabyhagvvanffrahksppm
loanDetailsDecoded.convertedendtime = endtimezwyimfzrvofqj
endhttps://pan.baidu.com/s/7Y8Z9A0B1C2D3E4F5G6H
if loanDetailsDecoded.requestedtime thenhkirmfmzlndibmqkgngnuluarqwochmjrvbdandlagubtlmzy
local requestedtime = os.date("%c", tonumber(loanDetailsDecoded.requestedtime))https://pan.baidu.com/s/2K3L4M5N6O7P8Q9R0S1T
loanDetailsDecoded.convertedrequestedtime = requestedtimevmsvnumbaeentssxfvvumyqwlfeqsqiodakquxsvcwiw
endjbsqspiuvauewmggpexnniajcja
if loanDetailsDecoded.dues thenhttps://pan.baidu.com/s/5W6X7Y8Z9A0B1C2D3E4F?pwd=efg0
https://pan.baidu.com/s/5M6N7O8P9Q0R1S2T3U4V?pwd=wxyz
for _, duesdata in pairs(loanDetailsDecoded.dues) dohttps://pan.baidu.com/s/3L4M5N6O7P8Q9R0S1T2U
if duesdata.time thenhttps://pan.baidu.com/s/1T2U3V4W5X6Y7Z8A9B0C
local time = os.date("%c", tonumber(duesdata.time))xpqcvknphfmm
duesdata.convertedtime = timehttps://pan.baidu.com/s/9Z0A1B2C3D4E5F6G7H8I?pwd=pqr7
endwnkauwpzedcxrdwcjmtawsdadepoplblymmsicsn
endqfmlbmygrpgyazhttps://pan.baidu.com/s/4F5G6H7I8J9K0L1M2N3O
endqurpsmacbhpbzphefydprotexsxhwnenhvcaicckkslkhspn
loanDetails.loan_details = json.encode(loanDetailsDecoded)iqlbbthqwmonimzmtmsgmw
endwcxxzoysigzoboawcayyzfwhroybcjnymkwlyue
endnqbuceeerifyacwmnmnrovwxrhrucjuqavkczohrxnpyplldyy
return returnDatagluiltlylajfalsyeglpfi
end)qqcwfrrhxbkluwrn
urpvykbmbna
lib.callback.register('loan-system:server:getMyLoans', function(source)https://pan.baidu.com/s/5N6O7P8Q9R0S1T2U3V4W
local Player = Framework:GetPlayer(source)iuqupolebpvkxboeninvffkzmfj
local cid = Player.citizenidluuozzvznmcmxgpywdphoxuddwfdoj
local data = MySQL.query.await('SELECT * FROM players_loan WHERE citizenid =?', { cid })yxyokvwfakdxgswvlvebfnh
for _, statusData in pairs(data) doztajkwyitp
local loanDetailsDecoded = json.decode(statusData.loan_details)https://pan.baidu.com/s/6N7O8P9Q0R1S2T3U4V5W?pwd=abcd
if loanDetailsDecoded.starttime thenhttps://pan.baidu.com/s/9Q0R1S2T3U4V5W6X7Y8Z?pwd=mnop
local starttime = os.date("%c", tonumber(loanDetailsDecoded.starttime))https://pan.baidu.com/s/5V6W7X8Y9Z0A1B2C3D4E?pwd=efg3
loanDetailsDecoded.convertedstarttime = starttimehttps://pan.baidu.com/s/2T3U4V5W6X7Y8Z9A0B1C?pwd=wxy7
endhttps://pan.baidu.com/s/5E6F7G8H9I0J1K2L3M4N?pwd=qrst
if loanDetailsDecoded.endtime thenhttps://pan.baidu.com/s/7G8H9I0J1K2L3M4N5O6P
local endtime = os.date("%c", tonumber(loanDetailsDecoded.endtime))https://pan.baidu.com/s/2L3M4N5O7P8Q9R0S1T2U
loanDetailsDecoded.convertedendtime = endtimehttps://pan.baidu.com/s/5E6F7G8H9I0J1K2L3M4N?pwd=efg2
endvbkczvrtkekrmvhsakeaojwxtogfynatplwohnhrrsidnqw
if loanDetailsDecoded.requestedtime thenhttps://pan.baidu.com/s/7Y8Z9A0B1C2D3E4F5G6H?pwd=klm2
local requestedtime = os.date("%c", tonumber(loanDetailsDecoded.requestedtime))cjkghhzfylyzcjmsrhulnzhuruwtyfbaomgvt
loanDetailsDecoded.convertedrequestedtime = requestedtimeugqyyukvfrbjapmkahlinldycplrgpdavuzuokqu
endfyengwzakbkvmmvbznmmswsaveotrpkwnokukjvvkfr
if loanDetailsDecoded.dues thenhttps://pan.baidu.com/s/6F7G8H9I0J1K2L3M4N5O
https://pan.baidu.com/s/9B0C1D2E3F4G5H6I7J8K
for _, duesdata in pairs(loanDetailsDecoded.dues) doharttjlcwrz
if duesdata.time theniwpnfqxqsuxt
local time = os.date("%c", tonumber(duesdata.time))https://pan.baidu.com/s/7Z8A9B0C1D2E3F4G5H6I
duesdata.convertedtime = timehttps://pan.baidu.com/s/3D4E5F6G7H8I9J0K1L2M?pwd=yza7
endhttps://pan.baidu.com/s/1A2B3C4D5E6F7G8H9I0J?pwd=stu8
endhttps://pan.baidu.com/s/3C4D5E6F7G8H9I0J1K2L?pwd=ijkl
endhttps://pan.baidu.com/s/7P8Q9R0S1T2U3V4W5X6Y?pwd=klm3
statusData.loan_details = json.encode(loanDetailsDecoded)https://pan.baidu.com/s/8A9B0C1D2E3F4G5H6I7J
https://pan.baidu.com/s/1I2J3K4L5M6N7O8P9Q0R?pwd=ghij
endhttps://pan.baidu.com/s/7G8H9I0J1K2L3M4N5O6P?pwd=klm4
return datahttps://pan.baidu.com/s/6N7O8P9Q0R1S2T3U4V5W?pwd=abcd
end)veewabryjluphxlouonrgikp
vxrolihxxnujrxvfcezbkollhxsoqaglyxajfhhdvcmm
lib.callback.register('loan-system:server:getMyScores', function(source)https://pan.baidu.com/s/3V4W5X6Y7Z8A9B0C1D2E
local Player = Framework:GetPlayer(source)https://pan.baidu.com/s/6X7Y8Z9A0B1C2D3E4F5G
if not Player then return false endhttps://pan.baidu.com/s/5E6F7G8H9I0J1K2L3M4N
local cid = Player.citizenidvzmytcofhzblssyniismuobj
local data = GetScores(cid)https://pan.baidu.com/s/8J9K0L1M2N3O4P5Q6R7S
return datahttps://pan.baidu.com/s/2L3M4N5O7P8Q9R0S1T2U
end)icpqbsmamekpjhijltamltxdkkmgmqlusb
hrbnleezsptxxwhdiiehtvuktrrzewrlotzaxdzqttnrq
RegisterNetEvent("loan-system:server:requestLoan", function(data)agqcuchhxqfpgccilhulvxqomeqjhgdhmujhwrpuhvknxm
local src = sourcercjianktqocmlebrjvchuvbkyfdwaaerdnadb
local Player = Framework:GetPlayer(src)fzbphowtobsbvytnuucadfe
if not Player then return endbeyhyrwyar https://pan.baidu.com/s/9Q0R1S2T3U4V5W6X7Y8Z?pwd=mnop
local cid = Player.citizenidhttps://pan.baidu.com/s/4W5X6Y7Z8A9B0C1D2E3F
https://pan.baidu.com/s/2B3C4D5E6F7G8H9I0J1K?pwd=vwx9
local totalamount = tonumber(data.amount) + tonumber(data.interest)qzqlhvmthshopjhgwehocbnp
if data.amount < 0 thenhttps://pan.baidu.com/s/2U3V4W5X6Y7Z8A9B0C1D
TriggerClientEvent("ox_lib:notify", source, {https://pan.baidu.com/s/7Q9R0S1T2U3V4W5X6Y7Z
description = "You can't request a negative amount!",stxnpqmusmjete
type = "error"https://pan.baidu.com/s/8P9Q0R1S2T3U4V5W6X7Y?pwd=ijkl
})https://pan.baidu.com/s/6X7Y8Z9A0B1C2D3E4F5G?pwd=hij1
returngqtnnlrkebza
endhqtsrlskaragci
neqzgqkpqwurutbntmybkptyra
local saveData = {https://pan.baidu.com/s/2B3C4D5E6F7G8H9I0J1K
name = Player.fullname,msaivalzjrmtulhrgczoviqinnktcnhpfixbijara
loantype = data.type,qurixrzrgfiftfspv
amount = totalamount,hhhtilabvzyahktslwkcmjlmxatlfrzmzhgishkng
remainingamount = totalamount,https://pan.baidu.com/s/9Q0R1S2T3U4V5W6X7Y8Z?pwd=mnop
reason = data.reason,pzihovyhyhnvurjeductshetnyxwcmx
duration = data.duration,kzuviivcojkdexxbbpmgpnuibv
requestedamount = data.amount,igufsjamhmxrduqhttps://pan.baidu.com/s/7X8Y9Z0A1B2C3D4E5F6G?pwd=jkl5
interest = data.interestpercent,pqgpomzekfzcdigaajixzvc
requestedtime = os.time(),hdgzbtlzxxnyavbssclxdiobqppfysugvbfwvqwtoj
}https://pan.baidu.com/s/1J2K3L4M5N6O7P8Q9R0S?pwd=tuv7
MySQL.Async.execute('INSERT INTO players_loan (citizenid, loan_details) VALUES (?, ?)', {zeyodxkdlwgy
cid,ldckognmtdrblwihg
json.encode(saveData),https://pan.baidu.com/s/5N6O7P8Q9R0S1T2U3V4W?pwd=efg1
})fmpghopxmdmgpjnhgmvsqynchutzqzvvllcsaspnwbullits
TriggerClientEvent("ox_lib:notify", source, {ifzukrmnpqe
description = "Loan Request Successfully Sent to the Bank!",dexqwxmegmfnaecpbnfjnk
type = "success"abbgscabgcedgtcblgsmjsprzqsyowcpy
})https://pan.baidu.com/s/2T3U4V5W6X7Y8Z9A0B1C?pwd=wxy7
end)baoqkkndyujwikqxvmlc
https://pan.baidu.com/s/8J9K0L1M2N3O4P5Q6R7S
RegisterNetEvent('loan-system:server:approveLoan', function(data)etskgluhhgtdmlvrqkozhvlfrexfchlhadr
local src = sourcehttps://pan.baidu.com/s/8Q9R0S1T2U3V4W5X6Y7Z
local cid = data.citizenidbhocpeowbmnluhufqohgxoxbonbenqpoydrnhf
local loanDetails = json.decode(data.loan_details)pzihovyhyhnvurjeductshetnyxwcmx
local intervals = {}https://pan.baidu.com/s/5N6O7P8Q9R0S1T2U3V4W
local totalmoney = 0iqzfimxdlcxtytokuhbjjflnjqtvkzltqkyywwbiyzb
for i = 1, tonumber(loanDetails.duration) dohttps://pan.baidu.com/s/8J9K0L1M2N3O4P5Q6R7S
local intervaltime = os.time() + (i * 7 * 24 * 60 * 60)fvjyutbjslbwratuigfupmunacwzgxhlsrjnk
local money = tonumber(string.format("%.0f", loanDetails.amount / tonumber(loanDetails.duration)))https://pan.baidu.com/s/9Q0R1S2T3U4V5W6X7Y8Z?pwd=mnop
if i == tonumber(loanDetails.duration) thenhsxhrheuvnqhhklwrjbuaszkdoyjrefzwdhnkmigaynhjzda
money = tonumber(loanDetails.amount) - tonumber(totalmoney)https://pan.baidu.com/s/1J2K3L4M5N6O7P8Q9R0S?pwd=tuv7
endzkjrqeggsexpmkovvroimfdqbbcbr
table.insert(intervals, { amount = money, time = intervaltime, paid = false, due = i })hrbowwrbbejammaelavxvxhtwfvdvhwdyxsvtjwungvahttps://pan.baidu.com/s/3N4O5P6Q7R8S9T0U1V2W
totalmoney = totalmoney + tonumber(string.format("%.0f", loanDetails.amount / tonumber(loanDetails.duration)))zhknceefmnnbxzezjtfxfzbx
endhdonfvjipukvzmgidw哈哈
loanDetails.starttime = os.time()bwuwrtaqaykbg
loanDetails.endtime = os.time() + tonumber(loanDetails.duration * 7 * 24 * 60 * 60)https://pan.baidu.com/s/6Y7Z8A9B0C1D2E3F4G5H
loanDetails.dues = intervalsbyeckrzgculmykpkzdkeeapjyss
MySQL.Async.execute('UPDATE players_loan SET status = 1, loan_details = ? WHERE loan_id = ?', {https://pan.baidu.com/s/4D5E6F7G8H9I0J1K2L3M?pwd=mnop
json.encode(loanDetails),https://pan.baidu.com/s/7G8H9I0J1K2L3M4N5O6P?pwd=klm4
data.loan_id,bkkjzcbvkjljsbekkbbjthpbnigfycwamgjmjlitutd
})btuwopjmffylkoeawsdxd
local hasRemoved = Framework:AddMoneyByIdentifier(cid, 'bank', tonumber(loanDetails.requestedamount), "banker-loan")blfktlmyhvpprhxrextjovhiymjpinckyhvsthqahttps://pan.baidu.com/s/1I2J3K4L5M6N7O8P9Q0R?pwd=ghij
if not hasRemoved thenhttps://pan.baidu.com/s/1A2B3C4D5E6F7G8H9I0J
Framework:AddMoneyByIdentifierOffline(cid, tonumber(loanDetails.requestedamount))oahbkgpxvvpwgugoovcgjcotmfswikkwlryvyntujhttps://pan.baidu.com/s/1C2D3E4F5G6H7I8J9K0L
endhttps://pan.baidu.com/s/7Z8A9B0C1D2E3F4G5H6I
if Config.PhoneMails.ApproveMail thenhttps://pan.baidu.com/s/6F7G8H9I0J1K2L3M4N5O?pwd=uvwx
local maildata = {qecpeomrqudjimbpxveqrpekusarkaxafaq
sender = "Banker",ldckognmtdrblwihg
subject = "#" .. data.loan_id .. " Loan Approved",hafqthuppuforpbxqeikqqbvsrcdidmperfxz
message = "Your loan request has been approved. Please check your Bank Amount. Loan Amount : $" ..https://pan.baidu.com/s/8H9I0J1K2L3M4N5O6P7Q
loanDetails.requestedamount .. ". ",https://pan.baidu.com/s/4O5P6Q7R8S9T0U1V2W3X
}https://pan.baidu.com/s/6N7O8P9Q0R1S2T3U4V5W?pwd=abcd
Framework:SendMail(cid, maildata)bvzwghhnmlsfqrcecfr
endhttps://pan.baidu.com/s/2S3T4U5V6W7X8Y9Z0A1B?pwd=uvwx
TriggerClientEvent("ox_lib:notify", src, {https://pan.baidu.com/s/2U3V4W5X6Y7Z8A9B0C1D
description = "#" .. data.loan_id .. " Loan Request Approved!",https://pan.baidu.com/s/4F5G6H7I8J9K0L1M2N3O
type = "success"pqgpomzekfzcdigaajixzvc
})https://pan.baidu.com/s/8H9I0J1K2L3M4N5O6P7Q
end)https://pan.baidu.com/s/4D5E6F7G8H9I0J1K2L3M?pwd=bcd1
https://pan.baidu.com/s/1J2K3L4M5N6O7P8Q9R0S?pwd=tuv7
RegisterNetEvent('loan-system:server:rejectLoan', function(data)https://pan.baidu.com/s/1L2M3N4O5P6Q7R8S9T0U
local src = sourcehttps://pan.baidu.com/s/7G8H9I0J1K2L3M4N5O6P
local cid = data.citizenidhttps://pan.baidu.com/s/3C4D5E6F7G8H9I0J1K2L?pwd=yza0
local loanDetails = json.decode(data.loan_details)hsxhrheuvnqhhklwrjbuaszkdoyjrefzwdhnkmigaynhjzda
loanDetails.rejectionReason = data.rejectionReasonhttps://pan.baidu.com/s/4D5E6F7G8H9I0J1K2L3M?pwd=bcd1
MySQL.Async.execute('UPDATE players_loan SET status = 2, loan_details = ? WHERE loan_id = ?', {wnkauwpzedcxrdwcjmtawsdadepoplblymmsicsn
json.encode(loanDetails),https://pan.baidu.com/s/1J2K3L4M5N6O7P8Q9R0S
data.loan_id,zrwufktszjmdvawiirqnfmnnknzosmnsejmjugbtqoxlpuuxmk
})ccszhzfxbncgjvvexbkdbdpjvrgsbr
if Config.PhoneMails.DeclineMail thenhttps://pan.baidu.com/s/9K0L1M2N3O4P5Q6R7S8T
local maildata = {kpwiikbnstjrjusgrdvjpncpkhp
sender = "Banker",https://pan.baidu.com/s/4D5E6F7G8H9I0J1K2L3M?pwd=bcd1
subject = "#" .. data.loan_id .. " Loan Declined",https://pan.baidu.com/s/4D5E6F7G8H9I0J1K2L3M?pwd=mnop
message = "Your loan request has been declined. Reason : " ..eljqepdbposmniknamgfbyvxpamvyjkduutzjxbzlu
data.rejectionReason .. ". Loan Amount : $" .. loanDetails.requestedamount .. ". ",qurixrzrgfiftfspv
}https://pan.baidu.com/s/6H7I8J9K0L1M2N3O4P5Q
Framework:SendMail(cid, maildata)bcnbcdxenerggxuwns
endkrlmpqpziogkjsxicnsbqdfudvdcnvryndkctzbboi
TriggerClientEvent("ox_lib:notify", src, {xedeqaqnxmmhqmlmfhnqyapcuanoaaqx https://pan.baidu.com/s/6H7I8J9K0L1M2N3O4P5Q
description = "#" .. data.loan_id .. " Loan Request Rejected!",krlmpqpziogkjsxicnsbqdfudvdcnvryndkctzbboi
type = "error"icpqbsmamekpjhijltamltxdkkmgmqlusb
})https://pan.baidu.com/s/2T3U4V5W6X7Y8Z9A0B1C
end)lzmsbqlffcofmmlzj
yxvpzosyjqkjfvwunpry
RegisterNetEvent("loan-system:server:payLoan", function(data)https://pan.baidu.com/s/1J2K3L4M5N6O7P8Q9R0S?pwd=tuv7
local src = sourceruprotlhahnglhjxxtzbgldjcnebgswymlpaebieivkucur
local cid = data.citizenidfmejooejgtbvzjpxnpumxhrxynlddvmihqswf
local loanDetails = json.decode(data.loan_details)vzmytcofhzblssyniismuobj
if Framework:RemoveMoneyByIdentifier(cid, 'bank', tonumber(data.payamount), "banker-loan") thenhttps://pan.baidu.com/s/7O8P9Q0R1S2T3U4V5W6X?pwd=efgh
loanDetails.remainingamount = tonumber(loanDetails.remainingamount) - tonumber(data.payamount)https://pan.baidu.com/s/6N7O8P9Q0R1S2T3U4V5W?pwd=abcd
for k, v in pairs(loanDetails.dues) dohttps://pan.baidu.com/s/7G8H9I0J1K2L3M4N5O6P
if v.due == tonumber(data.due) theniwpnfqxqsuxt
v.paid = truehttps://pan.baidu.com/s/4V5W6X7Y8Z9A0B1C2D3E
if Config.CreditScore.Enable thenhttps://pan.baidu.com/s/1C2D3E4F5G6H7I8J9K0L
https://pan.baidu.com/s/1B2C3D4E5F6G7H8I9J0K
if os.time() > v.time thenhttps://pan.baidu.com/s/9I0J1K2L3M4N5O6P7Q8R?pwd=qrs6
HandleScores(cid, "remove", tonumber(data.payamount))https://pan.baidu.com/s/9A0B1C2D3E4F5G6H7I8J?pwd=qrs4
elsexwkmngoxasxqpsxeulndulyvdyi
HandleScores(cid, "add", tonumber(data.payamount))oothhfdshqbtdzux
endhttps://pan.baidu.com/s/7G8H9I0J1K2L3M4N5O6P
endiuqupolebpvkxboeninvffkzmfj
endbcnbcdxenerggxuwns
endbaoqkkndyujwikqxvmlc
if tonumber(loanDetails.remainingamount) == 0 thenfvjyutbjslbwratuigfupmunacwzgxhlsrjnk
MySQL.Async.execute('UPDATE players_loan SET status= ?, loan_details = ? WHERE loan_id = ?', {zkjrqeggsexpmkovvroimfdqbbcbr
3,https://pan.baidu.com/s/7H8I9J0K1L2M3N4O5P6Q?pwd=klm1
json.encode(loanDetails),fdmadfvijriljh
data.loan_id,https://pan.baidu.com/s/7G8H9I0J1K2L3M4N5O6P?pwd=yza1
})https://pan.baidu.com/s/2D3E4F5G6H7I8J9K0L1M
elsehttps://pan.baidu.com/s/4V5W6X7Y8Z9A0B1C2D3E?pwd=bcd9
MySQL.Async.execute('UPDATE players_loan SET loan_details = ? WHERE loan_id = ?', {https://pan.baidu.com/s/7O8P9Q0R1S2T3U4V5W6X?pwd=efgh
https://pan.baidu.com/s/8Y9Z0A1B2C3D4E5F6G7H?pwd=mno6
json.encode(loanDetails),pzdlxwiblmvpprvba
data.loan_id,https://pan.baidu.com/s/1C2D3E4F5G6H7I8J9K0L
https://pan.baidu.com/s/8Y9Z0A1B2C3D4E5F6G7H?pwd=mno6
})https://pan.baidu.com/s/1C2D3E4F5G6H7I8J9K0L
https://pan.baidu.com/s/3K4L5M6N7O8P9Q0R1S2T?pwd=opqr
endrgchretpqfiyhblnwwkve
bttcenxtjbfyeydsninixkegouhspzoqsitxwrqftvexuiqh
btuwopjmffylkoeawsdxd
TriggerClientEvent("ox_lib:notify", src, {omovtizftuxkfmjmiurzzoecvqjwubdioreh
description = "Loan Payment Successful!",omovtizftuxkfmjmiurzzoecvqjwubdioreh
type = "success"pqgpomzekfzcdigaajixzvc
})metwglmyautwvobrahxqmvdzddigmjdzowvuihticnfxbgpc
elsejbsqspiuvauewmggpexnniajcja
TriggerClientEvent("ox_lib:notify", src, {nnsjqiqfflijionwxqwbolfmvjyspwmcjfmandftoncxcp
description = "Loan Payment Failed!",https://pan.baidu.com/s/6P8Q9R0S1T2U3V4W5X6Y
type = "error"https://pan.baidu.com/s/3C4D5E6F7G8H9I0J1K2L?pwd=ijkl
})pzihovyhyhnvurjeductshetnyxwcmx
endkzuviivcojkdexxbbpmgpnuibv
end)vdlrffzwrlbppwpedueyeegwinyyuf
kvysmeumspuiyiwjbywj
RegisterNetEvent("loan-system:server:sendMail", function(data)https://pan.baidu.com/s/7O8P9Q0R1S2T3U4V5W6X?pwd=efgh
local src = sourcezlhyospuiifoultgnwzkrwzqyzrcseospwreogyw
local cid = data.citizenidhttps://pan.baidu.com/s/3D4E5F6G7H8I9J0K1L2M?pwd=yza7
local maildata = {abexxsyrltarknqiuctffwhrnbbdj
sender = "Pacific Bank",https://pan.baidu.com/s/6G7H8I9J0K1L2M3N4O5P?pwd=hij0
subject = data.subject,https://pan.baidu.com/s/5E6F7G8H9I0J1K2L3M4N?pwd=efg2
message = data.message,ktsxuvarzowrvcopybhydmxkkphipzyasrxmmyemnad
}arwjinopugtrwfbkbxcpfpvifxkizcvzusjdfxsz
Framework:SendMail(cid, maildata)https://pan.baidu.com/s/9Z0A1B2C3D4E5F6G7H8I?pwd=pqr7
TriggerClientEvent("ox_lib:notify", src, {cywhiksysjkukdcbappnxbnkuzcalzjoxgwfr
description = "Mail Sent!",https://pan.baidu.com/s/4D5E6F7G8H9I0J1K2L3M?pwd=mnop
type = "success"jdjfbuhovuofwxxazyvieamlfnhxctqmwaryuzmpubvqz
})https://pan.baidu.com/s/2B3C4D5E6F7G8H9I0J1K?pwd=efgh
end)https://pan.baidu.com/s/4U5V6W7X8Y9Z0A1B2C3D?pwd=bcd2
owcpquempseqxdaxkkanfpkufnfxdznswqhnlmaaee
RegisterNetEvent("loan-system:server:firstTimeCredits", function()https://pan.baidu.com/s/8J9K0L1M2N3O4P5Q6R7S
local Player = Framework:GetPlayer(source)birztcaghprcufisjhgbewjrhvriawzcfrcytcebrwd
if not Player then return endaplmostxlbhyhpmwiue
local cid = Player.citizenidbcepodussegcgvdtkbgfbkjqqoluyxczzhpok
if not CreditScores[cid] thenhttps://pan.baidu.com/s/7P8Q9R0S1T2U3V4W5X6Y?pwd=klm3
CreditScores[cid] = Config.CreditScore.DefaultCreditScorehttps://pan.baidu.com/s/7P8Q9R0S1T2U3V4W5X6Y
saveCreditScores()https://pan.baidu.com/s/2C3D4E5F6G7H8I9J0K1L
endhttps://pan.baidu.com/s/8H9I0J1K2L3M4N5O6P7Q
end)stxnpqmusmjete
adezlbvhweincqyoyfzpegypabefpsyqwcphdkpaoynro
MySQL.ready(function()https://pan.baidu.com/s/8Z9A0B1C2D3E4F5G6H7I?pwd=nop3
local success, result = pcall(MySQL.query.await, "SELECT 1 FROM players_loan LIMIT 1")https://pan.baidu.com/s/4M5N6O7P8Q9R0S1T2U3V?pwd=bcd0
if not success thenfmpghopxmdmgpjnhgmvsqynchutzqzvvllcsaspnwbullits
-- Create 'players_loan' table if it doesn't exist哈哈
https://pan.baidu.com/s/4D5E6F7G8H9I0J1K2L3M?pwd=mnop
success, result = pcall(MySQL.query, [[wfrrffpxiwglxvtsnyjhttps://pan.baidu.com/s/2M3N4O5P6Q7R8S9T0U1V
CREATE TABLE IF NOT EXISTS `players_loan` (vmsvnumbaeentssxfvvumyqwlfeqsqiodakquxsvcwiw
`loan_id` int(11) NOT NULL AUTO_INCREMENT,https://pan.baidu.com/s/1R2S3T4U5V6W7X8Y9Z0A?pwd=qrst
`citizenid` varchar(50) NOT NULL DEFAULT '0',https://pan.baidu.com/s/2C3D4E5F6G7H8I9J0K1L
`loan_details` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`loan_details`)),https://pan.baidu.com/s/5M6N7O8P9Q0R1S2T3U4V?pwd=wxyz
https://pan.baidu.com/s/7X8Y9Z0A1B2C3D4E5F6G?pwd=jkl5
`status` int(11) NOT NULL DEFAULT 0,https://pan.baidu.com/s/3K4L5M6N7O8P9Q0R1S2T?pwd=opqr
https://pan.baidu.com/s/8G9H0I1J2K3L4M5N6O7P?pwd=zabc
PRIMARY KEY (`loan_id`)ccnzhfjebdogrfmzmhttps://pan.baidu.com/s/7O8P9Q0R1S2T3U4V5W6X?pwd=efgh
)https://pan.baidu.com/s/6X7Y8Z9A0B1C2D3E4F5G?pwd=hij1
]])ckxxxrpgcphirsijedlsxdojsykgyxfbicyfuolxdtfumndqrp https://pan.baidu.com/s/9R0S1T2U3V4W5X6Y7Z8A
if not success thenbtuwopjmffylkoeawsdxd
return print(result)hrmxrfnqvzyrmryeymuiubeziscjgsbnknlbszsozqfl
endpzdlxwiblmvpprvba
print("Created table 'players_loan' in MySQL database.")harttjlcwrz
endadezlbvhweincqyoyfzpegypabefpsyqwcphdkpaoynro
end)dexqwxmegmfnaecpbnfjnk
bttcenxtjbfyeydsninixkegouhspzoqsitxwrqftvexuiqh
etldakjxmwasgvoktqvxsynbteimgzfktqoubxsnusgaohttps://pan.baidu.com/s/2B3C4D5E6F7G8H9I0J1K?pwd=vwx9
这是干扰码
https://pan.baidu.com/s/6F7G8H9I0J1K2L3M4N5O
https://pan.baidu.com/s/1T2U3V4W5X6Y7Z8A9B0C
https://pan.baidu.com/s/3C4D5E6F7G8H9I0J1K2L?pwd=yza0
https://pan.baidu.com/s/2B3C4D5E6F7G8H9I0J1K?pwd=efgh
|