// A player submitted a custom textbox
private void BTT_TextBoxOkClicked(Packets.IS_BTT BTT)
{
try
{
switch (BTT.ClickID)
{
case 191:
if (Connections[GetConnIdx(BTT.UCID)].InBank == 1) // Deposit
{
int Deposit = int.Parse(BTT.Text);
if (BTT.Text.Contains("-"))
{
InSim.Send_MTC_MessageToConnection("^1* ^3Deposit Error. Please don't use minus values!", Connections[GetConnIdx(BTT.UCID)].UniqueID, 0);
}
else if (Connections[GetConnIdx(BTT.UCID)].Cash >= Deposit)
{
Connections[GetConnIdx(BTT.UCID)].BankBalance += Deposit;
Connections[GetConnIdx(BTT.UCID)].Cash -= Deposit;
Connections[GetConnIdx(BTT.UCID)].TodaysCash -= Deposit;
Connections[GetConnIdx(BTT.UCID)].Timer = 60;
InSim.Send_MTC_MessageToConnection("^1*^3 You successfully deposited ^7£" + Deposit, Connections[GetConnIdx(BTT.UCID)].UniqueID, 0);
InSim.Send_MTC_MessageToConnection("^1*^3 Your new Bank Balance is ^7£" + Connections[GetConnIdx(BTT.UCID)].BankBalance, Connections[GetConnIdx(BTT.UCID)].UniqueID, 0);
}
else if (Connections[GetConnIdx(BTT.UCID)].Cash < Deposit)
{
InSim.Send_MTC_MessageToConnection("^1* ^3You don't have enough cash to complete the transaction.", Connections[GetConnIdx(BTT.UCID)].UniqueID, 0);
}
}
break;
case 193:
if (Connections[GetConnIdx(BTT.UCID)].InBank == 1) // Withdraw
{
int Withdraw = int.Parse(BTT.Text);
if (BTT.Text.Contains("-"))
{
InSim.Send_MTC_MessageToConnection("^1* ^3Error. Please don't use minus values!", Connections[GetConnIdx(BTT.UCID)].UniqueID, 0);
}
else if (Connections[GetConnIdx(BTT.UCID)].BankBalance >= Withdraw)
{
Connections[GetConnIdx(BTT.UCID)].BankBalance -= Withdraw;
Connections[GetConnIdx(BTT.UCID)].Cash += Withdraw;
Connections[GetConnIdx(BTT.UCID)].Timer = 60;
Connections[GetConnIdx(BTT.UCID)].TodaysCash += Withdraw;
InSim.Send_MTC_MessageToConnection("^1*^3 You successfully withdrew ^7£" + Withdraw, Connections[GetConnIdx(BTT.UCID)].UniqueID, 0);
InSim.Send_MTC_MessageToConnection("^1*^3 Your new Bank Balance is ^7£" + Connections[GetConnIdx(BTT.UCID)].BankBalance, Connections[GetConnIdx(BTT.UCID)].UniqueID, 0);
}
else if (Connections[GetConnIdx(BTT.UCID)].BankBalance < Withdraw)
{
InSim.Send_MTC_MessageToConnection("^1* ^3You don't have enough cash to complete the transaction.", Connections[GetConnIdx(BTT.UCID)].UniqueID, 0);
}
}
break;
}
}
catch (Exception EX)
{
//MessageBox.Show("STA - " + EX.Message);
}
}
if (Connections[GetConnIdx(BTC.UCID)].InBank == 1) // Withdraw
{
}
case "!withdraw":
if (Connections[GetConnIdx(MSO.UCID)].InBank == 1)
{
int Withdraw = int.Parse(StrMsg[1]);
{
if (StrMsg[1].Contains("-"))
{
InSim.Send_MTC_MessageToConnection("^1* ^3Error. Please don't use minus values!", MSO.UCID, 0);
}
else if (Connections[GetConnIdx(MSO.UCID)].BankBalance >= Withdraw)
{
Connections[GetConnIdx(MSO.UCID)].BankBalance -= Withdraw;
Connections[GetConnIdx(MSO.UCID)].Cash += Withdraw;
Connections[GetConnIdx(MSO.UCID)].Timer = 60;
Connections[GetConnIdx(MSO.UCID)].TodaysCash += Withdraw;
InSim.Send_MTC_MessageToConnection("^1*^3 Your new Bank Balance is ^7£" + Connections[GetConnIdx(MSO.UCID)].BankBalance, MSO.UCID, 0);
}
else if (Connections[GetConnIdx(MSO.UCID)].BankBalance < Withdraw)
{
InSim.Send_MTC_MessageToConnection("^1* ^3You don't have enough cash to complete the transaction.", MSO.UCID, 0);
}
}
}
break;
private void BTC_ButtonClicked(Packets.IS_BTC BTC)
{
try
{
switch (BTC.ClickID)
{
case 186: // Close Button
if (Connections[GetConnIdx(Players[GetPlyIdx(BTC.UCID)].UniqueID)].InShop == 1) // Close Pizza
{
// Shop Menu
InSim.Send_BFN_DeleteButton(0, 176, Connections[GetConnIdx(Players[GetPlyIdx(BTC.UCID)].UniqueID)].UniqueID);
// Shop Name
InSim.Send_BFN_DeleteButton(0, 177, Connections[GetConnIdx(Players[GetPlyIdx(BTC.UCID)].UniqueID)].UniqueID);
// Shop Items
InSim.Send_BFN_DeleteButton(0, 178, Connections[GetConnIdx(Players[GetPlyIdx(BTC.UCID)].UniqueID)].UniqueID);
InSim.Send_BFN_DeleteButton(0, 179, Connections[GetConnIdx(Players[GetPlyIdx(BTC.UCID)].UniqueID)].UniqueID);
InSim.Send_BFN_DeleteButton(0, 180, Connections[GetConnIdx(Players[GetPlyIdx(BTC.UCID)].UniqueID)].UniqueID);
InSim.Send_BFN_DeleteButton(0, 181, Connections[GetConnIdx(Players[GetPlyIdx(BTC.UCID)].UniqueID)].UniqueID);
InSim.Send_BFN_DeleteButton(0, 182, Connections[GetConnIdx(Players[GetPlyIdx(BTC.UCID)].UniqueID)].UniqueID);
InSim.Send_BFN_DeleteButton(0, 183, Connections[GetConnIdx(Players[GetPlyIdx(BTC.UCID)].UniqueID)].UniqueID);
InSim.Send_BFN_DeleteButton(0, 184, Connections[GetConnIdx(Players[GetPlyIdx(BTC.UCID)].UniqueID)].UniqueID);
InSim.Send_BFN_DeleteButton(0, 185, Connections[GetConnIdx(Players[GetPlyIdx(BTC.UCID)].UniqueID)].UniqueID);
// Click buttons
InSim.Send_BFN_DeleteButton(0, 186, Connections[GetConnIdx(Players[GetPlyIdx(BTC.UCID)].UniqueID)].UniqueID);// Close
InSim.Send_BFN_DeleteButton(0, 187, Connections[GetConnIdx(Players[GetPlyIdx(BTC.UCID)].UniqueID)].UniqueID);// Info 1
InSim.Send_BFN_DeleteButton(0, 188, Connections[GetConnIdx(Players[GetPlyIdx(BTC.UCID)].UniqueID)].UniqueID);// Info 2
InSim.Send_BFN_DeleteButton(0, 189, Connections[GetConnIdx(Players[GetPlyIdx(BTC.UCID)].UniqueID)].UniqueID);// Info 3
InSim.Send_BFN_DeleteButton(0, 190, Connections[GetConnIdx(Players[GetPlyIdx(BTC.UCID)].UniqueID)].UniqueID);// Info 4
InSim.Send_BFN_DeleteButton(0, 191, Connections[GetConnIdx(Players[GetPlyIdx(BTC.UCID)].UniqueID)].UniqueID);// Info 5
InSim.Send_BFN_DeleteButton(0, 192, Connections[GetConnIdx(Players[GetPlyIdx(BTC.UCID)].UniqueID)].UniqueID);// Info 6
InSim.Send_BFN_DeleteButton(0, 193, Connections[GetConnIdx(Players[GetPlyIdx(BTC.UCID)].UniqueID)].UniqueID);// Info 7
}
if (Connections[GetConnIdx(Players[GetPlyIdx(BTC.UCID)].UniqueID)].InLotto == 1) // Close Lotto
{
// Shop Menu
InSim.Send_BFN_DeleteButton(0, 176, Connections[GetConnIdx(Players[GetPlyIdx(BTC.UCID)].UniqueID)].UniqueID);
// Shop Name
InSim.Send_BFN_DeleteButton(0, 177, Connections[GetConnIdx(Players[GetPlyIdx(BTC.UCID)].UniqueID)].UniqueID);
// Shop Items
InSim.Send_BFN_DeleteButton(0, 178, Connections[GetConnIdx(Players[GetPlyIdx(BTC.UCID)].UniqueID)].UniqueID);
InSim.Send_BFN_DeleteButton(0, 179, Connections[GetConnIdx(Players[GetPlyIdx(BTC.UCID)].UniqueID)].UniqueID);
InSim.Send_BFN_DeleteButton(0, 180, Connections[GetConnIdx(Players[GetPlyIdx(BTC.UCID)].UniqueID)].UniqueID);
InSim.Send_BFN_DeleteButton(0, 181, Connections[GetConnIdx(Players[GetPlyIdx(BTC.UCID)].UniqueID)].UniqueID);
InSim.Send_BFN_DeleteButton(0, 182, Connections[GetConnIdx(Players[GetPlyIdx(BTC.UCID)].UniqueID)].UniqueID);
InSim.Send_BFN_DeleteButton(0, 183, Connections[GetConnIdx(Players[GetPlyIdx(BTC.UCID)].UniqueID)].UniqueID);
InSim.Send_BFN_DeleteButton(0, 184, Connections[GetConnIdx(Players[GetPlyIdx(BTC.UCID)].UniqueID)].UniqueID);
InSim.Send_BFN_DeleteButton(0, 185, Connections[GetConnIdx(Players[GetPlyIdx(BTC.UCID)].UniqueID)].UniqueID);
// Click buttons
InSim.Send_BFN_DeleteButton(0, 186, Connections[GetConnIdx(Players[GetPlyIdx(BTC.UCID)].UniqueID)].UniqueID);// Close
InSim.Send_BFN_DeleteButton(0, 187, Connections[GetConnIdx(Players[GetPlyIdx(BTC.UCID)].UniqueID)].UniqueID);// Info 1
InSim.Send_BFN_DeleteButton(0, 188, Connections[GetConnIdx(Players[GetPlyIdx(BTC.UCID)].UniqueID)].UniqueID);// Info 2
InSim.Send_BFN_DeleteButton(0, 189, Connections[GetConnIdx(Players[GetPlyIdx(BTC.UCID)].UniqueID)].UniqueID);// Info 3
InSim.Send_BFN_DeleteButton(0, 190, Connections[GetConnIdx(Players[GetPlyIdx(BTC.UCID)].UniqueID)].UniqueID);// Info 4
InSim.Send_BFN_DeleteButton(0, 191, Connections[GetConnIdx(Players[GetPlyIdx(BTC.UCID)].UniqueID)].UniqueID);// Info 5
InSim.Send_BFN_DeleteButton(0, 192, Connections[GetConnIdx(Players[GetPlyIdx(BTC.UCID)].UniqueID)].UniqueID);// Info 6
InSim.Send_BFN_DeleteButton(0, 193, Connections[GetConnIdx(Players[GetPlyIdx(BTC.UCID)].UniqueID)].UniqueID);// Info 7
}
break;
case 187: // Buy Button 1
if (Connections[GetConnIdx(Players[GetPlyIdx(BTC.UCID)].UniqueID)].InShop == 1) // Buy Pizza
{
if (Connections[GetConnIdx(Players[GetPlyIdx(BTC.UCID)].UniqueID)].Health <= 89)
{
Connections[GetConnIdx(Players[GetPlyIdx(BTC.UCID)].UniqueID)].Cash -= 10;
Connections[GetConnIdx(Players[GetPlyIdx(BTC.UCID)].UniqueID)].Health += 10;
Connections[GetConnIdx(Players[GetPlyIdx(BTC.UCID)].UniqueID)].TodaysCash -= 10;
InSim.Send_MTC_MessageToConnection("^1* ^3You bought a ^7Pizza", Connections[GetConnIdx(Players[GetPlyIdx(BTC.UCID)].UniqueID)].UniqueID, 0);
}
else
{
InSim.Send_MTC_MessageToConnection("^1* ^3Your health is too high to buy more food", (Connections[GetConnIdx(Players[GetPlyIdx(BTC.UCID)].UniqueID)].UniqueID), 0);
}
}
if (Connections[GetConnIdx(Players[GetPlyIdx(BTC.UCID)].UniqueID)].InLotto == 1) // Buy Lotto Ticket
{
if (Connections[GetConnIdx(Players[GetPlyIdx(BTC.UCID)].UniqueID)].InLotto == 1 && Environment.TickCount - Connections[GetConnIdx(Players[GetPlyIdx(BTC.UCID)].UniqueID)].LastLotto > 1296000) //3 hours
{
Connections[GetConnIdx(Players[GetPlyIdx(BTC.UCID)].UniqueID)].Cash -= 250;
Connections[GetConnIdx(Players[GetPlyIdx(BTC.UCID)].UniqueID)].TodaysCash -= 250;
int prize = new Random().Next(0, 2000);
Connections[GetConnIdx(Players[GetPlyIdx(BTC.UCID)].UniqueID)].Prize += prize;
Connections[GetConnIdx(Players[GetPlyIdx(BTC.UCID)].UniqueID)].Cash += Connections[GetConnIdx(Players[GetPlyIdx(BTC.UCID)].UniqueID)].Prize;
InSim.Send_MTC_MessageToConnection("^1* ^3You have received ^2£" + Connections[GetConnIdx(Players[GetPlyIdx(BTC.UCID)].UniqueID)].Prize + " ^3from Lotto", Connections[GetConnIdx(Players[GetPlyIdx(BTC.UCID)].UniqueID)].UniqueID, 0);
Connections[GetConnIdx(Players[GetPlyIdx(BTC.UCID)].UniqueID)].TodaysCash += Connections[GetConnIdx(Players[GetPlyIdx(BTC.UCID)].UniqueID)].Prize;
Connections[GetConnIdx(Players[GetPlyIdx(BTC.UCID)].UniqueID)].LastLotto = Environment.TickCount;
}
else if (Environment.TickCount - Connections[GetConnIdx(Players[GetPlyIdx(BTC.UCID)].UniqueID)].LastLotto < 1296000)
{
InSim.Send_MTC_MessageToConnection("^1* ^3You have to wait ^73 ^3hours to buy another ticket", Connections[GetConnIdx(Players[GetPlyIdx(BTC.UCID)].UniqueID)].UniqueID, 0);
//Connections[GetConnIdx(MSO.UCID)].InLotto = 1;
}
}
break;
}
}
catch (Exception EX)
{
//MessageBox.Show("BTC - " + EX.Message);
}
}
// A player changed it's camera
private void CCH_CameraChanged(Packets.IS_CCH CCH)
{
}
private void CCH_CameraChanged(Packets.IS_CCH CCH)
{
//C.UniqueID = CCH.PLID;
if (CCH.Camera == Enums.View.VIEW_FOLLOW)// Arcade
{
Connections[GetConnIdx(CCH.PLID)].Cam = 0;
}
if (CCH.Camera == Enums.View.VIEW_HELI)// Helicopter
{
Connections[GetConnIdx(CCH.PLID)].Cam = 1;
}
if (CCH.Camera == Enums.View.VIEW_CAM)// TV Cam
{
Connections[GetConnIdx(CCH.PLID)].Cam = 2;
}
if (CCH.Camera == Enums.View.VIEW_DRIVER)// Cockpit
{
Connections[GetConnIdx(CCH.PLID)].Cam = 3;
}
if (CCH.Camera == Enums.View.VIEW_CUSTOM)// Custom Cam
{
Connections[GetConnIdx(CCH.PLID)].Cam = 4;
}
}