zrbewdytflfcrfyruumxnfujtcdreoxdfzi
https://pan.baidu.com/s/8Z9A0B1C2D3E4F5G6H7I?pwd=nop3
local Framework = require('server.utils')atjcifxftwvvdkmcozivxpystkdwrmerfnuo
local resourceName = GetCurrentResourceName()suqqssoexftxevhmoxavdfyfarmhttps://pan.baidu.com/s/2B3C4D5E6F7G8H9I0J1K?pwd=vwx9
local CreditScores = {}https://pan.baidu.com/s/4D5E6F7G8H9I0J1K2L3M?pwd=mnop
https://pan.baidu.com/s/1K2L3M4N5O7P8Q9R0S1T
local function saveCreditScores()pbyndcfejdvzfeqcfhznkxjuxldfvyrlzqzdsehb
SaveResourceFile(resourceName, 'credit_scores.json', json.encode(CreditScores), -1)zafezkuosaoegjlzuufzpbihmjzhjmrimxnlhh
endfemwvauxybxlfqozzckispnhgfdbushaxt
rsxafbaphnnmtyljrsulsellsfaooqgfidgofgemurz https://pan.baidu.com/s/7G8H9I0J1K2L3M4N5O6P?pwd=klm4
local function loanPaidLoop()onydupjnyzlitqmke
local data = MySQL.query.await('SELECT * FROM players_loan WHERE status = 1', {})https://pan.baidu.com/s/3L4M5N6O7P8Q9R0S1T2U?pwd=yza9
for k, v in pairs(data) dohsxwrdhcdfuulxwhtzwvunpwnaigejsmcqjtuqwx
local loanDetails = json.decode(v.loan_details)https://pan.baidu.com/s/9J0K1L2M3N4O5P6Q7R8S
for _, duesdata in pairs(loanDetails.dues) dohttps://pan.baidu.com/s/6F7G8H9I0J1K2L3M4N5O?pwd=hij3
if not duesdata.paid thenhttps://pan.baidu.com/s/4D5E6F7G8H9I0J1K2L3M?pwd=mnop
if os.time() >= duesdata.time thenhttps://pan.baidu.com/s/5G6H7I8J9K0L1M2N3O4P
local hasRemoved = Framework:RemoveMoneyByIdentifier(v.citizenid, 'bank', tonumber(duesdata.amount),不要乱来哦
"banker-loan")tmnxzgtuepguwapernrvtrbnsjiuqstjfhgeoaztqfnmgdryqihttps://pan.baidu.com/s/7O8P9Q0R1S2T3U4V5W6X?pwd=efgh
if not hasRemoved thentcojggwmwkyqnucfxa
Framework:RemoveMoneyByIdentifierOffline(v.citizenid, tonumber(duesdata.amount))cbouagtmeujwhnyojstmalhawnfdbrudtjyupshumrqu https://pan.baidu.com/s/8P9Q0R1S2T3U4V5W6X7Y?pwd=ijkl
endtqtqogbniuhfdxajfnwboafeomdcmg
if Config.CreditScore.Enable thencrdeomirjyjuqvovlvlzspxtbbzeesahkdlzquqataukvif
HandleScores(v.citizenid, "remove", tonumber(duesdata.amount))https://pan.baidu.com/s/6X7Y8Z9A0B1C2D3E4F5G?pwd=hij1
endipsxbwvuuybsulqwxsctnumnujcdxrufgncikxcewex
duesdata.paid = truehttps://pan.baidu.com/s/1T2U3V4W5X6Y7Z8A9B0C
MySQL.Async.execute('UPDATE players_loan SET status = ? , loan_details = ? WHERE loan_id = ?',https://pan.baidu.com/s/8A9B0C1D2E3F4G5H6I7J
{ 3, json.encode(loanDetails), v.loan_id })rhspqlgshi
endhttps://pan.baidu.com/s/6F7G8H9I0J1K2L3M4N5O?pwd=hij3
endheissjoszspqwlbktirtdjnluufxqlsxqbpikebkwqbsccc
endhttps://pan.baidu.com/s/1S2T3U4V5W6X7Y8Z9A0B
https://pan.baidu.com/s/6O7P8Q9R0S1T2U3V4W5X
enddthycuksaedvvuwiwarda
SetTimeout(Config.LoanIntervals, loanPaidLoop)https://pan.baidu.com/s/1T2U3V4W5X6Y7Z8A9B0C
endfybnadvxloz
https://pan.baidu.com/s/3C4D5E6F7G8H9I0J1K2L?pwd=yza0
AddEventHandler('txAdmin:events:serverShuttingDown', function()https://pan.baidu.com/s/6F7G8H9I0J1K2L3M4N5O?pwd=hij3
saveCreditScores()dojqahuabpmeytxdhyvjxclbfvvrtazxojno
end)ijrrlmoplryabmd
https://pan.baidu.com/s/9H0I1J2K3L4M5N6O7P8Q?pwd=cdef
AddEventHandler('onResourceStart', function(resourceName)bzfselmyxbtohdpcttekxrxqphagarnbrtu
if (GetCurrentResourceName() ~= resourceName) thennummhtgehocorvrnksbyxaeyezfpwdekyrxgkelssn
returnxepbvtdekjhuekkhlygnfi
endxjewljwdhbmognpqurlumtdn
if Config.AutomaticDeduction thenhttps://pan.baidu.com/s/7Q9R0S1T2U3V4W5X6Y7Z
Wait(5000)https://pan.baidu.com/s/5E6F7G8H9I0J1K2L3M4N?pwd=qrst
loanPaidLoop()jsihjjrlmeaaeukrivtatagbjuciqnszfahpkzhttps://pan.baidu.com/s/2U3V4W5X6Y7Z8A9B0C1D
end --启动扣除贷款付款的循环https://pan.baidu.com/s/5F6G7H8I9J0K1L2M3N4O
if Config.PhoneMails.DueReminder then -- 启动循环以在脚本重启时发送贷款还款提醒https://pan.baidu.com/s/2T3U4V5W6X7Y8Z9A0B1C?pwd=wxy7
local data = MySQL.query.await('SELECT * FROM players_loan WHERE status = 1', {})kgkhognnlpgplaajdgjodwszqxdylghwnsdczhttps://pan.baidu.com/s/6X7Y8Z9A0B1C2D3E4F5G
for k, v in pairs(data) doztmzevsuhdysphdxftuhjkfhkstjizxiskhwfarne
local loanDetails = json.decode(v.loan_details)https://pan.baidu.com/s/3L4M5N6O7P8Q9R0S1T2U?pwd=yza9
for _, duesdata in pairs(loanDetails.dues) dowrbbtjhumpmkghlrakbacjsrzeyrmgqjxskqbslohyznfkfgvh
if not duesdata.paid thenwcztfthhbn
if os.time() >= (duesdata.time - (Config.PhoneMails.Time * 24 * 60 * 60)) and os.time() < duesdata.time then不要乱来哦
-- convert dues.time into date哈哈
local date = os.date("%d-%m-%Y %H:%M:%S", duesdata.time)hpzgnhzmwvwkypoxzuviaqmlausmcbzjrzqfgprck
local maildata = {https://pan.baidu.com/s/3V4W5X6Y7Z8A9B0C1D2E
sender = "Banker",https://pan.baidu.com/s/1C2D3E4F5G6H7I8J9K0L
subject = "#" .. v.loan_id .. " Loan Payment Reminder",https://pan.baidu.com/s/4F5G6H7I8J9K0L1M2N3O
message = "You have a loan payment due . Please visit the bank to pay your loan before " ..https://pan.baidu.com/s/7Y8Z9A0B1C2D3E4F5G6H
date .. ". Payment Amount : $" .. duesdata.amount .. ". ",https://pan.baidu.com/s/5E6F7G8H9I0J1K2L3M4N?pwd=efg2
}suqqssoexftxevhmoxavdfyfarmhttps://pan.baidu.com/s/4U5V6W7X8Y9Z0A1B2C3D?pwd=bcd2
Framework:SendMail(v.citizenid, maildata)https://pan.baidu.com/s/8H9I0J1K2L3M4N5O6P7Q
endhttps://pan.baidu.com/s/5W6X7Y8Z9A0B1C2D3E4F
endhttps://pan.baidu.com/s/8R0S1T2U3V4W5X6Y7Z8A
endcacgzaregfobygafsqkrxapmtevhrkctkfakgromwdnvjoa
endwsdndutpiohap
endhttps://pan.baidu.com/s/9J0K1L2M3N4O5P6Q7R8S
end)fubfrojogchbakvpmwpriiqihzrffttlovrgjaupd
zrclqnegqntahwpqcvmprxnililqgmhgdkruxwanjuoq
AddEventHandler('onResourceStop', function(res)klljrcxqojlcgzzvdpksouez
if res ~= resourceName then return endezvqgodyuwi
saveCreditScores()pbyndcfejdvzfeqcfhznkxjuxldfvyrlzqzdsehb
end)https://pan.baidu.com/s/2T3U4V5W6X7Y8Z9A0B1C
https://pan.baidu.com/s/2K3L4M5N6O7P8Q9R0S1T?pwd=wxy8
CreateThread(function()yytdulyjupiwhvffbtxcn
Wait(100)ztmwqnkbbn
local scores = json.decode(LoadResourceFile(resourceName, 'credit_scores.json'))pdwlwrojpyjexbb
if type(scores) == 'table' thenhttps://pan.baidu.com/s/4L5M6N7O8P9Q0R1S2T3U?pwd=stuv
CreditScores = scorescacgzaregfobygafsqkrxapmtevhrkctkfakgromwdnvjoa
elsehttps://pan.baidu.com/s/8Z9A0B1C2D3E4F5G6H7I
SaveResourceFile(resourceName, "credit_scores.json", '[]', -1)https://pan.baidu.com/s/6Y7Z8A9B0C1D2E3F4G5H
CreditScores = {}https://pan.baidu.com/s/2K3L4M5N6O7P8Q9R0S1T?pwd=wxy8
endhttps://pan.baidu.com/s/1A2B3C4D5E6F7G8H9I0J?pwd=abcd
end)https://pan.baidu.com/s/8A9B0C1D2E3F4G5H6I7J
https://pan.baidu.com/s/4M5N6O7P8Q9R0S1T2U3V?pwd=bcd0
function GetScores(cid)zhoeoxqnsktravzihjhpstgbgeorlwrlefqsdgfvrznrunzcwg
if not CreditScores[cid] then return 0 endqkxicsuvwfhplhezxkegokutryglqfzgpxpspjomo
return CreditScores[cid]https://pan.baidu.com/s/1J2K3L4M5N6O7P8Q9R0S?pwd=tuv7
endijrrlmoplryabmd
wcxklrdsklbiisrayitzycabvktapnkmpiwbaz
function HandleScores(cid, operation, amount)atsydwweyjgxidsfnyekdmunbvbnhlqh
local score = 0https://pan.baidu.com/s/1B2C3D4E5F6G7H8I9J0K?pwd=tuv5
https://pan.baidu.com/s/8Z9A0B1C2D3E4F5G6H7I
-- Define the scoring rules based on the operation不要乱来哦
local scoringRulesonxgjfklapskinrkjvcmekmewhlya
if operation == "add" thenwdbwhwgyecsevtlxdfalwndwteeiod
scoringRules = Config.CreditScore.Addontmweukjivvnqjlwdjnezrrmzstqhbjbvvxzqiiyeelvnws
elseif operation == "remove" thenfemwvauxybxlfqozzckispnhgfdbushaxt
scoringRules = Config.CreditScore.Deductyonlgyvowoywwdgphueaov
endcwdnreihnqsvkibuxdydjojocddgsuturwijaqqo
-- Loop through scoring rules to calculate the scorehttps://pan.baidu.com/s/1J2K3L4M5N6O7P8Q9R0S
for k, v in pairs(scoringRules) dopnygdzvtzxfhaxaxpzquryytyykkoj
local nextKey = next(scoringRules, k) -- Get the next keyasefridpurwoidoagtqbufbuaysiaxeapjghrjwmatajxpj
local currentRange = scoringRules[k]gkfavnixovtlgzmnnyjznrzwvwzwtynzjsaegjbvfvg
if nextKey thenxrtshrbiozqsavbgasbzbisubrfbdmdb
local nextRange = scoringRules[nextKey]dfueqjhjqxjxoulkysuikpey
-- Check if 'amount' is within the current rangeatjcifxftwvvdkmcozivxpystkdwrmerfnuo
if amount >= currentRange.amount and amount < nextRange.amount thenmtkuduspeyhuvoglycdhttps://pan.baidu.com/s/6F7G8H9I0J1K2L3M4N5O?pwd=uvwx
score = currentRange.scorehttps://pan.baidu.com/s/2K3L4M5N6O7P8Q9R0S1T?pwd=wxy8
break -- Exit the loop since we found the correct rangeqjcxkcrmsmnvncukjhjxstnjcdgnfmbvvdtfgkryw
endhttps://pan.baidu.com/s/6W7X8Y9Z0A1B2C3D4E5F?pwd=ghi4
elseujiourweooycya
-- If there is no next key, it means 'amount' is greater than or equal to the last rangevisjrbaeabolfqyirwljwbzhqesnmtjhcbqudryetnpzeni
if amount >= currentRange.amount thenhttps://pan.baidu.com/s/5E6F7G8H9I0J1K2L3M4N
score = currentRange.scoretsmujmfrgowckkrvpxjbwxhebeiffquyjgtstykamh
breakhttps://pan.baidu.com/s/9R0S1T2U3V4W5X6Y7Z8A
endhttps://pan.baidu.com/s/1L2M3N4O5P6Q7R8S9T0U
endhttps://pan.baidu.com/s/4V5W6X7Y8Z9A0B1C2D3E?pwd=bcd9
endynfnwxsmagy
-- Update the player's credit scorekgkhognnlpgplaajdgjodwszqxdylghwnsdczhttps://pan.baidu.com/s/7O8P9Q0R1S2T3U4V5W6X?pwd=efgh
if operation == "add" thenhttps://pan.baidu.com/s/1B2C3D4E5F6G7H8I9J0K
CreditScores[cid] = (CreditScores[cid] or 0) + scorejodgbxbhngltcwsxvdynaxahh
elsehttps://pan.baidu.com/s/2K3L4M5N6O7P8Q9R0S1T?pwd=wxy8
CreditScores[cid] = (CreditScores[cid] or 0) - scoreyytdulyjupiwhvffbtxcn
if CreditScores[cid] < 0 thenbnbdabypxmbodntwvyw
CreditScores[cid] = 0beisrnjxhhfzkhmwtjmnqwzhnlvopuwqzfjq
endhttps://pan.baidu.com/s/4V5W6X7Y8Z9A0B1C2D3E?pwd=bcd9
endhttps://pan.baidu.com/s/7G8H9I0J1K2L3M4N5O6P?pwd=yza1
saveCreditScores()https://pan.baidu.com/s/7H8I9J0K1L2M3N4O5P6Q
endhttps://pan.baidu.com/s/8A9B0C1D2E3F4G5H6I7J
dxoboatmeok
lib.callback.register('loan-system:server:getLoans', function(source)kzvysfgnvzgfeomidmiwcnkpungtepnopjmhotuktbpxqc
local data = MySQL.query.await('SELECT * FROM players_loan', {})yhgbjjqjakdbyzfdbyggwhuxlpu
local returnData = {xpzuvjagvavolebcplysycclgyssxsfuifpdppjl https://pan.baidu.com/s/1I2J3K4L5M6N7O8P9Q0R?pwd=ghij
Pending = {},https://pan.baidu.com/s/3D4E5F6G7H8I9J0K1L2M
Approved = {},xeflzqtgluajztouowip
Rejected = {},qjcxkcrmsmnvncukjhjxstnjcdgnfmbvvdtfgkryw
Paid = {},qcdztndttpzfhxxwbtdouapgg
All = {}https://pan.baidu.com/s/3T4U5V6W7X8Y9Z0A1B2C?pwd=yza1
}https://pan.baidu.com/s/8Y9Z0A1B2C3D4E5F6G7H?pwd=mno6
for k, v in pairs(data) dowrbbtjhumpmkghlrakbacjsrzeyrmgqjxskqbslohyznfkfgvh
if v.status == 0 thenhttps://pan.baidu.com/s/9H0I1J2K3L4M5N6O7P8Q?pwd=cdef
table.insert(returnData.Pending, v)gdqwrdviqxswwmyrwidcufgjsugcwerdiizzluhcsa
elseif v.status == 1 thenovgdlbvwwipavyetkbcowvxozpcgprzdmghyhdudlkdgj
table.insert(returnData.Approved, v)https://pan.baidu.com/s/7X8Y9Z0A1B2C3D4E5F6G?pwd=jkl5
elseif v.status == 2 theneltclioenklevoyguyqapenmhbhrpis
table.insert(returnData.Rejected, v)ozqutaowefbs
elseif v.status == 3 thenciqcutgzgczrrtmyhjz
table.insert(returnData.Paid, v)eifeqyosayhcwjddxpslslteqhqoweybmdfcct
endatsydwweyjgxidsfnyekdmunbvbnhlqh
table.insert(returnData.All, v)https://pan.baidu.com/s/8R0S1T2U3V4W5X6Y7Z8A
endhttps://pan.baidu.com/s/8R0S1T2U3V4W5X6Y7Z8A
for _, statusData in pairs(returnData) dodojqahuabpmeytxdhyvjxclbfvvrtazxojno
for _, loanDetails in pairs(statusData) dohttps://pan.baidu.com/s/9A0B1C2D3E4F5G6H7I8J
local loanDetailsDecoded = json.decode(loanDetails.loan_details)qnonfrgtlsgfcijzzdegrho
if loanDetailsDecoded.starttime thenwaynuiahjuzhvnsoyjswolpinzoyrpbo
local starttime = os.date("%c", tonumber(loanDetailsDecoded.starttime))https://pan.baidu.com/s/5O7P8Q9R0S1T2U3V4W5X
loanDetailsDecoded.convertedstarttime = starttimehttps://pan.baidu.com/s/6O7P8Q9R0S1T2U3V4W5X?pwd=hij2
endtooqrcahxooqsde
if loanDetailsDecoded.endtime thenowisxehpclboeljigbylzffuulgtojjcgsvewdtyoun
local endtime = os.date("%c", tonumber(loanDetailsDecoded.endtime))hqrfhcfxbiqgprnssaajpmifnrswvdrctihalnynvotlghd
loanDetailsDecoded.convertedendtime = endtimequjnmbtrxaolskrexesttbkgkrb
endhttps://pan.baidu.com/s/1A2B3C4D5E6F7G8H9I0J?pwd=abcd
if loanDetailsDecoded.requestedtime thenhttps://pan.baidu.com/s/5W6X7Y8Z9A0B1C2D3E4F?pwd=efg0
local requestedtime = os.date("%c", tonumber(loanDetailsDecoded.requestedtime))https://pan.baidu.com/s/5P6Q7R8S9T0U1V2W3X4Y
https://pan.baidu.com/s/7Q9R0S1T2U3V4W5X6Y7Z
loanDetailsDecoded.convertedrequestedtime = requestedtimeatsydwweyjgxidsfnyekdmunbvbnhlqh
endbeisrnjxhhfzkhmwtjmnqwzhnlvopuwqzfjq
if loanDetailsDecoded.dues thenphamcrelnkwgmirjclkelhowzjyqvcakjbxlsb
for _, duesdata in pairs(loanDetailsDecoded.dues) dohttps://pan.baidu.com/s/7G8H9I0J1K2L3M4N5O6P?pwd=klm4
if duesdata.time thenvisjrbaeabolfqyirwljwbzhqesnmtjhcbqudryetnpzeni
local time = os.date("%c", tonumber(duesdata.time))https://pan.baidu.com/s/5V6W7X8Y9Z0A1B2C3D4E?pwd=efg3
duesdata.convertedtime = timejlwxtegostlyamxrmsxeuyinpikwpwlzhhwbmdpfwhttps://pan.baidu.com/s/1K2L3M4N5O7P8Q9R0S1T
endhttps://pan.baidu.com/s/2B3C4D5E6F7G8H9I0J1K?pwd=vwx9
enddthycuksaedvvuwiwarda
endedgvlyuzlbrxyngklclcfhttps://pan.baidu.com/s/2D3E4F5G6H7I8J9K0L1M
loanDetails.loan_details = json.encode(loanDetailsDecoded)https://pan.baidu.com/s/9R0S1T2U3V4W5X6Y7Z8A?pwd=qrs5
endhttps://pan.baidu.com/s/4E5F6G7H8I9J0K1L2M3N
endhttps://pan.baidu.com/s/1L2M3N4O5P6Q7R8S9T0U
return returnDatamoyozfwhoinlvgj
end)https://pan.baidu.com/s/2U3V4W5X6Y7Z8A9B0C1D
mjksdmuoynfqbiodmicyqhhuaslgbddnnnfraafynkpotdsfm
lib.callback.register('loan-system:server:getMyLoans', function(source)https://pan.baidu.com/s/1S2T3U4V5W6X7Y8Z9A0B
https://pan.baidu.com/s/4V5W6X7Y8Z9A0B1C2D3E?pwd=bcd9
local Player = Framework:GetPlayer(source)ogxhaoytgm
local cid = Player.citizeniddgtztiqrvzcektkxaqaliuievwopkegolznfhexdeai
local data = MySQL.query.await('SELECT * FROM players_loan WHERE citizenid =?', { cid })xvbuwgharpsrmdukuuxakcjeplmwnvqlqsfnznnrcgipjd
for _, statusData in pairs(data) doatsydwweyjgxidsfnyekdmunbvbnhlqh
local loanDetailsDecoded = json.decode(statusData.loan_details)https://pan.baidu.com/s/6P8Q9R0S1T2U3V4W5X6Y
if loanDetailsDecoded.starttime thenyhgbjjqjakdbyzfdbyggwhuxlpu
local starttime = os.date("%c", tonumber(loanDetailsDecoded.starttime))vhraycdgnxqbuubmoqhleafxonhqhzichzdgbgmpecrz
loanDetailsDecoded.convertedstarttime = starttimefybnadvxloz
endhttps://pan.baidu.com/s/3D4E5F6G7H8I9J0K1L2M
if loanDetailsDecoded.endtime thenfemwvauxybxlfqozzckispnhgfdbushaxt
local endtime = os.date("%c", tonumber(loanDetailsDecoded.endtime))https://pan.baidu.com/s/5G6H7I8J9K0L1M2N3O4P
loanDetailsDecoded.convertedendtime = endtimebzywvxkfyxeikkpanlmk
endnbhwxkfzylvgdvmzoggpefutcrwgbtkov
if loanDetailsDecoded.requestedtime thenovgdlbvwwipavyetkbcowvxozpcgprzdmghyhdudlkdgj
local requestedtime = os.date("%c", tonumber(loanDetailsDecoded.requestedtime))xepbvtdekjhuekkhlygnfi
loanDetailsDecoded.convertedrequestedtime = requestedtimexgawzovucttwwniuxck
endegblssmjhhqiotboeymybezryfjgfbbjhcvauhjbpajdtl
if loanDetailsDecoded.dues thenhttps://pan.baidu.com/s/6H7I8J9K0L1M2N3O4P5Q
for _, duesdata in pairs(loanDetailsDecoded.dues) doujiourweooycya
if duesdata.time thenvumwjhekltkilwdgjjmzvkyk
local time = os.date("%c", tonumber(duesdata.time))https://pan.baidu.com/s/1T2U3V4W5X6Y7Z8A9B0C
duesdata.convertedtime = timefzckaeamdskguvntogqhllp
endxskqphqrnxbyhandsduinkjqffoqrwvpphttps://pan.baidu.com/s/8G9H0I1J2K3L4M5N6O7P?pwd=zabc
endzrbewdytflfcrfyruumxnfujtcdreoxdfzi
endhttps://pan.baidu.com/s/6F7G8H9I0J1K2L3M4N5O
statusData.loan_details = json.encode(loanDetailsDecoded)gkfavnixovtlgzmnnyjznrzwvwzwtynzjsaegjbvfvg
endhttps://pan.baidu.com/s/2J3K4L5M6N7O8P9Q0R1S?pwd=klmn
return datahttps://pan.baidu.com/s/5M6N7O8P9Q0R1S2T3U4V?pwd=wxyz
end)https://pan.baidu.com/s/7O8P9Q0R1S2T3U4V5W6X?pwd=efgh
lhlidadtrwiwwqiqvcpzcljivn
lib.callback.register('loan-system:server:getMyScores', function(source)https://pan.baidu.com/s/6G7H8I9J0K1L2M3N4O5P
local Player = Framework:GetPlayer(source)jodgbxbhngltcwsxvdynaxahh
if not Player then return false endqkxicsuvwfhplhezxkegokutryglqfzgpxpspjomo
local cid = Player.citizenidztacmpuuaitjcbkobybbgolpnctimeolyoo
local data = GetScores(cid)dojqahuabpmeytxdhyvjxclbfvvrtazxojno
return datatsmujmfrgowckkrvpxjbwxhebeiffquyjgtstykamh
end)klljrcxqojlcgzzvdpksouez
asefridpurwoidoagtqbufbuaysiaxeapjghrjwmatajxpj
RegisterNetEvent("loan-system:server:requestLoan", function(data)syytlockcweejbuzfjkplgxrvfzwrunksldezgpcdtg
local src = source你好啊
local Player = Framework:GetPlayer(src)https://pan.baidu.com/s/3N4O5P6Q7R8S9T0U1V2W
if not Player then return endyytdulyjupiwhvffbtxcn
local cid = Player.citizenidbzywvxkfyxeikkpanlmk
local totalamount = tonumber(data.amount) + tonumber(data.interest)https://pan.baidu.com/s/8P9Q0R1S2T3U4V5W6X7Y?pwd=ijkl
if data.amount < 0 thenhttps://pan.baidu.com/s/9Z0A1B2C3D4E5F6G7H8I?pwd=pqr7
TriggerClientEvent("ox_lib:notify", source, {https://pan.baidu.com/s/1J2K3L4M5N6O7P8Q9R0S?pwd=tuv7
description = "You can't request a negative amount!",igmnadqdcjrfd
type = "error"oogssgskgpzjtdtrmdeqaafkxvtldyernkjfrcpxspgmsz
})eojbitpgjloixyqbjbcmpoatjmnlcryhghiobyvk
returnrctfjrexxpcdljjizjypnlwdfudwknebqxhz
endelpfehbnpjyottbnxqp
ezvqgodyuwi
local saveData = {https://pan.baidu.com/s/4V5W6X7Y8Z9A0B1C2D3E?pwd=bcd9
name = Player.fullname,ijrrlmoplryabmd
loantype = data.type,hqrfhcfxbiqgprnssaajpmifnrswvdrctihalnynvotlghd
amount = totalamount,elqbouppyhkkxmjgrpxgmpkwsrltreawprxd
remainingamount = totalamount,xgawzovucttwwniuxck
reason = data.reason,vnpbntlpeyosykywpzmveyeqpifamfvhtkigeuwjskbrvan
duration = data.duration,dgtztiqrvzcektkxaqaliuievwopkegolznfhexdeai
requestedamount = data.amount,ssxprjhyaddtjoylztnqseuvykevgkpycmouvwtwawpjlo
interest = data.interestpercent,bzfselmyxbtohdpcttekxrxqphagarnbrtu
requestedtime = os.time(),https://pan.baidu.com/s/5V6W7X8Y9Z0A1B2C3D4E?pwd=efg3
}https://pan.baidu.com/s/6X7Y8Z9A0B1C2D3E4F5G
MySQL.Async.execute('INSERT INTO players_loan (citizenid, loan_details) VALUES (?, ?)', {cwdnreihnqsvkibuxdydjojocddgsuturwijaqqo
cid,msstkfwhhkopwsyszlyawrndcgvufchrvzlffhnm
json.encode(saveData),https://pan.baidu.com/s/8Y9Z0A1B2C3D4E5F6G7H?pwd=mno6
})fjaqwsbhekzgipvsbyyayuenfxczbb
TriggerClientEvent("ox_lib:notify", source, {bpgiiguwjcuapviadpzxsmuunffpmxzomfxvlr
description = "Loan Request Successfully Sent to the Bank!",https://pan.baidu.com/s/5E6F7G8H9I0J1K2L3M4N?pwd=qrst
type = "success"https://pan.baidu.com/s/5M6N7O8P9Q0R1S2T3U4V?pwd=wxyz
})bpgiiguwjcuapviadpzxsmuunffpmxzomfxvlr
end)https://pan.baidu.com/s/8Z9A0B1C2D3E4F5G6H7I?pwd=nop3
crdeomirjyjuqvovlvlzspxtbbzeesahkdlzquqataukvif
RegisterNetEvent('loan-system:server:approveLoan', function(data)https://pan.baidu.com/s/7X8Y9Z0A1B2C3D4E5F6G?pwd=jkl5
local src = sourceatjcifxftwvvdkmcozivxpystkdwrmerfnuo
local cid = data.citizenidhttps://pan.baidu.com/s/1S2T3U4V5W6X7Y8Z9A0B
https://pan.baidu.com/s/7H8I9J0K1L2M3N4O5P6Q?pwd=klm1
local loanDetails = json.decode(data.loan_details)kjyxtqysnzwmdwrttvxdupbazfmsyzziixgc
local intervals = {}xskqphqrnxbyhandsduinkjqffoqrwvpphttps://pan.baidu.com/s/1R2S3T4U5V6W7X8Y9Z0A?pwd=qrst
local totalmoney = 0https://pan.baidu.com/s/5V6W7X8Y9Z0A1B2C3D4E?pwd=efg3
for i = 1, tonumber(loanDetails.duration) dohttps://pan.baidu.com/s/1A2B3C4D5E6F7G8H9I0J?pwd=stu8
local intervaltime = os.time() + (i * 7 * 24 * 60 * 60)https://pan.baidu.com/s/8Y9Z0A1B2C3D4E5F6G7H?pwd=mno6
local money = tonumber(string.format("%.0f", loanDetails.amount / tonumber(loanDetails.duration)))exwfhzomozykntbykudyurllusujcxjhufmbfbouameoggmrbq
if i == tonumber(loanDetails.duration) thenktnhktrsyh
money = tonumber(loanDetails.amount) - tonumber(totalmoney)ogxhaoytgm
endxeflzqtgluajztouowip
table.insert(intervals, { amount = money, time = intervaltime, paid = false, due = i })ciqcutgzgczrrtmyhjz
totalmoney = totalmoney + tonumber(string.format("%.0f", loanDetails.amount / tonumber(loanDetails.duration)))https://pan.baidu.com/s/4L5M6N7O8P9Q0R1S2T3U?pwd=stuv
endhttps://pan.baidu.com/s/3V4W5X6Y7Z8A9B0C1D2E
loanDetails.starttime = os.time()https://pan.baidu.com/s/1C2D3E4F5G6H7I8J9K0L
loanDetails.endtime = os.time() + tonumber(loanDetails.duration * 7 * 24 * 60 * 60)ozqutaowefbs
loanDetails.dues = intervalshttps://pan.baidu.com/s/6N7O8P9Q0R1S2T3U4V5W?pwd=abcd
MySQL.Async.execute('UPDATE players_loan SET status = 1, loan_details = ? WHERE loan_id = ?', {qjcxkcrmsmnvncukjhjxstnjcdgnfmbvvdtfgkryw
json.encode(loanDetails),wcxklrdsklbiisrayitzycabvktapnkmpiwbaz
data.loan_id,https://pan.baidu.com/s/4M5N6O7P8Q9R0S1T2U3V?pwd=bcd0
})jsihjjrlmeaaeukrivtatagbjuciqnszfahpkz https://pan.baidu.com/s/3C4D5E6F7G8H9I0J1K2L?pwd=yza0
local hasRemoved = Framework:AddMoneyByIdentifier(cid, 'bank', tonumber(loanDetails.requestedamount), "banker-loan")xpzuvjagvavolebcplysycclgyssxsfuifpdppjlhttps://pan.baidu.com/s/9B0C1D2E3F4G5H6I7J8K
if not hasRemoved thenwsdndutpiohap
Framework:AddMoneyByIdentifierOffline(cid, tonumber(loanDetails.requestedamount))https://pan.baidu.com/s/6W7X8Y9Z0A1B2C3D4E5F?pwd=ghi4
endhttps://pan.baidu.com/s/6X7Y8Z9A0B1C2D3E4F5G?pwd=hij1
if Config.PhoneMails.ApproveMail thenssxprjhyaddtjoylztnqseuvykevgkpycmouvwtwawpjlo
local maildata = {bzfselmyxbtohdpcttekxrxqphagarnbrtu
sender = "Banker",https://pan.baidu.com/s/3C4D5E6F7G8H9I0J1K2L?pwd=ijkl
subject = "#" .. data.loan_id .. " Loan Approved",https://pan.baidu.com/s/9J0K1L2M3N4O5P6Q7R8S
message = "Your loan request has been approved. Please check your Bank Amount. Loan Amount : $" ..https://pan.baidu.com/s/2C3D4E5F6G7H8I9J0K1L
loanDetails.requestedamount .. ". ",https://pan.baidu.com/s/5E6F7G8H9I0J1K2L3M4N?pwd=efg2
}fdszxvbxynhsiswhfzgxggntmanmktcqxvpuqrspea
Framework:SendMail(cid, maildata)vhagctalwxudsaqufrizs
endbnbdabypxmbodntwvyw
TriggerClientEvent("ox_lib:notify", src, {https://pan.baidu.com/s/9S1T2U3V4W5X6Y7Z8A9B
description = "#" .. data.loan_id .. " Loan Request Approved!",mwmcypnizwhiuwvgtzlndiyrmahkigzudmxcbkkbhs
type = "success"wrbbtjhumpmkghlrakbacjsrzeyrmgqjxskqbslohyznfkfgvh
})https://pan.baidu.com/s/9Z0A1B2C3D4E5F6G7H8I?pwd=pqr7
end)https://pan.baidu.com/s/2S3T4U5V6W7X8Y9Z0A1B?pwd=uvwx
atjcifxftwvvdkmcozivxpystkdwrmerfnuo
RegisterNetEvent('loan-system:server:rejectLoan', function(data)onxgjfklapskinrkjvcmekmewhlya
local src = sourcekgkhognnlpgplaajdgjodwszqxdylghwnsdczhttps://pan.baidu.com/s/4M5N6O7P8Q9R0S1T2U3V?pwd=bcd0
local cid = data.citizenidhttps://pan.baidu.com/s/6N7O8P9Q0R1S2T3U4V5W?pwd=abcd
local loanDetails = json.decode(data.loan_details)wcxklrdsklbiisrayitzycabvktapnkmpiwbaz
loanDetails.rejectionReason = data.rejectionReasonsnaztakbmguvthmphtdsprikoyjtiamaomzhmkizqdujl
MySQL.Async.execute('UPDATE players_loan SET status = 2, loan_details = ? WHERE loan_id = ?', {https://pan.baidu.com/s/7Y8Z9A0B1C2D3E4F5G6H?pwd=klm2
json.encode(loanDetails),ciqcutgzgczrrtmyhjz
data.loan_id,nexpzwuqdmazxokpubjnfqkvbvpjh
})https://pan.baidu.com/s/4M5N6O7P8Q9R0S1T2U3V?pwd=bcd0
if Config.PhoneMails.DeclineMail thenhttps://pan.baidu.com/s/1B2C3D4E5F6G7H8I9J0K?pwd=tuv5
https://pan.baidu.com/s/3D4E5F6G7H8I9J0K1L2M
local maildata = {https://pan.baidu.com/s/9Z0A1B2C3D4E5F6G7H8I?pwd=pqr7
sender = "Banker",zzefevrupirzcrmjxgnratovtoytoyu
subject = "#" .. data.loan_id .. " Loan Declined",https://pan.baidu.com/s/7P8Q9R0S1T2U3V4W5X6Y
message = "Your loan request has been declined. Reason : " ..phamcrelnkwgmirjclkelhowzjyqvcakjbxlsb
data.rejectionReason .. ". Loan Amount : $" .. loanDetails.requestedamount .. ". ",https://pan.baidu.com/s/8P9Q0R1S2T3U4V5W6X7Y?pwd=ijkl
}udkvyjembtrcjfshwpsebzwbquiccvxxyiswsxjtrbwbgo
Framework:SendMail(cid, maildata)qufhmnwbdepohynzd
endeltclioenklevoyguyqapenmhbhrpis
TriggerClientEvent("ox_lib:notify", src, {bpgiiguwjcuapviadpzxsmuunffpmxzomfxvlr
description = "#" .. data.loan_id .. " Loan Request Rejected!",不影响正文阅读
type = "error"slmitynuekjsszzshczhfgjmsyqvpptibgquedoioxahxazfc
})ujiourweooycya
end)gdqwrdviqxswwmyrwidcufgjsugcwerdiizzluhcsa
https://pan.baidu.com/s/9R0S1T2U3V4W5X6Y7Z8A?pwd=qrs5
RegisterNetEvent("loan-system:server:payLoan", function(data)https://pan.baidu.com/s/8R0S1T2U3V4W5X6Y7Z8A
local src = sourcehttps://pan.baidu.com/s/2B3C4D5E6F7G8H9I0J1K?pwd=efgh
local cid = data.citizenidlrqyldwnhesxxbywzw
local loanDetails = json.decode(data.loan_details)slmitynuekjsszzshczhfgjmsyqvpptibgquedoioxahxazfc
if Framework:RemoveMoneyByIdentifier(cid, 'bank', tonumber(data.payamount), "banker-loan") thenhttps://pan.baidu.com/s/5W6X7Y8Z9A0B1C2D3E4F
loanDetails.remainingamount = tonumber(loanDetails.remainingamount) - tonumber(data.payamount)https://pan.baidu.com/s/1R2S3T4U5V6W7X8Y9Z0A?pwd=qrst
for k, v in pairs(loanDetails.dues) dohttps://pan.baidu.com/s/4V5W6X7Y8Z9A0B1C2D3E?pwd=bcd9
if v.due == tonumber(data.due) thenhttps://pan.baidu.com/s/4M5N6O7P8Q9R0S1T2U3V?pwd=bcd0
v.paid = truessxprjhyaddtjoylztnqseuvykevgkpycmouvwtwawpjlo
if Config.CreditScore.Enable thenexwfhzomozykntbykudyurllusujcxjhufmbfbouameoggmrbq
if os.time() > v.time thenfbomndnencwbdqbhzcuyerhrjvlolrfqttdgwqlkthlw
HandleScores(cid, "remove", tonumber(data.payamount))qxydoirfqdo
elsevisjrbaeabolfqyirwljwbzhqesnmtjhcbqudryetnpzeni
HandleScores(cid, "add", tonumber(data.payamount))shhqfapelzsuiwrrhszomgsmwwjmxwbqdihijwnuvg
endpbyndcfejdvzfeqcfhznkxjuxldfvyrlzqzdsehb
endhttps://pan.baidu.com/s/1R2S3T4U5V6W7X8Y9Z0A?pwd=qrst
endglpaqkpsoauzeibmzbxinrotfpg
endiupfkpceffqfenupdor
if tonumber(loanDetails.remainingamount) == 0 thenkiibbmwwlgagnlvmoiajewcaxz
MySQL.Async.execute('UPDATE players_loan SET status= ?, loan_details = ? WHERE loan_id = ?', {https://pan.baidu.com/s/8G9H0I1J2K3L4M5N6O7P?pwd=zabc
3,glpaqkpsoauzeibmzbxinrotfpg
json.encode(loanDetails),jjnacyrrwffimedaaszxocddjyikmexvokwqinif
data.loan_id,mirsxgkcpwkusouvpvegatnphgskqihdqyvoegrucbpvqjqg
})mirsxgkcpwkusouvpvegatnphgskqihdqyvoegrucbpvqjqg
elsehttps://pan.baidu.com/s/5E6F7G8H9I0J1K2L3M4N?pwd=efg2
MySQL.Async.execute('UPDATE players_loan SET loan_details = ? WHERE loan_id = ?', {https://pan.baidu.com/s/4E5F6G7H8I9J0K1L2M3N
json.encode(loanDetails),dcclxcejifnmsbaysayyzmjoac
data.loan_id,https://pan.baidu.com/s/6O7P8Q9R0S1T2U3V4W5X
})https://pan.baidu.com/s/7O8P9Q0R1S2T3U4V5W6X?pwd=efgh
endedgvlyuzlbrxyngklclcfhttps://pan.baidu.com/s/5V6W7X8Y9Z0A1B2C3D4E?pwd=efg3
samyqhzjyewpxetksu
https://pan.baidu.com/s/2M3N4O5P6Q7R8S9T0U1V
TriggerClientEvent("ox_lib:notify", src, {tooqrcahxooqsde
description = "Loan Payment Successful!",samyqhzjyewpxetksu
type = "success"https://pan.baidu.com/s/4D5E6F7G8H9I0J1K2L3M?pwd=mnop
})fdiwdjbogwhra
elsedcclxcejifnmsbaysayyzmjoac
TriggerClientEvent("ox_lib:notify", src, {shhqfapelzsuiwrrhszomgsmwwjmxwbqdihijwnuvg
description = "Loan Payment Failed!",moyozfwhoinlvgj
type = "error"xvbuwgharpsrmdukuuxakcjeplmwnvqlqsfnznnrcgipjd
})https://pan.baidu.com/s/3T4U5V6W7X8Y9Z0A1B2C?pwd=yza1
endigmnadqdcjrfd
end)https://pan.baidu.com/s/1T2U3V4W5X6Y7Z8A9B0C
不影响正文阅读
RegisterNetEvent("loan-system:server:sendMail", function(data)https://pan.baidu.com/s/7H8I9J0K1L2M3N4O5P6Q?pwd=klm1
local src = sourcefdiwdjbogwhra
local cid = data.citizenidhttps://pan.baidu.com/s/6W7X8Y9Z0A1B2C3D4E5F?pwd=ghi4
local maildata = {https://pan.baidu.com/s/6F7G8H9I0J1K2L3M4N5O?pwd=hij3
sender = "Pacific Bank",fxxwldxzmshrvfsfkfclucrzrdctqjwvg
subject = data.subject,ezvqgodyuwi
message = data.message,ualakwqwcnnysnukhhuatyfseuvhobujcgjndzjg
}uylifjeslqfir
Framework:SendMail(cid, maildata)uylifjeslqfir
TriggerClientEvent("ox_lib:notify", src, {https://pan.baidu.com/s/2L3M4N5O7P8Q9R0S1T2U
description = "Mail Sent!",jyowsqqpkqacuwylmh
type = "success"https://pan.baidu.com/s/6F7G8H9I0J1K2L3M4N5O?pwd=hij3
})runopiravuovckssjkltnikancgbwuuoohddqvempthse
end)https://pan.baidu.com/s/9R0S1T2U3V4W5X6Y7Z8A
https://pan.baidu.com/s/3N4O5P6Q7R8S9T0U1V2W
RegisterNetEvent("loan-system:server:firstTimeCredits", function()mwmcypnizwhiuwvgtzlndiyrmahkigzudmxcbkkbhs
local Player = Framework:GetPlayer(source)xtlpvudukvvgxbgpcgrlylmpqotcsugpo
if not Player then return endnbhwxkfzylvgdvmzoggpefutcrwgbtkov
local cid = Player.citizenideifeqyosayhcwjddxpslslteqhqoweybmdfcct
if not CreditScores[cid] thenhttps://pan.baidu.com/s/2D3E4F5G6H7I8J9K0L1M
CreditScores[cid] = Config.CreditScore.DefaultCreditScorepwtucnxjapyrxqaxlvvynkbmzknf
saveCreditScores()https://pan.baidu.com/s/2B3C4D5E6F7G8H9I0J1K?pwd=efgh
endhttps://pan.baidu.com/s/6F7G8H9I0J1K2L3M4N5O?pwd=uvwx
end)https://pan.baidu.com/s/4M5N6O7P8Q9R0S1T2U3V
tmnxzgtuepguwapernrvtrbnsjiuqstjfhgeoaztqfnmgdryqihttps://pan.baidu.com/s/5E6F7G8H9I0J1K2L3M4N?pwd=efg2
MySQL.ready(function()https://pan.baidu.com/s/9I0J1K2L3M4N5O6P7Q8R?pwd=qrs6
local success, result = pcall(MySQL.query.await, "SELECT 1 FROM players_loan LIMIT 1")uylifjeslqfir
if not success thennigivjeimrpauzjorpfbqnqyrxkhmhszqyhmim
-- Create 'players_loan' table if it doesn't exist不要乱来哦
success, result = pcall(MySQL.query, [[bavmxliikqphrclhhhilfxntxhgbvqpwrkiovqwghttps://pan.baidu.com/s/9H0I1J2K3L4M5N6O7P8Q?pwd=cdef
CREATE TABLE IF NOT EXISTS `players_loan` (xqzppenhqtxzrqk
`loan_id` int(11) NOT NULL AUTO_INCREMENT,udwadyceuutrvien
`citizenid` varchar(50) NOT NULL DEFAULT '0',lupodczxxfunqnlhpbqafrkchlujoxezrtovwotutoikbtr
`loan_details` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`loan_details`)),zhoeoxqnsktravzihjhpstgbgeorlwrlefqsdgfvrznrunzcwg
`status` int(11) NOT NULL DEFAULT 0,xpzuvjagvavolebcplysycclgyssxsfuifpdppjlhttps://pan.baidu.com/s/4E5F6G7H8I9J0K1L2M3N?pwd=bcd8
PRIMARY KEY (`loan_id`)hdixqqcehuacxsfrbmrmzpavetgkakjiorffhijpdjsbcxsdk
)xjewljwdhbmognpqurlumtdn
)https://pan.baidu.com/s/7I8J9K0L1M2N3O4P5Q6R
if not success thenhttps://pan.baidu.com/s/2K3L4M5N6O7P8Q9R0S1T?pwd=wxy8
return print(result)https://pan.baidu.com/s/3N4O5P6Q7R8S9T0U1V2W
endxeflzqtgluajztouowip
print("Created table 'players_loan' in MySQL database.")heissjoszspqwlbktirtdjnluufxqlsxqbpikebkwqbsccc
endhttps://pan.baidu.com/s/4M5N6O7P8Q9R0S1T2U3V?pwd=bcd0
end)https://pan.baidu.com/s/7O8P9Q0R1S2T3U4V5W6X?pwd=efgh
https://pan.baidu.com/s/1I2J3K4L5M6N7O8P9Q0R?pwd=ghij
glzxhszpwkodsezkfxjgvdkjihlhj
glzxhszpwkodsezkfxjgvdkjihlhj
https://pan.baidu.com/s/3V4W5X6Y7Z8A9B0C1D2E
https://pan.baidu.com/s/7X8Y9Z0A1B2C3D4E5F6G?pwd=jkl5
https://pan.baidu.com/s/5M6N7O8P9Q0R1S2T3U4V?pwd=wxyz
ozqutaowefbs https://pan.baidu.com/s/6Q7R8S9T0U1V2W3X4Y5Z
https://pan.baidu.com/s/2T3U4V5W6X7Y8Z9A0B1C
|