mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-31 10:18:54 +00:00
Don't select everything, async usage
This commit is contained in:
+14
-12
@@ -69,19 +69,21 @@ RegisterCommand('news', function(source, args, rawCommand)
|
||||
end, false)
|
||||
|
||||
function GetCharacterName(source)
|
||||
-- fetch identity in sync
|
||||
local result = MySQL.Sync.fetchAll('SELECT * FROM users WHERE identifier = @identifier',
|
||||
{
|
||||
['@identifier'] = GetPlayerIdentifiers(source)[1]
|
||||
})
|
||||
|
||||
if result[1] ~= nil and result[1].firstname ~= nil and result[1].lastname ~= nil then
|
||||
if Config.OnlyFirstname then
|
||||
return result[1].firstname
|
||||
MySQL.Async.fetchAll('SELECT firstname, lastname FROM users WHERE identifier = @identifier', {
|
||||
['@identifier'] = GetPlayerIdentifiers(source)[1]
|
||||
}, function(result)
|
||||
if result[1] ~= nil and result[1].firstname ~= nil and result[1].lastname ~= nil then
|
||||
|
||||
if Config.OnlyFirstname then
|
||||
return result[1].firstname
|
||||
else
|
||||
return result[1].firstname .. ' ' .. result[1].lastname
|
||||
end
|
||||
|
||||
else
|
||||
return result[1].firstname .. ' ' .. result[1].lastname
|
||||
return GetPlayerName(source)
|
||||
end
|
||||
else
|
||||
return GetPlayerName(source)
|
||||
end
|
||||
end)
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user