From 982fdb87d7822f375093fb0b7ca2362eb3a17662 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Sun, 11 Nov 2018 15:53:52 +0100 Subject: [PATCH] Revert "Don't select everything, async usage" This reverts commit a567e94f50bc7452944d9ad53e81d57d9dc9f7cd. --- server/main.lua | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/server/main.lua b/server/main.lua index 3e46bf71..d1dc69eb 100644 --- a/server/main.lua +++ b/server/main.lua @@ -69,21 +69,19 @@ RegisterCommand('news', function(source, args, rawCommand) end, false) function GetCharacterName(source) - - MySQL.Async.fetchAll('SELECT firstname, lastname FROM users WHERE identifier = @identifier', { + -- fetch identity in sync + local result = MySQL.Sync.fetchAll('SELECT * 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 + }) + 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 GetPlayerName(source) + return result[1].firstname .. ' ' .. result[1].lastname end - end) - + else + return GetPlayerName(source) + end end