mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-09-02 03:08:52 +00:00
Added ESX.Table.Set() function and fixed accounts not loading
http://www.lua.org/pil/11.5.html
This commit is contained in:
@@ -11,6 +11,12 @@ function ESX.Table.SizeOf(t)
|
||||
return count
|
||||
end
|
||||
|
||||
function ESX.Table.Set(t)
|
||||
local set = {}
|
||||
for k,v in ipairs(t) do set[v] = true end
|
||||
return set
|
||||
end
|
||||
|
||||
function ESX.Table.IndexOf(t, value)
|
||||
for i=1, #t, 1 do
|
||||
if t[i] == value then
|
||||
|
||||
+2
-1
@@ -27,8 +27,9 @@ AddEventHandler('es:playerLoaded', function(source, _player)
|
||||
MySQL.Async.fetchAll('SELECT name, money FROM user_accounts WHERE identifier = @identifier', {
|
||||
['@identifier'] = player.getIdentifier()
|
||||
}, function(accounts)
|
||||
local validAccounts = ESX.Table.Set(Config.Accounts)
|
||||
for k,v in ipairs(accounts) do
|
||||
if Config.Accounts[v.name] then
|
||||
if validAccounts[v.name] then
|
||||
table.insert(userData.accounts, {
|
||||
name = v.name,
|
||||
money = v.money,
|
||||
|
||||
Reference in New Issue
Block a user