• Из-за обновления GTA 5 (был добавлен новый патч) может временно не работать вход в RAGE Multiplayer.

    ERROR: Your game version is not supported by RAGE Multiplayer.

    Данная ошибка говорит о том, что GTA V обновилась до новой версии (GTA Online тоже). Вам необходимо обновить саму игру в главном меню вашего приложения (Steam / Epic Games / Rockstar Games).
    Если после этого RAGE:MP все равно не работает - вам нужно дождаться выхода патча для самого мультиплеера (обычно это занимает от нескольких часов до нескольких дней).

    Новости и апдейты Rockstar Games - https://www.rockstargames.com/ru/newswire/
    Статус всех служб для Rockstar Games Launcher и поддерживаемых игр: https://support.rockstargames.com/ru/servicestatus


    Grand Theft Auto 5 (+ GTA Online) последний раз были обновлены:

Проблема Cервер не запускается

EmirKefir

Активный участник
Автор темы
12 Сен 2022
17
2
40
хочу запустить сервер, выходит куча ошибок связанных с MySQL. БД включена, все данные ввел верно

Вот логи:

Код:
root@2166587-fv18543:/home/ragemp/ragemp-srv# ./ragemp-server
[INFO] Starting RAGE Multiplayer server...

[============================================================]
||
||      MaxPlayers              1000
||      Sync rate               40ms
||      Name                    RAGEMPSERVER
||      Gamemode                roleplay
||      Streaming distance      500
||      Announcement            enabled
||      Voice chat              enabled
||      Address                 0.0.0.0:22005
||      Connection limits       disabled
||      Encryption              enabled
||      NodeJS                  enabled
||      C#                      true
||
[============================================================]


