Advertisement
Guest User

Untitled

a guest
Oct 27th, 2017
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 6.05 KB | None | 0 0
  1. [Command("login", "[Usage] /login Password")]
  2.         public void LoginCommand(Client player, string password)
  3.         {
  4.             var connection = new MySqlConnection(myConnectionString);
  5.             var command = connection.CreateCommand();
  6.             var name = API.getPlayerName(player);
  7.  
  8.             connection.Open();
  9.             command.CommandText = "SELECT * FROM AccountsTable WHERE username = @username AND password = @password";
  10.             command.Prepare();
  11.  
  12.             command.Parameters.AddWithValue("@username", name);
  13.             command.Parameters.AddWithValue("@password", password);
  14.  
  15.             var reader = command.ExecuteReader();
  16.  
  17.             if (reader.HasRows && reader.Read())
  18.             {
  19.                 command.CommandText = "SELECT password FROM AccountsTable WHERE username=@username";
  20.                 command.Prepare();
  21.  
  22.                 command.Parameters.AddWithValue("@username", name);
  23.  
  24.                 pInfo.Level = reader.GetInt32("level");
  25.                 pInfo.Money = reader.GetInt32("cash");
  26.                 pInfo.Bank = reader.GetInt32("bank");
  27.                 pInfo.Score = reader.GetInt32("score");
  28.                 pInfo.Team = reader.GetString("team");
  29.                 pInfo.Skill = reader.GetString("skill");
  30.                 pInfo.Class = reader.GetInt32("pclass");
  31.                 pInfo.Skin = reader.GetString("pskin");
  32.                 pInfo.AdminLevel = reader.GetInt32("adminlevel");
  33.                 pInfo.Health = reader.GetInt32("health");
  34.                 pInfo.Armour = reader.GetInt32("armour");
  35.                 pInfo.Wantedlevel = reader.GetInt32("wantedlevel");
  36.                 pInfo.Jailed = reader.GetInt32("jailed");
  37.                 pInfo.House = reader.GetInt32("houseowned");
  38.                 pInfo.LifeInsurance = reader.GetInt32("lifeinsurance");
  39.                 pInfo.JailHour = reader.GetInt32("jailhour");
  40.                 pInfo.JailMinute = reader.GetInt32("jailminute");
  41.                 pInfo.Earnings = reader.GetInt32("earnings");
  42.                 pInfo.Taxes = reader.GetInt32("taxes");
  43.                 pInfo.TaxDay = reader.GetInt32("taxesday");
  44.                 pInfo.Donor = reader.GetInt32("donor");
  45.                 pInfo.HealthInsurance = reader.GetInt32("healthins");
  46.                 pInfo.DaysAlive = reader.GetInt32("pdaysalive");
  47.                 pInfo.HoursAlive = reader.GetInt32("phoursalive");
  48.                 pInfo.MinutesAlive = reader.GetInt32("pminutesalive");
  49.                 pInfo.SecondsAlive = reader.GetInt32("psecondsalive");
  50.  
  51.                 API.sendChatMessageToPlayer(player, COLOR_SKYBLUE + "[Bot Eva] " + COLOR_WHITE + "You have " + COLOR_GREEN + "Successfully " + COLOR_WHITE + "Logged in.");
  52.  
  53.                 pInfo.LoggedIn = true;
  54.  
  55.                 if (pInfo.AdminLevel >= 1)
  56.                 {
  57.                     API.sendChatMessageToPlayer(player, "Welcome Back " + COLOR_PINK + "Admin" + COLOR_WHITE + "!");
  58.  
  59.                 }
  60.                 else
  61.                 {
  62.                     API.sendChatMessageToPlayer(player, "Logged In As A " + COLOR_GREEN + "Registered " + COLOR_WHITE + "Player!");
  63.  
  64.                 }
  65.  
  66.                 API.setEntityDimension(player, 0);
  67.  
  68.                 if (pInfo.Team == "TEAM_CIVILIAN" || pInfo.Skill == "SKILL_NONE")
  69.                 {
  70.  
  71.                     player.position = SpawnPositions[Rnd.Next(SpawnPositions.Count)];
  72.  
  73.  
  74.                     //local classid = pInfo.Class;
  75.                     //player: SetModel(PedSkins[classid]["Spawn_ModelName"])
  76.                     API.givePlayerWeapon(player, WeaponHash.Unarmed, 1, true, true);
  77.                     API.givePlayerWeapon(player, WeaponHash.Knife, 1, false, true);
  78.                     API.givePlayerWeapon(player, WeaponHash.Pistol50, 100, false, true);
  79.                     API.givePlayerWeapon(player, WeaponHash.MicroSMG, 100, false, true);
  80.  
  81.                     var WantedLevel = pInfo.Wantedlevel;
  82.  
  83.                     if (WantedLevel >= 1)
  84.                     {
  85.  
  86.                         //pInfo.WantedLevelCoolerMinute = 60;
  87.                         API.sendChatMessageToPlayer(player, "Wanted Level - " + WantedLevel);
  88.  
  89.  
  90.                     }
  91.  
  92.  
  93.                     if (pInfo.JailHour >= 1 || pInfo.JailMinute >= 1)
  94.                     {
  95.  
  96.                         player.position = JailSpawn[Rnd.Next(JailSpawn.Count)];
  97.  
  98.  
  99.                         API.sendChatMessageToPlayer(player, "Welcome Back To " + COLOR_SKYBLUE + "Jail " + COLOR_WHITE + "Don't Drop The Soap! " + COLOR_RED + "No Random Brawls In Jail" + COLOR_WHITE + ". \nJail Time " + COLOR_SKYBLUE + "" + pInfo.JailHour + " " + COLOR_YELLOW + "Hours, " + COLOR_SKYBLUE + "" + pInfo.JailMinute + " " + COLOR_YELLOW + "Minutes");
  100.                         //SetPlayerWantedLevel(player.id, 0)
  101.                         pInfo.Wantedlevel = 0;
  102.  
  103.                         pInfo.Jailed = 1;
  104.  
  105.                     }
  106.  
  107.  
  108.                     else if (pInfo.Team == "TEAM_LAW" || pInfo.Skill == "SKILL_COP")
  109.                     {
  110.                         player.position = new Vector3(451.09948730469f, -974.49481201172f, 29.689586639404f);
  111.  
  112.  
  113.                         API.sendChatMessageToPlayer(player, "You Are A " + COLOR_LIGHTBLUE + "Law Enforcement Agent " + COLOR_YELLOW + "Protect " + COLOR_WHITE + "The City By Catching " + COLOR_ORANGE + "Criminals!");
  114.  
  115.                         //local classid = pInfo.Class;
  116.                         //player: SetModel(PedSkins[classid]["Spawn_ModelName"])
  117.  
  118.                         API.givePlayerWeapon(player, WeaponHash.Unarmed, 1, true, true);
  119.                         API.givePlayerWeapon(player, WeaponHash.Nightstick, 1, false, true);
  120.                         API.givePlayerWeapon(player, WeaponHash.HeavyPistol, 100, false, true);
  121.                         API.givePlayerWeapon(player, WeaponHash.AssaultSMG, 100, false, true);
  122.  
  123.                     }
  124.                 }
  125.             }
  126.             else
  127.             {
  128.  
  129.                 API.sendChatMessageToPlayer(player, COLOR_SKYBLUE + "[Bot Eva] " + COLOR_RED + "You Are Not Registered. Register First!");
  130.  
  131.             }
  132.  
  133.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement