Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [Command("login", "[Usage] /login Password")]
- public void LoginCommand(Client player, string password)
- {
- var connection = new MySqlConnection(myConnectionString);
- var command = connection.CreateCommand();
- var name = API.getPlayerName(player);
- connection.Open();
- command.CommandText = "SELECT * FROM AccountsTable WHERE username = @username AND password = @password";
- command.Prepare();
- command.Parameters.AddWithValue("@username", name);
- command.Parameters.AddWithValue("@password", password);
- var reader = command.ExecuteReader();
- if (reader.HasRows && reader.Read())
- {
- command.CommandText = "SELECT password FROM AccountsTable WHERE username=@username";
- command.Prepare();
- command.Parameters.AddWithValue("@username", name);
- pInfo.Level = reader.GetInt32("level");
- pInfo.Money = reader.GetInt32("cash");
- pInfo.Bank = reader.GetInt32("bank");
- pInfo.Score = reader.GetInt32("score");
- pInfo.Team = reader.GetString("team");
- pInfo.Skill = reader.GetString("skill");
- pInfo.Class = reader.GetInt32("pclass");
- pInfo.Skin = reader.GetString("pskin");
- pInfo.AdminLevel = reader.GetInt32("adminlevel");
- pInfo.Health = reader.GetInt32("health");
- pInfo.Armour = reader.GetInt32("armour");
- pInfo.Wantedlevel = reader.GetInt32("wantedlevel");
- pInfo.Jailed = reader.GetInt32("jailed");
- pInfo.House = reader.GetInt32("houseowned");
- pInfo.LifeInsurance = reader.GetInt32("lifeinsurance");
- pInfo.JailHour = reader.GetInt32("jailhour");
- pInfo.JailMinute = reader.GetInt32("jailminute");
- pInfo.Earnings = reader.GetInt32("earnings");
- pInfo.Taxes = reader.GetInt32("taxes");
- pInfo.TaxDay = reader.GetInt32("taxesday");
- pInfo.Donor = reader.GetInt32("donor");
- pInfo.HealthInsurance = reader.GetInt32("healthins");
- pInfo.DaysAlive = reader.GetInt32("pdaysalive");
- pInfo.HoursAlive = reader.GetInt32("phoursalive");
- pInfo.MinutesAlive = reader.GetInt32("pminutesalive");
- pInfo.SecondsAlive = reader.GetInt32("psecondsalive");
- API.sendChatMessageToPlayer(player, COLOR_SKYBLUE + "[Bot Eva] " + COLOR_WHITE + "You have " + COLOR_GREEN + "Successfully " + COLOR_WHITE + "Logged in.");
- pInfo.LoggedIn = true;
- if (pInfo.AdminLevel >= 1)
- {
- API.sendChatMessageToPlayer(player, "Welcome Back " + COLOR_PINK + "Admin" + COLOR_WHITE + "!");
- }
- else
- {
- API.sendChatMessageToPlayer(player, "Logged In As A " + COLOR_GREEN + "Registered " + COLOR_WHITE + "Player!");
- }
- API.setEntityDimension(player, 0);
- if (pInfo.Team == "TEAM_CIVILIAN" || pInfo.Skill == "SKILL_NONE")
- {
- player.position = SpawnPositions[Rnd.Next(SpawnPositions.Count)];
- //local classid = pInfo.Class;
- //player: SetModel(PedSkins[classid]["Spawn_ModelName"])
- API.givePlayerWeapon(player, WeaponHash.Unarmed, 1, true, true);
- API.givePlayerWeapon(player, WeaponHash.Knife, 1, false, true);
- API.givePlayerWeapon(player, WeaponHash.Pistol50, 100, false, true);
- API.givePlayerWeapon(player, WeaponHash.MicroSMG, 100, false, true);
- var WantedLevel = pInfo.Wantedlevel;
- if (WantedLevel >= 1)
- {
- //pInfo.WantedLevelCoolerMinute = 60;
- API.sendChatMessageToPlayer(player, "Wanted Level - " + WantedLevel);
- }
- if (pInfo.JailHour >= 1 || pInfo.JailMinute >= 1)
- {
- player.position = JailSpawn[Rnd.Next(JailSpawn.Count)];
- 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");
- //SetPlayerWantedLevel(player.id, 0)
- pInfo.Wantedlevel = 0;
- pInfo.Jailed = 1;
- }
- else if (pInfo.Team == "TEAM_LAW" || pInfo.Skill == "SKILL_COP")
- {
- player.position = new Vector3(451.09948730469f, -974.49481201172f, 29.689586639404f);
- API.sendChatMessageToPlayer(player, "You Are A " + COLOR_LIGHTBLUE + "Law Enforcement Agent " + COLOR_YELLOW + "Protect " + COLOR_WHITE + "The City By Catching " + COLOR_ORANGE + "Criminals!");
- //local classid = pInfo.Class;
- //player: SetModel(PedSkins[classid]["Spawn_ModelName"])
- API.givePlayerWeapon(player, WeaponHash.Unarmed, 1, true, true);
- API.givePlayerWeapon(player, WeaponHash.Nightstick, 1, false, true);
- API.givePlayerWeapon(player, WeaponHash.HeavyPistol, 100, false, true);
- API.givePlayerWeapon(player, WeaponHash.AssaultSMG, 100, false, true);
- }
- }
- }
- else
- {
- API.sendChatMessageToPlayer(player, COLOR_SKYBLUE + "[Bot Eva] " + COLOR_RED + "You Are Not Registered. Register First!");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement