The online racing simulator
Code in Button
Hello, i have 2 questions to make.

First Question:


I've created a car shop, and i have (BUY) / (SELL) buttons, and i wan't to put Buy code for XFG in BUY button.

The code of !buy command is this:

case "!buy":
if (StrMsg.Length == 2)
{
if (Connections[GetConnIdx(MSO.UCID)].Cars.Contains(StrMsg[1].ToUpper()))
InSim.Send_MTC_MessageToConnection("^1Car already owned", MSO.UCID, 0);
else if (Dealer.GetCarPrice(StrMsg[1]) == 0)
InSim.Send_MTC_MessageToConnection("^1Invalid car selection", MSO.UCID, 0);
else if (Connections[GetConnIdx(MSO.UCID)].Cash >= Dealer.GetCarPrice(StrMsg[1]))
{
string Cars = Connections[GetConnIdx(MSO.UCID)].Cars;

switch (StrMsg[1].ToUpper())
{
case "UF1":
Cars = Cars + " " + "UF1";
Connections[GetConnIdx(MSO.UCID)].Cars = Cars;
Connections[GetConnIdx(MSO.UCID)].Cash -= Dealer.GetCarPrice("UF1");
InSim.Send_MST_Message("/msg ^6|^7 " + Connections[GetConnIdx(MSO.UCID)].PlayerName + " ^7bought a UF1");
break;

case "XFG":
Cars = Cars + " " + "XFG";
Connections[GetConnIdx(MSO.UCID)].Cars = Cars;
Connections[GetConnIdx(MSO.UCID)].Cash -= Dealer.GetCarPrice("XFG");
InSim.Send_MST_Message("/msg ^6|^7 " + Connections[GetConnIdx(MSO.UCID)].PlayerName + " ^7bought a XFG");
break;

case "XRG":
Cars = Cars + " " + "XRG";
Connections[GetConnIdx(MSO.UCID)].Cars = Cars;
Connections[GetConnIdx(MSO.UCID)].Cash -= Dealer.GetCarPrice("XRG");
InSim.Send_MST_Message("/msg ^6|^7 " + Connections[GetConnIdx(MSO.UCID)].PlayerName + " ^7bought a XRG");
break;

case "LX4":
Cars = Cars + " " + "LX4";
Connections[GetConnIdx(MSO.UCID)].Cars = Cars;
Connections[GetConnIdx(MSO.UCID)].Cash -= Dealer.GetCarPrice("LX4");
InSim.Send_MST_Message("/msg ^6|^7 " + Connections[GetConnIdx(MSO.UCID)].PlayerName + " ^7bought a LX4");
break;

case "LX6":
Cars = Cars + " " + "LX6";
Connections[GetConnIdx(MSO.UCID)].Cars = Cars;
Connections[GetConnIdx(MSO.UCID)].Cash -= Dealer.GetCarPrice("LX6");
InSim.Send_MST_Message("/msg ^6|^7 " + Connections[GetConnIdx(MSO.UCID)].PlayerName + " ^7bought a LX6");
break;

case "RB4":
Cars = Cars + " " + "RB4";
Connections[GetConnIdx(MSO.UCID)].Cars = Cars;
Connections[GetConnIdx(MSO.UCID)].Cash -= Dealer.GetCarPrice("RB4");
InSim.Send_MST_Message("/msg ^6|^7 " + Connections[GetConnIdx(MSO.UCID)].PlayerName + " ^7bought a RB4");
break;

case "FXO":
Cars = Cars + " " + "FXO";
Connections[GetConnIdx(MSO.UCID)].Cars = Cars;
Connections[GetConnIdx(MSO.UCID)].Cash -= Dealer.GetCarPrice("FXO");
InSim.Send_MST_Message("/msg ^6|^7 " + Connections[GetConnIdx(MSO.UCID)].PlayerName + " ^7bought a FXO");
break;

case "XRT":
Cars = Cars + " " + "XRT";
Connections[GetConnIdx(MSO.UCID)].Cars = Cars;
Connections[GetConnIdx(MSO.UCID)].Cash -= Dealer.GetCarPrice("XRT");
InSim.Send_MST_Message("/msg ^6|^7 " + Connections[GetConnIdx(MSO.UCID)].PlayerName + " ^7bought a XRT");
break;

case "RAC":
Cars = Cars + " " + "RAC";
Connections[GetConnIdx(MSO.UCID)].Cars = Cars;
Connections[GetConnIdx(MSO.UCID)].Cash -= Dealer.GetCarPrice("RAC");
InSim.Send_MST_Message("/msg ^6|^7 " + Connections[GetConnIdx(MSO.UCID)].PlayerName + " ^7bought a RAC");
break;

case "FZ5":
Cars = Cars + " " + "FZ5";
Connections[GetConnIdx(MSO.UCID)].Cars = Cars;
Connections[GetConnIdx(MSO.UCID)].Cash -= Dealer.GetCarPrice("FZ5");
InSim.Send_MST_Message("/msg ^6|^7 " + Connections[GetConnIdx(MSO.UCID)].PlayerName + " ^7bought a FZ5");
break;

case "UFR":
Cars = Cars + " " + "UFR";
Connections[GetConnIdx(MSO.UCID)].Cars = Cars;
Connections[GetConnIdx(MSO.UCID)].Cash -= Dealer.GetCarPrice("UFR");
InSim.Send_MST_Message("/msg ^6|^7 " + Connections[GetConnIdx(MSO.UCID)].PlayerName + " ^7bought a UFR");
break;

case "XFR":
Cars = Cars + " " + "XFR";
Connections[GetConnIdx(MSO.UCID)].Cars = Cars;
Connections[GetConnIdx(MSO.UCID)].Cash -= Dealer.GetCarPrice("XFR");
InSim.Send_MST_Message("/msg ^6|^7 " + Connections[GetConnIdx(MSO.UCID)].PlayerName + " ^7bought a XFR");
break;

case "FXR":
Cars = Cars + " " + "FXR";
Connections[GetConnIdx(MSO.UCID)].Cars = Cars;
Connections[GetConnIdx(MSO.UCID)].Cash -= Dealer.GetCarPrice("FXR");
InSim.Send_MST_Message("/msg ^6|^7 " + Connections[GetConnIdx(MSO.UCID)].PlayerName + " ^7bought a FXR");
break;

case "XRR":
Cars = Cars + " " + "XRR";
Connections[GetConnIdx(MSO.UCID)].Cars = Cars;
Connections[GetConnIdx(MSO.UCID)].Cash -= Dealer.GetCarPrice("XRR");
InSim.Send_MST_Message("/msg ^6|^7 " + Connections[GetConnIdx(MSO.UCID)].PlayerName + " ^7bought a XRR");
break;

case "FZR":
Cars = Cars + " " + "FZR";
Connections[GetConnIdx(MSO.UCID)].Cars = Cars;
Connections[GetConnIdx(MSO.UCID)].Cash -= Dealer.GetCarPrice("FZR");
InSim.Send_MST_Message("/msg ^6|^7 " + Connections[GetConnIdx(MSO.UCID)].PlayerName + " ^7bought a FZR");
break;

case "MRT":
Cars = Cars + " " + "MRT";
Connections[GetConnIdx(MSO.UCID)].Cars = Cars;
Connections[GetConnIdx(MSO.UCID)].Cash -= Dealer.GetCarPrice("MRT");
InSim.Send_MST_Message("/msg ^6|^7 " + Connections[GetConnIdx(MSO.UCID)].PlayerName + " ^7bought a MRT");
break;

case "FOX":
Cars = Cars + " " + "FOX";
Connections[GetConnIdx(MSO.UCID)].Cars = Cars;
Connections[GetConnIdx(MSO.UCID)].Cash -= Dealer.GetCarPrice("FOX");
InSim.Send_MST_Message("/msg ^6|^7 " + Connections[GetConnIdx(MSO.UCID)].PlayerName + " ^7bought a FOX");
break;

case "FBM":
Cars = Cars + " " + "FBM";
Connections[GetConnIdx(MSO.UCID)].Cars = Cars;
Connections[GetConnIdx(MSO.UCID)].Cash -= Dealer.GetCarPrice("FBM");
InSim.Send_MST_Message("/msg ^6|^7 " + Connections[GetConnIdx(MSO.UCID)].PlayerName + " ^7bought a FBM");
break;

case "FO8":
Cars = Cars + " " + "FO8";
Connections[GetConnIdx(MSO.UCID)].Cars = Cars;
Connections[GetConnIdx(MSO.UCID)].Cash -= Dealer.GetCarPrice("FO8");
InSim.Send_MST_Message("/msg ^6|^7 " + Connections[GetConnIdx(MSO.UCID)].PlayerName + " ^7bought a FO8");
break;

case "BF1":
Cars = Cars + " " + "BF1";
Connections[GetConnIdx(MSO.UCID)].Cars = Cars;
Connections[GetConnIdx(MSO.UCID)].Cash -= Dealer.GetCarPrice("BF1");
InSim.Send_MST_Message("/msg ^6|^7 " + Connections[GetConnIdx(MSO.UCID)].PlayerName + " ^7bought a BF1");
break;

}
}
else InSim.Send_MTC_MessageToConnection("^1Not enough cash. Need €" + (Dealer.GetCarPrice(StrMsg[1]) - Connections[GetConnIdx(MSO.UCID)].Cash), MSO.UCID, 0);
}
else
{
InSim.Send_MTC_MessageToConnection("^6|^7 Invalid command. Please see ^2!help^7 for a command list", MSO.UCID, 0);
}
break;

