CrepperboyHD

Why

Apr 11th, 2021
701
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2. using GTANetworkAPI;
  3. using System.Threading.Tasks;
  4. using MySql.Data.MySqlClient;
  5.  
  6. namespace ServerSide.Client
  7. {
  8.     public class Data
  9.     {
  10.         public static readonly String DataIdentifier = "PlayerInfo";
  11.         public Player PlayerData { get; set; }
  12.         public String Name { get; set; }
  13.         public int SQLID { get; set; }
  14.         public string Password { get; set; }
  15.         public string Email { get; set; }
  16.         public string SocialClub { get; set; }
  17.         public ulong SocialClubID { get; set; }
  18.         public string LastIP { get; set; }
  19.         public int ID { get; set; }
  20.         public int SessionID { get; set; }
  21.         public int Cash { get; set; }
  22.         public int BankCash { get; set; }
  23.         public int Gold { get; set; }
  24.         public int Level { get; set; }
  25.         public int EXP { get; set; }
  26.         public int Age { get; set; }
  27.         public double PhoneNumber { get; set; }
  28.         public int Health { get; set; }
  29.         public int Hunger { get; set; }
  30.         public int Thirst { get; set; }
  31.         public int Armor { get; set; }
  32.         public int Job { get; set; }
  33.         public int Faction { get; set; }
  34.         public int FactionRank { get; set; }
  35.         public bool isNewbie { get; set; }
  36.         public bool isArrested { get; set; }
  37.         public int ArrestTime { get; set; }
  38.         public bool isBanned { get; set; }
  39.         public int BanTime { get; set; }
  40.         public bool isMuted { get; set; }
  41.         public int MuteTime { get; set; }
  42.         public bool IsLoggedIn { get; set; }
  43.         public bool Withelist { get; set; }
  44.  
  45.         public Data(Player player)
  46.         {
  47.             this.PlayerData = player;
  48.             this.Name = player.Name;
  49.             this.SQLID = 0;
  50.             this.Password = null;
  51.             this.Email = null;
  52.             this.SocialClub = player.SocialClubName;
  53.             this.SocialClubID = player.SocialClubId;
  54.             this.LastIP = player.Address;
  55.             this.ID = 0;
  56.             this.SessionID = 0;
  57.             this.Cash = 5000;
  58.             this.BankCash = 10000;
  59.             this.Gold = 0;
  60.             this.Level = 0;
  61.             this.EXP = 0;
  62.             this.Age = 18;
  63.             this.PhoneNumber = 0;
  64.             this.Health = 0;
  65.             this.Hunger = 100;
  66.             this.Thirst = 100;
  67.             this.Armor = 0;
  68.             this.Job = 0;
  69.             this.Faction = 0;
  70.             this.FactionRank = 0;
  71.             this.isNewbie = true;
  72.             this.isArrested = false;
  73.             this.ArrestTime = 0;
  74.             this.isBanned = false;
  75.             this.BanTime = 0;
  76.             this.isMuted = false;
  77.             this.MuteTime = 0;
  78.             this.IsLoggedIn = false;
  79.             this.Withelist = false;
  80.         }
  81.  
  82.         public void SetHealth(int health)
  83.         {
  84.             this.Health = health;
  85.             this.PlayerData.Health = health;
  86.         }
  87.  
  88.         public static Data GetDataFromPlayer(Player player)
  89.         {
  90.             if (player == null)
  91.                 return null;
  92.  
  93.             if (player.HasData(DataIdentifier))
  94.             {
  95.                 return player.GetData<Data>(DataIdentifier);
  96.             }
  97.             else
  98.             {
  99.                 Data tmp = new Data(player);
  100.                 player.SetData(DataIdentifier, tmp);
  101.                 return player.GetData<Data>(DataIdentifier);
  102.             }
  103.         }
  104.  
  105.         public async Task<bool> AccountExists()
  106.         {
  107.             String Query = $"SELECT COUNT(*) AS AccNo FROM `accounts` WHERE `Playername` = @Playername LIMIT 1;";
  108.             bool accountExists = false;
  109.             using (MySqlCommand command = new MySqlCommand(Query, mysql.MySQL.conn))
  110.             {
  111.                 command.Parameters.AddWithValue("@Playername", this.PlayerData.Name);
  112.  
  113.                 using (var reader = await command.ExecuteReaderAsync())
  114.                 {
  115.                     if (await reader.ReadAsync())
  116.                     {
  117.                         if (Convert.ToInt32(reader["AccNo"]) == 1)
  118.                             accountExists = true;
  119.                         else
  120.                             accountExists = false;
  121.                     }
  122.                 }
  123.             }
  124.             return accountExists;
  125.         }
  126.  
  127.     }
  128. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×