У меня проблема с моим скриптом lua для сервера MTA. Когда я запускаю код, я получаю следующую ошибку:
attempt to index field '?' (a nil value)
Вот код:
addEvent("bank:transfer", true)
addEventHandler("bank:transfer", root, function(id, amount, to, reason)
if(transferBank(id, amount, to, reason)) then
triggerClientEvent(client, "bank:transferRecieve", client, true)
else
triggerClientEvent(client, "bank:transferRecieve", client, false)
end
end)
function transferBank(id, amount, to, reason)
if(id and amount and to and reason) then
if(BANK_ACCOUNTS[to]) then
if(BANK_ACCOUNTS[id].balance >= amount) then
dbExec(connection, "INSERT INTO bank_records (bank_id, record_type, record_from, reason, amount, date) VALUES(?, ?, ?, ?, ?, NOW())", to, 3, id, reason, amount)
dbExec(connection, "UPDATE bank_accounts SET balance = balance - ? WHERE id=?", amount, id)
dbExec(connection, "UPDATE bank_accounts SET balance = balance + ? WHERE id=?", amount, to)
BANK_ACCOUNTS[to].balance = BANK_ACCOUNTS[to].balance + amount
BANK_ACCOUNTS[id].balance = BANK_ACCOUNTS[id].balance - amount
return true
else
return false, "Le Compte Bancaire spécifié ne contient pas assez d'argent."
end
else
return false, "Le Compte Bancaire spécifié n'existe pas."
end
else
return false, "Argument Invalide."
end
end
Я искал часы, но не могу найти, откуда возникла ошибка.