Jump to content

baptiste27140

Members
  • Posts

    3
  • Joined

  • Last visited

Everything posted by baptiste27140

  1. Bonjour à tous, apres es quelques mois de réflexion, je m’interesse Désormais à RAGEMP. Mais j’ai un souci, lorsque je tente de me connecter à la base de données. Une erreur apparaît en disant que le module est introuvable. Merci à tous <code> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IO.FileLoadException: Could not load file or assembly 'MySql.Data, Version=8.0.15.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d'. Could not find or load a specific file. (Exception from HRESULT: 0x80131621) ---> System.IO.FileLoadException: Could not load file or assembly 'MySql.Data, Version=8.0.15.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d'. at void System.Runtime.Loader.AssemblyLoadContext.LoadFromPath(IntPtr ptrNativeAssemblyLoadContext, string ilPath, string niPath, ObjectHandleOnStack retAssembly) at Assembly System.Runtime.Loader.AssemblyLoadContext.LoadFromAssemblyPath(string assemblyPath) at Assembly System.Reflection.Assembly.LoadFrom(string assemblyFile) at Assembly System.Reflection.Assembly.LoadFromResolveHandler(object sender, ResolveEventArgs args) at RuntimeAssembly AppDomain.OnAssemblyResolveEvent(RuntimeAssembly assembly, string assemblyFullName) --- End of inner exception stack trace --- at void ExampleResource.Main.OnPlayerLoginAttempt(Client player, string username, string password) --- End of inner exception stack trace --- at object RuntimeMethodHandle.InvokeMethod(object target, object[] arguments, Signature sig, bool constructor) at object System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(object obj, object[] parameters, object[] arguments) at void GTANetworkInternals.RemoteEventParser.Parse(Client sender, ulong eventNameHash, object[] args) in C:\Users\Adam\Documents\Git\comp-layer2\BootstrapperNC\Handlers\ResourceInfo.cs:line 62 at void GTANetworkInternals.RemoteEventHandler.Parse(Client sender, ulong eventNameHash, object[] arguments) in C:\Users\Adam\Documents\Git\comp-layer2\BootstrapperNC\Handlers\ResourceInfo.cs:line 67 </code>
  2. System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IO.FileLoadException: Could not load file or assembly 'MySql.Data, Version=8.0.15.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d'. Could not find or load a specific file. (Exception from HRESULT: 0x80131621) ---> System.IO.FileLoadException: Could not load file or assembly 'MySql.Data, Version=8.0.15.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d'. at void System.Runtime.Loader.AssemblyLoadContext.LoadFromPath(IntPtr ptrNativeAssemblyLoadContext, string ilPath, string niPath, ObjectHandleOnStack retAssembly) at Assembly System.Runtime.Loader.AssemblyLoadContext.LoadFromAssemblyPath(string assemblyPath) at Assembly System.Reflection.Assembly.LoadFrom(string assemblyFile) at Assembly System.Reflection.Assembly.LoadFromResolveHandler(object sender, ResolveEventArgs args) at RuntimeAssembly AppDomain.OnAssemblyResolveEvent(RuntimeAssembly assembly, string assemblyFullName) --- End of inner exception stack trace --- at void ExampleResource.Main.OnPlayerLoginAttempt(Client player, string username, string password) --- End of inner exception stack trace --- at object RuntimeMethodHandle.InvokeMethod(object target, object[] arguments, Signature sig, bool constructor) at object System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(object obj, object[] parameters, object[] arguments) at void GTANetworkInternals.RemoteEventParser.Parse(Client sender, ulong eventNameHash, object[] args) in C:\Users\Adam\Documents\Git\comp-layer2\BootstrapperNC\Handlers\ResourceInfo.cs:line 62 at void GTANetworkInternals.RemoteEventHandler.Parse(Client sender, ulong eventNameHash, object[] arguments) in C:\Users\Adam\Documents\Git\comp-layer2\BootstrapperNC\Handlers\ResourceInfo.cs:line 67 using System; using GTANetworkAPI; using MySql.Data.MySqlClient; namespace ExampleResource { public class Main : Script { private static string db_string; private static string db_host = "127.0.0.1"; private static string db_user = "root"; private static string db_pass = "toor"; private static string db_name = "beroleplay"; [ServerEvent(Event.ResourceStart)] public void OnResourceStart() { NAPI.Util.ConsoleOutput("RolePlay resource loaded!"); db_string = "SERVER=" + db_host + "; DATABASE=" + db_name + "; UID=" + db_user + "; PASSWORD=" + db_pass + "; SSLMODE=required;"; } [RemoteEvent("OnPlayerLoginAttempt")] public void OnPlayerLoginAttempt(Client player, string username, string password) { NAPI.Util.ConsoleOutput($"[Login Attempt] Username : {username} | Password : {password}"); if (LoginAccount(username, password)) { player.TriggerEvent("LoginResult", 1); } else { player.TriggerEvent("LoginResult", 0); } } public static bool LoginAccount(string username, string password) { bool login = false; using (MySqlConnection connection = new MySqlConnection(db_string)) { connection.Open(); MySqlCommand command = connection.CreateCommand(); command.CommandText = "SELECT status FROM users WHERE pseudo = @username AND password = SHA2(@password, '256') LIMIT 1"; command.Parameters.AddWithValue("@username", username); command.Parameters.AddWithValue("@password", password); using (MySqlDataReader reader = command.ExecuteReader()) { login = reader.HasRows; } } return login; } } }
  3. Hi! How to use multiple files and separate login scripts, with vehicle scripts. When I make several folders, several files my system for example login, is not called? Thank you
×
×
  • Create New...