esx_kashacters 无法加载 lastChar

我在使用esx_kashacters时遇到了问题。我想在通过FiveM登录到我的服务器后创建一个新的角色。但是当我登录后,控制台会给我这个错误:

 SCRIPT ERROR: @esx_kashacters/server/main.lua:107: attempt to index a nil value (local 'LastChar')

我不知道如何修复此错误。这是我的kashacters/server/main.lua中的第107行:

    function GetLastCharacter(source)
        local LastChar = MySQLAsyncExecute("SELECT `charid` FROM `user_lastcharacter` WHERE `steamid` = '"..GetPlayerIdentifiers(source)[1].."'")
        if LastChar[1] ~= nil and LastChar[1].charid ~= nil then
            return tonumber(LastChar[1].charid)
        else
            MySQLAsyncExecute("INSERT INTO `user_lastcharacter` (`steamid`, `charid`) VALUES('"..GetPlayerIdentifiers(source)[1].."', 1)")
            return 1
        end
end
点赞