How do i put this in BUY button?



Second Question:



When i press a button, i wan't to show a TEXT space, like when we press T and we can write, how can i make that and then show like a /rcm message?


Please Helpme, thank you.
please learn how to read insim.txt and write a code on your library you using
/sarcasm
Im sorry, i readed already and i don't understand or don't find... Please Helpme, can you put here only the code to buy XFG please?
First make the buy id button work


InSim.Send_BTN_CreateButton("^1Buy", Flags.ButtonStyles.ISB_CLICK, 6, 6, 46, 111, 176, MSO.UCID, 1, false);

176 is the button id (mso.ucid is for chat command)

And add in button click the case 176

switch (BTC.ClickID)
{
#region " XFG "

[COLOR="Red"] case 176:[/COLOR]

if (Conn.Cash > 7999)
{
if (Conn.Cars.Contains("XFG") == false)
{
string Cars = Conn.Cars;
Cars = Cars + " " + "XFG";
Conn.Cars = Cars;
Conn.Cash -= Dealer.GetCarPrice("XFG");
MsgAll("^1)^7 " + Conn.PlayerName + " ^7bought a ^1XFG");
MsgPly("^1)^7 You have bought ^1(XFG) ^7in Garage", Conn.UniqueID, 1);
MsgPly("^1)^7 Price Tag: ^1€" + Dealer.GetCarPrice("XFG") + " ^7You have: ^2€" + Conn.Cash + " ^7left", Conn.UniqueID, 1);

}
}

break;
}
#endregion



FGED GREDG RDFGDR GSFDG