0

我对 esx_kasacters 有疑问。我想通过 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
4

0 回答 0