Exemplo n.º 1
0
 public void AddUpdateVictimAccount(Steamworks.CSteamID id, decimal bounty, string lastDisplayName)
 {
     try
     {
         MySqlConnection connection = CreateConnection();
         MySqlCommand command = connection.CreateCommand();
         if (CheckExists(id))
         {
             command.CommandText = "UPDATE `" + FeexHitman.Instance.Configuration.Instance.DatabaseTableName + "` SET `bounty` = bounty + (" + bounty + "), `lastDisplayName` = '" + lastDisplayName + "', `lastUpdated` = NOW() WHERE `steamId` = '" + id.ToString() + "'";
         }
         else
         {
             command.CommandText = "INSERT IGNORE INTO `" + FeexHitman.Instance.Configuration.Instance.DatabaseTableName + "` (steamId,bounty,lastDisplayName,lastUpdated) VALUES('" + id.ToString() + "','" + bounty + "','" + lastDisplayName + "',NOW())";
         }
         connection.Open();
         command.ExecuteNonQuery();
         connection.Close();
     }
     catch (Exception ex)
     {
         Logger.LogException(ex);
     }
 }
Exemplo n.º 2
0
 public decimal GetBounty(Steamworks.CSteamID id)
 {
     decimal output = 0;
     try
     {
         MySqlConnection connection = CreateConnection();
         MySqlCommand command = connection.CreateCommand();
         command.CommandText = "SELECT `bounty` FROM `" + FeexHitman.Instance.Configuration.Instance.DatabaseTableName + "` WHERE `steamId` = '" + id.ToString() + "'";
         connection.Open();
         object result = command.ExecuteScalar();
         if (result != null) Decimal.TryParse(result.ToString(), out output);
         connection.Close();
     }
     catch (Exception ex)
     {
         Logger.LogException(ex);
     }
     return output;
 }
Exemplo n.º 3
0
        public bool CheckExists(Steamworks.CSteamID id)
        {
            try
            {
                MySqlConnection connection = CreateConnection();
                MySqlCommand command = connection.CreateCommand();
                int exists = 0;
                command.CommandText = "SELECT COUNT(1) FROM `" + FeexHitman.Instance.Configuration.Instance.DatabaseTableName + "` WHERE `steamId` = '" + id.ToString() + "'";
                connection.Open();
                object result = command.ExecuteScalar();
                if (result != null) Int32.TryParse(result.ToString(), out exists);
                connection.Close();

                if (exists == 0) { return false; }
                else { return true; }
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
                return false;
            }
        }
 public static bool IsPlayer(Steamworks.CSteamID caller)
 {
     return (caller != null && !String.IsNullOrEmpty(caller.ToString()) && caller.ToString() != "0");
 }
Exemplo n.º 5
0
 public void UpdateVictimDisplayName(Steamworks.CSteamID id, string lastDisplayName)
 {
     try
     {
         MySqlConnection connection = CreateConnection();
         MySqlCommand command = connection.CreateCommand();
         command.CommandText = "UPDATE `" + FeexHitman.Instance.Configuration.Instance.DatabaseTableName + "` SET `lastDisplayName` = '" + lastDisplayName + "' WHERE `steamId` = '" + id.ToString() + "'";
         connection.Open();
         command.ExecuteNonQuery();
         connection.Close();
     }
     catch (Exception ex)
     {
         Logger.LogException(ex);
     }
 }
Exemplo n.º 6
0
 public bool RemoveVictimAccount(Steamworks.CSteamID id)
 {
     try
     {
         MySqlConnection connection = CreateConnection();
         MySqlCommand command = connection.CreateCommand();
         command.CommandText = "DELETE FROM `" + FeexHitman.Instance.Configuration.Instance.DatabaseTableName + "` WHERE `steamId`='" + id.ToString() + "'";
         connection.Open();
         command.ExecuteNonQuery();
         connection.Close();
         return true;
     }
     catch (Exception ex)
     {
         Logger.LogException(ex);
         return false;
     }
 }