private void updateHUD(object sender, System.Timers.ElapsedEventArgs e)
{
foreach (clsConnection C in Connections)
{
if (Stage == 1)
{
InSim.Send_BTN_CreateButton("^7" + Website, Flags.ButtonStyles.ISB_DARK, 5, 15, 6, 90, 6, C.UniqueID, 2, false);
}
else
{
string Time = Convert.ToString(System.DateTime.Now.TimeOfDay.Hours).PadLeft(2, '0') + ":" + Convert.ToString(System.DateTime.Now.TimeOfDay.Minutes).PadLeft(2, '0');
InSim.Send_BTN_CreateButton("^7" + Time, Flags.ButtonStyles.ISB_DARK, 5, 15, 6, 90, 6, C.UniqueID, 2, false);
}
string TempCars1 = "^2" + Cars.transformFromNumbers(C.Cars);
string TempCars2 = "^2" + Cars.transformFromNumbers(C.Cars);
InSim.Send_BTN_CreateButton("" + TempCars1, Flags.ButtonStyles.ISB_DARK, 5, 60, 0, 137, 140, C.UniqueID, 2, false);
InSim.Send_BTN_CreateButton("" + TempCars2, Flags.ButtonStyles.ISB_DARK, 5, 60, 6, 137, 141, C.UniqueID, 2, false);
if (C.Cash >= 0)
{
InSim.Send_BTN_CreateButton("^7Money: ^2Ђ^7 " + C.Cash, Flags.ButtonStyles.ISB_DARK, 5, 25, 6, 64, 5, C.UniqueID, 2, false);
}
if (C.Cash < 0)
{
InSim.Send_BTN_CreateButton("^7Money: ^2Ђ^1 " + C.Cash, Flags.ButtonStyles.ISB_DARK, 5, 25, 6, 64, 5, C.UniqueID, 2, false);
}
// Distance
if ((C.TotalDistance - C.TotalDistance) >= 0)
{
//Connections[GetConnIdx(Players[GetPlyIdx(MCI.Info[i].PLID)].UniqueID)].Bonus = (Connections[GetConnIdx(Players[GetPlyIdx(MCI.Info[i].PLID)].UniqueID)].DistanceSincePit * 2)
InSim.Send_BTN_CreateButton("^7Distance: ^3 " + (C.TotalDistance / 1000) + "km", Flags.ButtonStyles.ISB_DARK, 5, 30, 6, 106, 139, C.UniqueID, 2, false);
//
// Bonus
//
if (C.DistanceSincePit >= 50000)
{
C.Cash += 1000;
InSim.Send_MST_Message("/msg ^3»^8 " + C.PlayerName + " ^7won ^2Ђ1000^7.");
InSim.Send_MST_Message("/msg ^3»^2 Reason:^7 Distance bonus (Drove 50kms).");
C.DistanceSincePit = 0;
}
C.Bonus = (C.DistanceSincePit / 500);
if (C.Bonus <= 25)
{
InSim.Send_BTN_CreateButton("^1Bonus " + C.Bonus + "%", Flags.ButtonStyles.ISB_DARK, 5, 15, 0, 90, 7, (C.UniqueID), 2, false);
}
if (C.Bonus >= 25 && C.Bonus <= 75)
{
InSim.Send_BTN_CreateButton("^3Bonus " + C.Bonus + "%", Flags.ButtonStyles.ISB_DARK, 5, 15, 0, 90, 7, (C.UniqueID), 2, false);
}
if (C.Bonus >= 75)
{
InSim.Send_BTN_CreateButton("^2Bonus " + C.Bonus + "%", Flags.ButtonStyles.ISB_DARK, 5, 15, 0, 90, 7, (C.UniqueID), 2, false);
}
//
//End of bonus lines
//
if (C.BankBonusCountDown >= 200)
{
InSim.Send_MTC_MessageToConnection("^3» «THC»^7Bank: You have won a ^2Ђ" + (C.BankAccount * 5 / 100) + "^7 interest.", C.UniqueID, 0);
C.BankAccount += (C.BankAccount * 5 / 100);
C.LeftPitsAt = int.Parse(Convert.ToString(System.DateTime.Now.TimeOfDay.Hours).PadLeft(2, '0') + Convert.ToString(System.DateTime.Now.TimeOfDay.Minutes).PadLeft(2, '0'));
C.BankBonusCountDown = 0;
if (C.IsBanking == "true")
{
InSim.Send_BTN_CreateButton("^7Account: ^2Ђ" + C.BankAccount, Flags.ButtonStyles.ISB_LEFT, 6, 70, 100, 50, 220, C.UniqueID, 40, false);
InSim.Send_BTN_CreateButton("^3Next bonus after: " + (120 - (C.BankBonusCountDown * 60 / 100)) + "minutes.", Flags.ButtonStyles.ISB_LEFT, 6, 70, 108, 50, 221, C.UniqueID, 40, false);
}
}
else
{
if (C.BankBonusCountDown == (0 - C.LeftPitsAt))
{
C.LeftPitsAt = 0 - C.LeftPitsAt;
}
else
{
C.BankBonusCountDown = (int.Parse(Convert.ToString(System.DateTime.Now.TimeOfDay.Hours).PadLeft(2, '0') + Convert.ToString(System.DateTime.Now.TimeOfDay.Minutes).PadLeft(2, '0')) - C.LeftPitsAt);
if (C.IsBanking == "true")
{
InSim.Send_BTN_CreateButton("^3Next bonus after: " + (120 - (C.BankBonusCountDown * 60 / 100)) + "minutes.", Flags.ButtonStyles.ISB_LEFT, 6, 70, 108, 50, 221, C.UniqueID, 40, false);
}
}
}
//InSim.Send_BTN_CreateButton("^7Distance: ^2Ђ^7 " + (C.Cash - C.InitialCash), Flags.ButtonStyles.ISB_DARK, 5, 30, 6, 106, 139, C.UniqueID, 2, false);
}
if (C.Cash < -1000000 && C.IsLocal == 0)
{
if (C.IsAdmin == 0)
{
InSim.Send_MST_Message("/msg ^3»^7 " + C.PlayerName + " ^1bankrupted!");
InSim.Send_MST_Message("/msg ^3»^7 " + C.PlayerName + "^1's account will be resetted!");
InSim.Send_MTC_MessageToConnection("^1Your account will be resetted.", C.UniqueID, 0);
FileInfo.AccountReset(C.Username);
AccountReset = true;
InSim.Send_MST_Message("/kick " + C.Username);
}
else
{
InSim.Send_MST_Message("!setreason ^1Would bankrupt.");
InSim.Send_MST_Message("!refund " + (2000 - C.Cash) + " " + C.Username);
}
}
}
if (Stage == 1)
{
Stage = 2;
}
else
{
Stage = 1;
}
}
private void updateHUD(object sender, System.Timers.ElapsedEventArgs e)
{
foreach (clsConnection Conn in Connections)
{
//InSim.Send_MST_Message("!pm broken " + Conn.Username);
int ID = 0;
while (ID <= 25)
{
ID += 1;
string FullHUD = Conn.FullHUD.Split('>')[ID];
FullHUD = FullHUD.Replace('*', ' ');
string[] HUD = FullHUD.ToString().Split(' ');
string Style = HUD[4];
string truefalse = "false";
int buttonCount = ID;
if (HUD[5] == "notalways")
{
truefalse = "false";
}
else
{
truefalse = "true";
}
if (HUD[6] == "BackGround")
{
InSim.Send_BTN_CreateButton("", Flags.ButtonStyles.ISB_C1 - 1 + Convert.ToByte(Style), Convert.ToByte(HUD[0]), Convert.ToByte(HUD[1]), Convert.ToByte(HUD[2]), Convert.ToByte(HUD[3]), Convert.ToByte(buttonCount), Conn.UniqueID, 2, Convert.ToBoolean(truefalse));
}
else if (HUD[6] == "TotalMoney")
{
if (Conn.Cash >= 0)
{
InSim.Send_BTN_CreateButton("^2" + MoneySign + "^8 " + Conn.Cash, Flags.ButtonStyles.ISB_C1 - 1 + Convert.ToByte(Style), Convert.ToByte(HUD[0]), Convert.ToByte(HUD[1]), Convert.ToByte(HUD[2]), Convert.ToByte(HUD[3]), Convert.ToByte(buttonCount), Conn.UniqueID, 2, Convert.ToBoolean(truefalse));
}
else if (Conn.Cash < 0)
{
InSim.Send_BTN_CreateButton("^2" + MoneySign + "^1 " + Conn.Cash, Flags.ButtonStyles.ISB_C1 - 1 + Convert.ToByte(Style), Convert.ToByte(HUD[0]), Convert.ToByte(HUD[1]), Convert.ToByte(HUD[2]), Convert.ToByte(HUD[3]), Convert.ToByte(buttonCount), Conn.UniqueID, 2, Convert.ToBoolean(truefalse));
}
}
else if (HUD[6] == "TodayMoney")
{
if (Conn.Cash - Conn.InitialCash >= 0)
{
InSim.Send_BTN_CreateButton("^7Earned today: ^2" + MoneySign + "^8" + (Conn.Cash - Conn.InitialCash), Flags.ButtonStyles.ISB_C1 - 1 + Convert.ToByte(Style), Convert.ToByte(HUD[0]), Convert.ToByte(HUD[1]), Convert.ToByte(HUD[2]), Convert.ToByte(HUD[3]), Convert.ToByte(buttonCount), Conn.UniqueID, 2, Convert.ToBoolean(truefalse));
}
else if (Conn.Cash - Conn.InitialCash < 0)
{
InSim.Send_BTN_CreateButton("^7Lost today: ^1" + MoneySign + ((Conn.Cash - Conn.InitialCash) - (Conn.Cash - Conn.InitialCash) * 2), Flags.ButtonStyles.ISB_C1 - 1 + Convert.ToByte(Style), Convert.ToByte(HUD[0]), Convert.ToByte(HUD[1]), Convert.ToByte(HUD[2]), Convert.ToByte(HUD[3]), Convert.ToByte(buttonCount), Conn.UniqueID, 2, Convert.ToBoolean(truefalse));
}
}
else if (HUD[6] == "BonusText")
{
InSim.Send_BTN_CreateButton("^7Bonus(" + Conn.Bonus + "%):", Flags.ButtonStyles.ISB_C1 - 1 + Convert.ToByte(Style), Convert.ToByte(HUD[0]), Convert.ToByte(HUD[1]), Convert.ToByte(HUD[2]), Convert.ToByte(HUD[3]), Convert.ToByte(buttonCount), Conn.UniqueID, 2, Convert.ToBoolean(truefalse));
}
else if (HUD[6] == "BonusBar")
{
string bonusStr1 = new string('|', Conn.Bonus / 1000);
string bonusStr2 = new string('|', 100 - Conn.Bonus / 1000);
string bonusStr = "^2" + bonusStr1 + "^0" + bonusStr2;
InSim.Send_BTN_CreateButton("" + bonusStr, Flags.ButtonStyles.ISB_C1 - 1 + Convert.ToByte(Style), Convert.ToByte(HUD[0]), Convert.ToByte(HUD[1]), Convert.ToByte(HUD[2]), Convert.ToByte(HUD[3]), Convert.ToByte(buttonCount), Conn.UniqueID, 2, Convert.ToBoolean(truefalse));
}
else if (HUD[6] == "HealthText")
{
InSim.Send_BTN_CreateButton("^7Health(" + (Conn.Energy / 1000) + "%):", Flags.ButtonStyles.ISB_C1 - 1 + Convert.ToByte(Style), Convert.ToByte(HUD[0]), Convert.ToByte(HUD[1]), Convert.ToByte(HUD[2]), Convert.ToByte(HUD[3]), Convert.ToByte(buttonCount), Conn.UniqueID, 2, Convert.ToBoolean(truefalse));
}
else if (HUD[6] == "HealthBar")
{
string healthStr1 = new string('|', Conn.Energy / 1000);
string healthStr2 = new string('|', 100 - Conn.Energy / 1000);
string healthStr = "^7" + healthStr1 + "^0" + healthStr2;
InSim.Send_BTN_CreateButton("" + healthStr, Flags.ButtonStyles.ISB_C1 - 1 + Convert.ToByte(Style), Convert.ToByte(HUD[0]), Convert.ToByte(HUD[1]), Convert.ToByte(HUD[2]), Convert.ToByte(HUD[3]), Convert.ToByte(buttonCount), Conn.UniqueID, 2, Convert.ToBoolean(truefalse));
}
else if (HUD[6] == "CarsString")
{
//string TempCars1 = "^" + Cars.ownsCar(Connections[GetConnIdx(UCID)].Cars, "UF1") + "UF1 ^" + Cars.ownsCar(Connections[GetConnIdx(UCID)].Cars, "XFG") + "XFG ^" + Cars.ownsCar(Connections[GetConnIdx(UCID)].Cars, "XRG") + "XRG ^" + Cars.ownsCar(Connections[GetConnIdx(UCID)].Cars, "LX4") + "LX4 ^" + Cars.ownsCar(Connections[GetConnIdx(UCID)].Cars, "LX6") + "LX6 ^" + Cars.ownsCar(Connections[GetConnIdx(UCID)].Cars, "RB4") + "RB4 ^" + Cars.ownsCar(Connections[GetConnIdx(UCID)].Cars, "FXO") + "FXO ^" + Cars.ownsCar(Connections[GetConnIdx(UCID)].Cars, "XRT") + "XRT ^" + Cars.ownsCar(Connections[GetConnIdx(UCID)].Cars, "RAC") + "RAC ^" + Cars.ownsCar(Connections[GetConnIdx(UCID)].Cars, "VWS") + "VWS ^" + Cars.ownsCar(Connections[GetConnIdx(UCID)].Cars, "FZ5") + "FZ5";
//string TempCars2 = "^" + Cars.ownsCar(Connections[GetConnIdx(UCID)].Cars, "UFR") + "UFR ^" + Cars.ownsCar(Connections[GetConnIdx(UCID)].Cars, "XFR") + "XFR ^" + Cars.ownsCar(Connections[GetConnIdx(UCID)].Cars, "FXR") + "FXR ^" + Cars.ownsCar(Connections[GetConnIdx(UCID)].Cars, "XRR") + "XRR ^" + Cars.ownsCar(Connections[GetConnIdx(UCID)].Cars, "FZR") + "FZR ^" + Cars.ownsCar(Connections[GetConnIdx(UCID)].Cars, "MRT") + "MRT ^" + Cars.ownsCar(Connections[GetConnIdx(UCID)].Cars, "FBM") + "FBM ^" + Cars.ownsCar(Connections[GetConnIdx(UCID)].Cars, "FOX") + "FOX ^" + Cars.ownsCar(Connections[GetConnIdx(UCID)].Cars, "FO8") + "FO8 ^" + Cars.ownsCar(Connections[GetConnIdx(UCID)].Cars, "BF1") + "BF1";
string CarsString = Cars.transformFromNumbers(Conn.Cars);
InSim.Send_BTN_CreateButton("" + CarsString, Flags.ButtonStyles.ISB_C1 - 1 + Convert.ToByte(Style), Convert.ToByte(HUD[0]), Convert.ToByte(HUD[1]), Convert.ToByte(HUD[2]), Convert.ToByte(HUD[3]), Convert.ToByte(buttonCount), Conn.UniqueID, 2, Convert.ToBoolean(truefalse));
}
else if (HUD[6] == "InSimVersion")
{
string InSimVersion = "Version: 1.2.4.2BETA";
InSim.Send_BTN_CreateButton("" + InSimVersion, Flags.ButtonStyles.ISB_C1 - 1 + Convert.ToByte(Style), Convert.ToByte(HUD[0]), Convert.ToByte(HUD[1]), Convert.ToByte(HUD[2]), Convert.ToByte(HUD[3]), Convert.ToByte(buttonCount), Conn.UniqueID, 2, Convert.ToBoolean(truefalse));
}
else if (HUD[6] == "CurrentLocation")
{
InSim.Send_BTN_CreateButton("" + Conn.Location, Flags.ButtonStyles.ISB_C1 - 1 + Convert.ToByte(Style), Convert.ToByte(HUD[0]), Convert.ToByte(HUD[1]), Convert.ToByte(HUD[2]), Convert.ToByte(HUD[3]), Convert.ToByte(buttonCount), Conn.UniqueID, 2, Convert.ToBoolean(truefalse));
}
else if (HUD[6] == "SpeedLimit")
{
InSim.Send_BTN_CreateButton("" + Conn.Speed + "km/h ^7/^8 " + Conn.SpeedLimit + "km/h", Flags.ButtonStyles.ISB_C1 - 1 + Convert.ToByte(Style), Convert.ToByte(HUD[0]), Convert.ToByte(HUD[1]), Convert.ToByte(HUD[2]), Convert.ToByte(HUD[3]), Convert.ToByte(buttonCount), Conn.UniqueID, 2, Convert.ToBoolean(truefalse));
}
else if (HUD[6] == "TotalDistance")
{
InSim.Send_BTN_CreateButton("" + (Conn.TotalDistance / 1000) + "km", Flags.ButtonStyles.ISB_C1 - 1 + Convert.ToByte(Style), Convert.ToByte(HUD[0]), Convert.ToByte(HUD[1]), Convert.ToByte(HUD[2]), Convert.ToByte(HUD[3]), Convert.ToByte(buttonCount), Conn.UniqueID, 2, Convert.ToBoolean(truefalse));
}
else if (HUD[6] == "TodayDistance")
{
InSim.Send_BTN_CreateButton("Today: " + (Conn.DistanceSincePit / 1000) + "km", Flags.ButtonStyles.ISB_C1 - 1 + Convert.ToByte(Style), Convert.ToByte(HUD[0]), Convert.ToByte(HUD[1]), Convert.ToByte(HUD[2]), Convert.ToByte(HUD[3]), Convert.ToByte(buttonCount), Conn.UniqueID, 2, Convert.ToBoolean(truefalse));
}
}
}
}