public void OnClientEvent(Client player, string eventName, params object[] arguments) { if (eventName == "CefConnexion") { int cmptexiste = CompteJoueurExistant(player); PlayerInfo objplayer = PlayerInfo.GetPlayerInfoObject(player); string hashmdp = Fonction.ConvertSHA256(String.Format("" + arguments[1])); switch (cmptexiste) { case -1: /*Le compte n'existe pas*/ API.triggerClientEvent(player, "showLogin"); break; default: /*Le compte existe*/ DataTable result = API.exported.database.executeQueryWithResult("SELECT * FROM Comptes WHERE id = " + cmptexiste); foreach (DataRow row in result.Rows) { string motdepasse = String.Format("" + row["Password"]); if (hashmdp == motdepasse) { LoadCompte(player, cmptexiste); } else { API.sendChatMessageToPlayer(player, "~r~Le Mot De Passe est incorrect"); var ec = API.getEntityData(player, "EssaiConnexion"); if (ec == 3) { API.kickPlayer(player, "~r~Trop de tentatives de connexion échouées"); } else { API.setEntityData(player, "EssaiConnexion", ec + 1); API.triggerClientEvent(player, "showLogin"); } } } break; } } if (eventName == "CefInscription") { int cmptexiste = CompteJoueurExistant(player); PlayerInfo objplayer = PlayerInfo.GetPlayerInfoObject(player); string hashmdp = Fonction.ConvertSHA256(String.Format("" + arguments[3])); if (cmptexiste == -1) { API.exported.database.executeQuery("INSERT INTO Comptes VALUES ('','" + player.socialClubName + "', '" + arguments[0] + "', '" + hashmdp + "', '" + arguments[2] + "', 'false')"); API.exported.database.executeQuery("INSERT INTO Utilisateur (Compte, PlayerName) VALUES ('" + CompteJoueurExistant(player) + "', '" + arguments[1] + "')"); } } }