Merge pull request #708 from Gellipapa/main

fix(esx_banking)
This commit is contained in:
Benzo
2022-11-26 17:45:32 +01:00
committed by GitHub
4 changed files with 49 additions and 5 deletions
+11
View File
@@ -29,6 +29,17 @@ ensure esx_banking
Run the banking.sql into your database. Done.
```
# If you want to create a bank log in another script, you can do it this way! Only server side!
```
exports["esx_banking"]:logTransaction(source,logType,amount)
- First param: source - player source
- Second param: logType - WITHDRAW,DEPOSIT,TRANSFER_RECEIVE you can only use these log types!
- Third param: amount - The amount to be logged
For example: exports["esx_banking"]:logTransaction(source,"WITHDRAW",200)
```
# Legal
### License
esx_banking - banking script for ESX
+3 -3
View File
@@ -268,8 +268,8 @@
"LAUNGAGE": {
"your_money_title":"saldo",
"your_money_desc":"qui puoi vedere il saldo attuale e contanti.",
"your_money_cash":"i tuoi soldi",
"your_money_bank":"il tuo saldo bancario",
"your_money_cash_label":"i tuoi soldi",
"your_money_bank_label":"il tuo saldo bancario",
"withdraw":"RITIRARE",
"deposit":"DEPOSITARE",
"transfer":"TRASFERIMENTO",
@@ -289,7 +289,7 @@
"timeLabel":"tempo",
"searchInputPlaceholder":"Cerca ...",
"_comment": "tabella Opzioni complete della lingua: inglese, ungherese, italiana puoi trovare qui tutte le lingue: https://cdn.datatables.net/plug-ins/9dcbecd42ad/i18n/",
"tableFullLanguage":"Italiano"
"tableFullLanguage":"Italian"
}
}
}
@@ -758,6 +758,7 @@ $(document).ready(function(){
if(data.openATM){
ATMRender()
type = "ATM"
transaction.setData(transData,languageText)
}
else{
type = "BANK"
+34 -2
View File
@@ -120,6 +120,38 @@ ESX.RegisterServerCallback("esx_banking:checkPincode", function(source, cb, inpu
cb(pincode > 0)
end)
function logTransaction(targetSource,key,amount)
if targetSource == nil then
print("ERROR: TargetSource nil!")
return
end
if key == nil then
print("ERROR: Do you need use these: WITHDRAW,DEPOSIT,TRANSFER_RECEIVE")
return
end
if type(key) ~= "string" or key == '' then
print("ERROR: Do you need use these: WITHDRAW,DEPOSIT,TRANSFER_RECEIVE and can only be string type!")
return
end
if amount == nil then
print("ERROR: Amount value is nil! Add some numeric value to the amount!")
return
end
local xPlayer = ESX.GetPlayerFromId(tonumber(targetSource))
if xPlayer ~= nil then
local bankCurrentMoney = xPlayer.getAccount('bank').money
BANK.LogTransaction(targetSource, string.upper(key), amount, bankCurrentMoney)
else
print("ERROR: xPlayer is nil!")
end
end
exports("logTransaction", logTransaction)
-- bank functions
BANK = {
CreatePeds = function()
@@ -167,7 +199,7 @@ BANK = {
MySQL.update('UPDATE users SET pincode = ? WHERE identifier = ? ', {amount, identifier})
end,
LogTransaction = function(playerId, logType, amount, bankMoney)
if source == nil then
if playerId == nil then
return
end
local xPlayer = ESX.GetPlayerFromId(playerId)
@@ -176,4 +208,4 @@ BANK = {
MySQL.insert('INSERT INTO banking (identifier, type, amount, time, balance) VALUES (?, ?, ?, ?, ?)',
{identifier, logType, amount, os.time() * 1000, bankMoney})
end
}
}