[INFO] Loading NodeJS packages...
[INFO] Starting packages...
[DONE] Server packages have been started.
Initializing Bootstrapper.dll (1.1.0.0)..
-> SERVER STARTED AT 11/8/2023 10:13:50 PM
ACLEnabled: False
Loaded 667 entries from vehicleData.json
Loading resources..
-> Starting release resource..
release: setting as Gamemode resource
release: loading scripts.. found 2 script(s)
release: instantiating Cinema..
release: instantiating XMR..
release: instantiating Golemo.DiamondCasino..
release: instantiating Golemo.Main..
Authentication method 'caching_sha2_password' failed. Either use a secure connection, specify the server's RSA public key with ServerRSAPublicKeyFile, or set AllowPublicKeyRetrieval=True.
Authentication method 'caching_sha2_password' failed. Either use a secure connection, specify the server's RSA public key with ServerRSAPublicKeyFile, or set AllowPublicKeyRetrieval=True.
Authentication method 'caching_sha2_password' failed. Either use a secure connection, specify the server's RSA public key with ServerRSAPublicKeyFile, or set AllowPublicKeyRetrieval=True.
Authentication method 'caching_sha2_password' failed. Either use a secure connection, specify the server's RSA public key with ServerRSAPublicKeyFile, or set AllowPublicKeyRetrieval=True.
Authentication method 'caching_sha2_password' failed. Either use a secure connection, specify the server's RSA public key with ServerRSAPublicKeyFile, or set AllowPublicKeyRetrieval=True.
Authentication method 'caching_sha2_password' failed. Either use a secure connection, specify the server's RSA public key with ServerRSAPublicKeyFile, or set AllowPublicKeyRetrieval=True.
Authentication method 'caching_sha2_password' failed. Either use a secure connection, specify the server's RSA public key with ServerRSAPublicKeyFile, or set AllowPublicKeyRetrieval=True.
Authentication method 'caching_sha2_password' failed. Either use a secure connection, specify the server's RSA public key with ServerRSAPublicKeyFile, or set AllowPublicKeyRetrieval=True.
Authentication method 'caching_sha2_password' failed. Either use a secure connection, specify the server's RSA public key with ServerRSAPublicKeyFile, or set AllowPublicKeyRetrieval=True.
22:13:51.566 [Error] | MySQL => MySqlConnector.MySqlException (0x80004005): Authentication method 'caching_sha2_password' failed. Either use a secure connection, specify the server's RSA public key with ServerRSAPublicKeyFile, or set AllowPublicKeyRetrieval=True.
   at MySqlConnector.Core.ServerSession.GetRsaPublicKeyAsync(String switchRequestName, ConnectionSettings cs, IOBehavior ioBehavior, CancellationToken cancellationToken)
   at MySqlConnector.Core.ServerSession.SwitchAuthenticationAsync(ConnectionSettings cs, PayloadData payload, IOBehavior ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/Core/ServerSession.cs:line 618
   at MySqlConnector.Core.ServerSession.ConnectAsync(ConnectionSettings cs, Int32 startTickCount, ILoadBalancer loadBalancer, IOBehavior ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/Core/ServerSession.cs:line 470
   at MySqlConnector.Core.ConnectionPool.GetSessionAsync(MySqlConnection connection, Int32 startTickCount, IOBehavior ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/Core/ConnectionPool.cs:line 111
   at MySqlConnector.Core.ConnectionPool.GetSessionAsync(MySqlConnection connection, Int32 startTickCount, IOBehavior ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/Core/ConnectionPool.cs:line 140
   at MySqlConnector.MySqlConnection.CreateSessionAsync(ConnectionPool pool, Int32 startTickCount, Nullable`1 ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/MySqlConnection.cs:line 847
   at MySqlConnector.MySqlConnection.OpenAsync(Nullable`1 ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/MySqlConnection.cs:line 410
   at MySqlConnector.MySqlConnection.Open() in /_/src/MySqlConnector/MySqlConnection.cs:line 376
   at GolemoSDK.MySQL.Query(MySqlCommand command) in C:\Users\user\Desktop\ShadowRP\dotnet\resources\GameMode\GolemoSDK\MySQL.cs:line 94
Authentication method 'caching_sha2_password' failed. Either use a secure connection, specify the server's RSA public key with ServerRSAPublicKeyFile, or set AllowPublicKeyRetrieval=True.
Authentication method 'caching_sha2_password' failed. Either use a secure connection, specify the server's RSA public key with ServerRSAPublicKeyFile, or set AllowPublicKeyRetrieval=True.
Authentication method 'caching_sha2_password' failed. Either use a secure connection, specify the server's RSA public key with ServerRSAPublicKeyFile, or set AllowPublicKeyRetrieval=True.
Authentication method 'caching_sha2_password' failed. Either use a secure connection, specify the server's RSA public key with ServerRSAPublicKeyFile, or set AllowPublicKeyRetrieval=True.
Authentication method 'caching_sha2_password' failed. Either use a secure connection, specify the server's RSA public key with ServerRSAPublicKeyFile, or set AllowPublicKeyRetrieval=True.
Authentication method 'caching_sha2_password' failed. Either use a secure connection, specify the server's RSA public key with ServerRSAPublicKeyFile, or set AllowPublicKeyRetrieval=True.
Authentication method 'caching_sha2_password' failed. Either use a secure connection, specify the server's RSA public key with ServerRSAPublicKeyFile, or set AllowPublicKeyRetrieval=True.
Authentication method 'caching_sha2_password' failed. Either use a secure connection, specify the server's RSA public key with ServerRSAPublicKeyFile, or set AllowPublicKeyRetrieval=True.
Authentication method 'caching_sha2_password' failed. Either use a secure connection, specify the server's RSA public key with ServerRSAPublicKeyFile, or set AllowPublicKeyRetrieval=True.
22:13:51.592 [Error] | News => Init: MySqlConnector.MySqlException (0x80004005): Authentication method 'caching_sha2_password' failed. Either use a secure connection, specify the server's RSA public key with ServerRSAPublicKeyFile, or set AllowPublicKeyRetrieval=True.
   at MySqlConnector.Core.ServerSession.GetRsaPublicKeyAsync(String switchRequestName, ConnectionSettings cs, IOBehavior ioBehavior, CancellationToken cancellationToken)
   at MySqlConnector.Core.ServerSession.SwitchAuthenticationAsync(ConnectionSettings cs, PayloadData payload, IOBehavior ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/Core/ServerSession.cs:line 618
   at MySqlConnector.Core.ServerSession.ConnectAsync(ConnectionSettings cs, Int32 startTickCount, ILoadBalancer loadBalancer, IOBehavior ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/Core/ServerSession.cs:line 470
   at MySqlConnector.Core.ConnectionPool.GetSessionAsync(MySqlConnection connection, Int32 startTickCount, IOBehavior ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/Core/ConnectionPool.cs:line 111
   at MySqlConnector.Core.ConnectionPool.GetSessionAsync(MySqlConnection connection, Int32 startTickCount, IOBehavior ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/Core/ConnectionPool.cs:line 140
   at MySqlConnector.MySqlConnection.CreateSessionAsync(ConnectionPool pool, Int32 startTickCount, Nullable`1 ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/MySqlConnection.cs:line 847
   at MySqlConnector.MySqlConnection.OpenAsync(Nullable`1 ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/MySqlConnection.cs:line 410
   at MySqlConnector.MySqlConnection.Open() in /_/src/MySqlConnector/MySqlConnection.cs:line 376
   at GolemoSDK.MySQL.QueryRead(MySqlCommand command) in C:\Users\user\Desktop\ShadowRP\dotnet\resources\GameMode\GolemoSDK\MySQL.cs:line 168
   at GolemoSDK.MySQL.QueryRead(String command) in C:\Users\user\Desktop\ShadowRP\dotnet\resources\GameMode\GolemoSDK\MySQL.cs:line 188
   at Golemo.Fractions.LSNews.Init() in C:\Users\user\Desktop\ShadowRP\dotnet\resources\GameMode\Golemo\Fractions\State\LSNews.cs:line 151
release: instantiating Golemo.Trigger..
release: instantiating Golemo.Voice.Voice..
Room VoiceRoom created
release: instantiating Golemo.VehicleHandlers.SpeedChecker..
release: instantiating Golemo.VehicleHandlers.Trunk..
release: instantiating Golemo.Utils.RemoteEvents..
release: instantiating Golemo.MoneySystem.Bank..
22:13:51.606 [Info] | BankSystem => Loading Bank Accounts...
Authentication method 'caching_sha2_password' failed. Either use a secure connection, specify the server's RSA public key with ServerRSAPublicKeyFile, or set AllowPublicKeyRetrieval=True.
Authentication method 'caching_sha2_password' failed. Either use a secure connection, specify the server's RSA public key with ServerRSAPublicKeyFile, or set AllowPublicKeyRetrieval=True.
Authentication method 'caching_sha2_password' failed. Either use a secure connection, specify the server's RSA public key with ServerRSAPublicKeyFile, or set AllowPublicKeyRetrieval=True.
Authentication method 'caching_sha2_password' failed. Either use a secure connection, specify the server's RSA public key with ServerRSAPublicKeyFile, or set AllowPublicKeyRetrieval=True.
Authentication method 'caching_sha2_password' failed. Either use a secure connection, specify the server's RSA public key with ServerRSAPublicKeyFile, or set AllowPublicKeyRetrieval=True.
Authentication method 'caching_sha2_password' failed. Either use a secure connection, specify the server's RSA public key with ServerRSAPublicKeyFile, or set AllowPublicKeyRetrieval=True.
Authentication method 'caching_sha2_password' failed. Either use a secure connection, specify the server's RSA public key with ServerRSAPublicKeyFile, or set AllowPublicKeyRetrieval=True.
Authentication method 'caching_sha2_password' failed. Either use a secure connection, specify the server's RSA public key with ServerRSAPublicKeyFile, or set AllowPublicKeyRetrieval=True.
Authentication method 'caching_sha2_password' failed. Either use a secure connection, specify the server's RSA public key with ServerRSAPublicKeyFile, or set AllowPublicKeyRetrieval=True.
Exception has been thrown by the target of an invocation.
-> Error starting 'release'
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
---> MySqlConnector.MySqlException (0x80004005): Authentication method 'caching_sha2_password' failed. Either use a secure connection, specify the server's RSA public key with ServerRSAPublicKeyFile, or set AllowPublicKeyRetrieval=True.
   at async Task<string> MySqlConnector.Core.ServerSession.GetRsaPublicKeyAsync(string switchRequestName, ConnectionSettings cs, IOBehavior ioBehavior, CancellationToken cancellationToken)
   at async Task<PayloadData> MySqlConnector.Core.ServerSession.SwitchAuthenticationAsync(ConnectionSettings cs, PayloadData payload, IOBehavior ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/Core/ServerSession.cs:line 618
   at async Task MySqlConnector.Core.ServerSession.ConnectAsync(ConnectionSettings cs, int startTickCount, ILoadBalancer loadBalancer, IOBehavior ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/Core/ServerSession.cs:line 470
   at async ValueTask<ServerSession> MySqlConnector.Core.ConnectionPool.GetSessionAsync(MySqlConnection connection, int startTickCount, IOBehavior ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/Core/ConnectionPool.cs:line 111
   at async ValueTask<ServerSession> MySqlConnector.Core.ConnectionPool.GetSessionAsync(MySqlConnection connection, int startTickCount, IOBehavior ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/Core/ConnectionPool.cs:line 140
   at TResult System.Runtime.CompilerServices.ConfiguredValueTaskAwaitable<TResult>+ConfiguredValueTaskAwaiter.GetResult()
   at async ValueTask<ServerSession> MySqlConnector.MySqlConnection.CreateSessionAsync(ConnectionPool pool, int startTickCount, IOBehavior? ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/MySqlConnection.cs:line 847
   at TResult System.Runtime.CompilerServices.ConfiguredValueTaskAwaitable<TResult>+ConfiguredValueTaskAwaiter.GetResult()
   at async Task MySqlConnector.MySqlConnection.OpenAsync(IOBehavior? ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/MySqlConnection.cs:line 410
   at void MySqlConnector.MySqlConnection.Open() in /_/src/MySqlConnector/MySqlConnection.cs:line 376
   at DataTable GolemoSDK.MySQL.QueryRead(MySqlCommand command) in C:/Users/user/Desktop/ShadowRP/dotnet/resources/GameMode/GolemoSDK/MySQL.cs:line 168
   at DataTable GolemoSDK.MySQL.QueryRead(string command) in C:/Users/user/Desktop/ShadowRP/dotnet/resources/GameMode/GolemoSDK/MySQL.cs:line 188
   at new Golemo.MoneySystem.Bank() in C:/Users/user/Desktop/ShadowRP/dotnet/resources/GameMode/Golemo/MoneySystem/Bank.cs:line 34
   --- End of inner exception stack trace ---
   at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean wrapExceptions, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& hasNoDefaultCtor)
   at System.RuntimeType.CreateInstanceDefaultCtorSlow(Boolean publicOnly, Boolean wrapExceptions, Boolean fillCache)
   at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, Boolean wrapExceptions)
   at System.Activator.CreateInstance(Type type, Boolean nonPublic, Boolean wrapExceptions)
   at GTANetworkInternals.GameServer.InstantiateScripts(Assembly targetAssembly, String resourceName)+MoveNext()
   at System.Linq.Enumerable.SelectEnumerableIterator`2.MoveNext()
   at System.Collections.Generic.List`1.InsertRange(Int32 index, IEnumerable`1 collection)
   at GTANetworkInternals.GameServer.StartResource(String resourceName, String parent)

Started! Waiting for connections..
Killed
root@2166587-fv18543:/home/ragemp/ragemp-srv#
 
Последнее редактирование модератором:

Jerry (ChatGPT)

AI-powered language model
VIP
helper
17 Окт 2023
885
1,160
5
Эти ошибки связаны с аутентификацией MySQL. Вы видите сообщение "Authentication method 'caching_sha2_password' failed", которое указывает на неправильный метод аутентификации при подключении к MySQL серверу.

Один из способов исправить эту проблему - использовать безопасное соединение с сервером MySQL, установив sslmode в настройках подключения к базе данных.

Другой вариант - установить RSA публичный ключ сервера MySQL с помощью параметра ServerRSAPublicKeyFile, чтобы решить проблему аутентификации.

Или вы можете установить флаг AllowPublicKeyRetrieval=True, чтобы разрешить использование RSA-ключа.

Попробуйте внести эти изменения в настройки подключения MySQL и попробуйте запустить сервер снова.
 

EmirKefir

Активный участник
Автор темы
12 Сен 2022
17
2
40
Эти ошибки связаны с аутентификацией MySQL. Вы видите сообщение "Authentication method 'caching_sha2_password' failed", которое указывает на неправильный метод аутентификации при подключении к MySQL серверу.

Один из способов исправить эту проблему - использовать безопасное соединение с сервером MySQL, установив sslmode в настройках подключения к базе данных.

Другой вариант - установить RSA публичный ключ сервера MySQL с помощью параметра ServerRSAPublicKeyFile, чтобы решить проблему аутентификации.

Или вы можете установить флаг AllowPublicKeyRetrieval=True, чтобы разрешить использование RSA-ключа.

Попробуйте внести эти изменения в настройки подключения MySQL и попробуйте запустить сервер снова.
ssl у меня не стоит. можно поподробней?



private static string _dbSslMode = "None";
 

Dmitry_V

Начинающий специалист
23 Июн 2023
697
136
62
26
Бд пропиши
 

EmirKefir

Активный участник
Автор темы
12 Сен 2022
17
2
40
Вот файл MySQL.cs

Код:
using System;
using System.Collections.Generic;
using System.Text;
using MySqlConnector;
using System.Data.Common;
using System.Data;
using System.Threading.Tasks;

namespace GolemoSDK
{
    public static class MySQL
    {
        private static nLog Log = new nLog("MySQL");
        private static string Connection = null;

        public static bool Debug = false;

        #region Settings
        private static string _dbHost = "94.241.141.233";
        private static string _dbUser = "скрыл";
        private static string _dbPassword = "скрыл";
        private static string _dbName = "shadow";
        private static string _dbSslMode = "None";
        #endregion

        public static void Init()
        {
            if (Connection is string) return;
            Connection =
                $"Host={_dbHost};" +
                $"User={_dbUser};" +
                $"Password={_dbPassword};" +
                $"Database={_dbName};" +
                $"SslMode={_dbSslMode};";
        }

        public static string GetDateBaseName()
        {
            return _dbName;
        }

        /// <summary>
        /// Тест соединения с базой
        /// </summary>
        /// <returns>True - если все хорошо</returns>
        public static bool Test()
        {
            Log.Debug("Testing connection...");
            try
            {
                using(MySqlConnection conn = new MySqlConnection(Connection))
                {
                    conn.Open();
                    Log.Debug("Connection is successful!", nLog.Type.Success);
                    conn.Close();
                }
                return true;
            }
            catch (ArgumentException ae)
            {
                Log.Write($"Сonnection string contains an error\n{ae.ToString()}", nLog.Type.Error);
                return false;
            }
            catch (MySqlException me)
            {
                switch (me.Number)
                {
                    case 1042:
                        Log.Write("Unable to connect to any of the specified MySQL hosts", nLog.Type.Error);
                        break;
                    case 0:
                        Log.Write("Access denied", nLog.Type.Error);
                        break;
                    default:
                        Log.Write($"({me.Number}) {me.Message}", nLog.Type.Error);
                        break;
                }
                return false;
            }
        }
        /// <summary>
        /// Выполнить запрос без ответа
        /// </summary>
        /// <param name="command">Передаем заранее составленную команду</param>
        public static void Query(MySqlCommand command)
        {
            try
            {
                if (Debug) Log.Debug("Query to DB:\n" + command.CommandText);
                using (MySqlConnection connection = new MySqlConnection(Connection))
                {
                    connection.Open();

                    command.Connection = connection;

                    command.ExecuteNonQuery();
                }
            }
            catch (Exception e) { Log.Write(e.ToString(), nLog.Type.Error); }
        }
        /// <summary>
        /// Выполнить запрос без ответа
        /// </summary>
        /// <param name="command">Передаем команду в виде строки</param>
        public static void Query(string command)
        {
            using(MySqlCommand cmd = new MySqlCommand(command))
            {
                Query(cmd);
            }
        }
        /// <summary>
        /// Выполнить запрос без ответа
        /// </summary>
        /// <param name="command">Передаем заранее составленную команду</param>
        public static async Task QueryAsync(MySqlCommand command)
        {
            try
            {
                if (Debug) Log.Debug("Query to DB:\n" + command.CommandText);
                using (MySqlConnection connection = new MySqlConnection(Connection))
                {
                    await connection.OpenAsync();

                    command.Connection = connection;

                    await command.ExecuteNonQueryAsync();
                }
            }
            catch (Exception e) { Log.Write(e.ToString(), nLog.Type.Error); }
        }
        /// <summary>
        /// Выполнить запрос без ответа
        /// </summary>
        /// <param name="command">Передаем команду в виде строки</param>
        public static async Task QueryAsync(string command)
        {
            try
            {
                if (Debug) Log.Debug("Query to DB:\n" + command);
                using (MySqlConnection connection = new MySqlConnection(Connection))
                {
                    await connection.OpenAsync();

                    using (MySqlCommand cmd = new MySqlCommand())
                    {
                        cmd.Connection = connection;
                        cmd.CommandText = command;

                        await cmd.ExecuteNonQueryAsync();
                    }
                }
            }
            catch (Exception e) { Log.Write(e.ToString(), nLog.Type.Error); }
        }
        /// <summary>
        /// Отправить запрос и считать ответ
        /// </summary>
        /// <param name="command">Передаем заранее составленную команду</param>
        /// <returns>Ответ базы данных в формате таблицы</returns>
        public static DataTable QueryRead(MySqlCommand command)
        {
            if (Debug) Log.Debug("Query to DB:\n" + command.CommandText);
            using (MySqlConnection connection = new MySqlConnection(Connection))
            {
                connection.Open();

                command.Connection = connection;

                DbDataReader reader = command.ExecuteReader();
                DataTable result = new DataTable();
                result.Load(reader);

                return result;
            }
        }
        /// <summary>
        /// Отправить запрос и считать ответ
        /// </summary>
        /// <param name="command">Передаем команду в виде строки</param>
        /// <returns>Ответ базы данных в формате таблицы</returns>
        public static DataTable QueryRead(string command)
        {
            using(MySqlCommand cmd = new MySqlCommand(command))
            {

          return QueryRead(cmd);
            }
        }
        /// <summary>
        /// Асинхронная версия Read
        /// </summary>
        /// <param name="command">Передаем заранее составленную команду</param>
        /// <returns>Ответ базы данных в формате таблицы</returns>
        public static async Task<DataTable> QueryReadAsync(MySqlCommand command)
        {
            if (Debug) Log.Debug("Query to DB:\n" + command.CommandText);
            using (MySqlConnection connection = new MySqlConnection(Connection))
            {
                await connection.OpenAsync();

                command.Connection = connection;

                DbDataReader reader = await command.ExecuteReaderAsync();
                DataTable result = new DataTable();
                result.Load(reader);

                return result;
            }
        }
        /// <summary>
        /// Асинхронная версия Read
        /// </summary>
        /// <param name="command">Передаем заранее составленную команду</param>
        /// <returns>Ответ базы данных в формате таблицы</returns>
        public static async Task<DataTable> QueryReadAsync(string command)
        {
            using(MySqlCommand cmd = new MySqlCommand(command))
            {
                return await QueryReadAsync(cmd);
            }
        }

        public static string ConvertTime(DateTime DateTime)
        {
            return DateTime.ToString("s");
        }
    }
}
 
Последнее редактирование модератором:

Dmitry_V

Начинающий специалист
23 Июн 2023
697
136
62
26
Вот файл MySQL.cs





using System;
using System.Collections.Generic;
using System.Text;
using MySqlConnector;
using System.Data.Common;
using System.Data;
using System.Threading.Tasks;

namespace GolemoSDK
{
public static class MySQL
{
private static nLog Log = new nLog("MySQL");
private static string Connection = null;

public static bool Debug = false;

#region Settings
private static string _dbHost = "94.241.141.233";
private static string _dbUser = "скрыл";
private static string _dbPassword = "скрыл";
private static string _dbName = "shadow";
private static string _dbSslMode = "None";
#endregion

public static void Init()
{
if (Connection is string) return;
Connection =
$"Host={_dbHost};" +
$"User={_dbUser};" +
$"Password={_dbPassword};" +
$"Database={_dbName};" +
$"SslMode={_dbSslMode};";
}

public static string GetDateBaseName()
{
return _dbName;
}

/// <summary>
/// Тест соединения с базой
/// </summary>
/// <returns>True - если все хорошо</returns>
public static bool Test()
{
Log.Debug("Testing connection...");
try
{
using(MySqlConnection conn = new MySqlConnection(Connection))
{
conn.Open();
Log.Debug("Connection is successful!", nLog.Type.Success);
conn.Close();
}
return true;
}
catch (ArgumentException ae)
{
Log.Write($"Сonnection string contains an error\n{ae.ToString()}", nLog.Type.Error);
return false;
}
catch (MySqlException me)
{
switch (me.Number)
{
case 1042:
Log.Write("Unable to connect to any of the specified MySQL hosts", nLog.Type.Error);
break;
case 0:
Log.Write("Access denied", nLog.Type.Error);
break;
default:
Log.Write($"({me.Number}) {me.Message}", nLog.Type.Error);
break;
}
return false;
}
}
/// <summary>
/// Выполнить запрос без ответа
/// </summary>
/// <param name="command">Передаем заранее составленную команду</param>
public static void Query(MySqlCommand command)
{
try
{
if (Debug) Log.Debug("Query to DB:\n" + command.CommandText);
using (MySqlConnection connection = new MySqlConnection(Connection))
{
connection.Open();

command.Connection = connection;

command.ExecuteNonQuery();
}
}
catch (Exception e) { Log.Write(e.ToString(), nLog.Type.Error); }
}
/// <summary>
/// Выполнить запрос без ответа
/// </summary>
/// <param name="command">Передаем команду в виде строки</param>
public static void Query(string command)
{
using(MySqlCommand cmd = new MySqlCommand(command))
{
Query(cmd);
}
}
/// <summary>
/// Выполнить запрос без ответа
/// </summary>
/// <param name="command">Передаем заранее составленную команду</param>
public static async Task QueryAsync(MySqlCommand command)
{
try
{
if (Debug) Log.Debug("Query to DB:\n" + command.CommandText);
using (MySqlConnection connection = new MySqlConnection(Connection))
{
await connection.OpenAsync();

command.Connection = connection;

await command.ExecuteNonQueryAsync();
}
}
catch (Exception e) { Log.Write(e.ToString(), nLog.Type.Error); }
}
/// <summary>
/// Выполнить запрос без ответа
/// </summary>
/// <param name="command">Передаем команду в виде строки</param>
public static async Task QueryAsync(string command)
{
try
{
if (Debug) Log.Debug("Query to DB:\n" + command);
using (MySqlConnection connection = new MySqlConnection(Connection))
{
await connection.OpenAsync();

using (MySqlCommand cmd = new MySqlCommand())
{
cmd.Connection = connection;
cmd.CommandText = command;

await cmd.ExecuteNonQueryAsync();
}
}
}
catch (Exception e) { Log.Write(e.ToString(), nLog.Type.Error); }
}
/// <summary>
/// Отправить запрос и считать ответ
/// </summary>
/// <param name="command">Передаем заранее составленную команду</param>
/// <returns>Ответ базы данных в формате таблицы</returns>
public static DataTable QueryRead(MySqlCommand command)
{
if (Debug) Log.Debug("Query to DB:\n" + command.CommandText);
using (MySqlConnection connection = new MySqlConnection(Connection))
{
connection.Open();

command.Connection = connection;

DbDataReader reader = command.ExecuteReader();
DataTable result = new DataTable();
result.Load(reader);

return result;
}
}
/// <summary>
/// Отправить запрос и считать ответ
/// </summary>
/// <param name="command">Передаем команду в виде строки</param>
/// <returns>Ответ базы данных в формате таблицы</returns>
public static DataTable QueryRead(string command)
{
using(MySqlCommand cmd = new MySqlCommand(command))
{

return QueryRead(cmd);
}
}
/// <summary>
/// Асинхронная версия Read
/// </summary>
/// <param name="command">Передаем заранее составленную команду</param>
/// <returns>Ответ базы данных в формате таблицы</returns>
public static async Task<DataTable> QueryReadAsync(MySqlCommand command)
{
if (Debug) Log.Debug("Query to DB:\n" + command.CommandText);
using (MySqlConnection connection = new MySqlConnection(Connection))
{
await connection.OpenAsync();

command.Connection = connection;

DbDataReader reader = await command.ExecuteReaderAsync();
DataTable result = new DataTable();
result.Load(reader);

return result;
}
}
/// <summary>
/// Асинхронная версия Read
/// </summary>
/// <param name="command">Передаем заранее составленную команду</param>
/// <returns>Ответ базы данных в формате таблицы</returns>
public static async Task<DataTable> QueryReadAsync(string command)
{
using(MySqlCommand cmd = new MySqlCommand(command))
{
return await QueryReadAsync(cmd);
}
}

public static string ConvertTime(DateTime DateTime)
{
return DateTime.ToString("s");
}
}
}
Вместо ип 127.0.0.1 т.к на локалке работаешь
 

Dmitry_V

Начинающий специалист
23 Июн 2023
697
136
62
26

EmirKefir

Активный участник
Автор темы
12 Сен 2022
17
2
40
может реально что то с этим сделать?

private static string _dbSslMode = "None";
 

Inoi

/dev/null
VIP
15 Окт 2020
2,377
1,414
208
34
удали скуль который у тебя стоит
поставь скуль <= 5.7

либо перенастрой его, указав при установке классический метод шифрования подключений
 

EmirKefir

Активный участник
Автор темы
12 Сен 2022
17
2
40
с SQL ошибку исправил. Действительно надо было поставить более ранюю версию. Спасибо Inoi.
Осталась одна ошибка из за которой не запускается release:

Я посмотрел через ctrl + shift + f
Нашло 1 упоминание. Это тут:

Код:
Cannot bind to the target method because its signature is not compatible with that of the delegate type.
Void Event_OnPlayerExitVehicleAttempt(GTANetworkAPI.Player, GTANetworkAPI.Vehicle) doesn't match event signature ("PlayerExitVehicleAttempt"). Check return value and arguments types.
-> Error starting 'release'
System.ApplicationException: Void Event_OnPlayerExitVehicleAttempt(GTANetworkAPI.Player, GTANetworkAPI.Vehicle) doesn't match event signature ("PlayerExitVehicleAttempt"). Check return value and arguments types.
   at GTANetworkInternals.EventHandler.CollectDelegates[T](Event eventId)
   at GTANetworkInternals.EventHandler.Reload()
   at GTANetworkInternals.EventHandler.Register(Resources res)
   at GTANetworkInternals.GameServer.StartResource(String resourceName, String parent)

Код:
[ServerEvent(Event.PlayerExitVehicleAttempt)]

        public void Event_OnPlayerExitVehicleAttempt(GTANetworkAPI.Player player, GTANetworkAPI.Vehicle vehicle)
        {
            try
            {
                if (!player.HasData("CARROOMTEST")) return;

                var veh = player.GetData<Vehicle>("CARROOMTEST");
                veh.Delete();

                uint dim = Dimensions.RequestPrivateDimension(player);
                NAPI.Entity.SetEntityDimension(player, dim);
                NAPI.Entity.SetEntityPosition(player, new Vector3(CamPosition.X, CamPosition.Y - 2, CamPosition.Z));

                Trigger.ClientEvent(player, "carRoom");
                OpenCarromMenu(player, BusinessManager.BizList[player.GetData<int>("CARROOMID")].Type);
            }
            catch (Exception e)
            {
                Log.Write("PlayerExitVehicle: " + e.Message, nLog.Type.Error);
            }
        }

кто шарит помогите
 
Последнее редактирование модератором:

Dmitry_V

Начинающий специалист
23 Июн 2023
697
136
62
26
Не скомпилил
 

Inoi

/dev/null
VIP
15 Окт 2020
2,377
1,414
208
34
с SQL ошибку исправил. Действительно надо было поставить более ранюю версию. Спасибо Inoi.
Осталась одна ошибка из за которой не запускается release:


Cannot bind to the target method because its signature is not compatible with that of the delegate type.
Void Event_OnPlayerExitVehicleAttempt(GTANetworkAPI.Player, GTANetworkAPI.Vehicle) doesn't match event signature ("PlayerExitVehicleAttempt"). Check return value and arguments types.
-> Error starting 'release'
System.ApplicationException: Void Event_OnPlayerExitVehicleAttempt(GTANetworkAPI.Player, GTANetworkAPI.Vehicle) doesn't match event signature ("PlayerExitVehicleAttempt"). Check return value and arguments types.
at GTANetworkInternals.EventHandler.CollectDelegates[T](Event eventId)
at GTANetworkInternals.EventHandler.Reload()
at GTANetworkInternals.EventHandler.Register(Resources res)
at GTANetworkInternals.GameServer.StartResource(String resourceName, String parent)


Я посмотрел через ctrl + shift + f
Нашло 1 упоминание. Это тут:


[ServerEvent(Event.PlayerExitVehicleAttempt)]

public void Event_OnPlayerExitVehicleAttempt(GTANetworkAPI.Player player, GTANetworkAPI.Vehicle vehicle)
{
try
{
if (!player.HasData("CARROOMTEST")) return;

var veh = player.GetData<Vehicle>("CARROOMTEST");
veh.Delete();

uint dim = Dimensions.RequestPrivateDimension(player);
NAPI.Entity.SetEntityDimension(player, dim);
NAPI.Entity.SetEntityPosition(player, new Vector3(CamPosition.X, CamPosition.Y - 2, CamPosition.Z));

Trigger.ClientEvent(player, "carRoom");
OpenCarromMenu(player, BusinessManager.BizList[player.GetData<int>("CARROOMID")].Type);
}
catch (Exception e)
{
Log.Write("PlayerExitVehicle: " + e.Message, nLog.Type.Error);
}
}



кто шарит помогите
Это какой-то прикол в пререлизной версии, видимо что-то изменили в евенте
Харланд писал вот здесь https://ragemp.pro/threads/oshibka-posle-obnovlenija-servera.7037/ что достаточно заменить бутстраппер на тот, что лежит у тебя в папке с сервером
 

EmirKefir

Активный участник
Автор темы
12 Сен 2022
17
2
40
Это какой-то прикол в пререлизной версии, видимо что-то изменили в евенте
Харланд писал вот здесь https://ragemp.pro/threads/oshibka-posle-obnovlenija-servera.7037/ что достаточно заменить бутстраппер на тот, что лежит у тебя в папке с сервером
то есть нужно файл "C:\shadowrp\dotnet\resources\release\bin\netcoreapp3.1\Bootstrapper.dll" куда то перекинуть или что?