The online racing simulator
Button Codes , Willing to help ?
Its about the electronics & furniture , Just like in LTC
The problem is that you can buy more than 10 items , because when you click the "buy" button you have to enter the amount you want to buy , and if you have already , lets say 9 items you can type 10 and have 19 items.

What I want to do is to make the buy button to buy only 1 item per click .

InSim.Send_BTN_CreateButton("^2Buy", "Maximum Buy 10 and you have " + Conn.Electronics, Flags.ButtonStyles.ISB_LIGHT | Flags.ButtonStyles.ISB_CLICK, 4, 10, 65, 100, 2, 118, Conn.UniqueID, 2, false);

I just remove the "maximum buy ... " and the number 2 from 4, 10, 65, 100, 2, 118
And change the case 118
case 118:
byte Electronics = byte.Parse(BTT.Text);
if (BTT.Text.Contains("-"))
{
MsgPly("^4)^7 Transaction Incorrect. Don't put minus on the values!", BTT.UCID);
}
else
{
if (Electronics > 10)
{
MsgPly("^4)^7 Cannot buy more than^2 10 Electronic Items!", BTT.UCID);
}
else
{
if (Conn.Electronics < 10)
{
if (Conn.Cash > 190 * Electronics)
{
Conn.Electronics += Electronics;
Conn.Cash -= 190 * Electronics;
Conn.TotalSale += Electronics;

MsgPly(Conn.PlayerName + "^7 bought some ^6Electronic^7 for ^2€" + Electronics * 190 + "^7!", BTT.UCID);
MsgPly("^1) Total Electronic: " + Conn.Electronics, BTT.UCID);

if (Conn.LastRaffle == 0)
{
MsgPly("^4)^7 Buy more items and more chances of winning in the ^1Raffle!", BTT.UCID);

if (Conn.DisplaysOpen == true && Conn.InStore == true && Conn.InGameIntrfc == 0)
{
InSim.Send_BTN_CreateButton("^7Total Item bought: ^2(" + Conn.TotalSale + ")^7 Raffle for ^1€300", Flags.ButtonStyles.ISB_LEFT, 4, 100, 73, 54, 116, Conn.UniqueID, 2, false);
InSim.Send_BTN_CreateButton("^2Raffle!", Flags.ButtonStyles.ISB_LIGHT | Flags.ButtonStyles.ISB_CLICK, 4, 10, 73, 100, 120, Conn.UniqueID, 2, false);
}
}
if (Conn.DisplaysOpen == true && Conn.InStore == true && Conn.InGameIntrfc == 0)
{
InSim.Send_BTN_CreateButton("^2Buy", "Maximum Buy 10 and you have " + Conn.Electronics, Flags.ButtonStyles.ISB_LIGHT | Flags.ButtonStyles.ISB_CLICK, 4, 10, 65, 100, 2, 118, Conn.UniqueID, 2, false);
}
}
else
{
MsgPly("^4)^1 Not Enough Cash to complete the transaction.", BTT.UCID);
}
}
else
{
MsgPly("^4)^1 Cannot carry more than 10 items!", BTT.UCID);
}
}
}

to

#region ' Electronic '
case 118:

if (Conn.Electronics < 10)
{
if (Conn.Cash > 190)
{
Conn.Electronics += 1;
Conn.Cash -= 190;
Conn.TotalSale += 1;

MsgPly(Conn.PlayerName + "^7 bought some ^6Electronic^7!", BTT.UCID);
MsgPly("^1) Total Electronic: " + Conn.Electronics, BTT.UCID);

if (Conn.LastRaffle == 0)
{
MsgPly("^4)^7 Buy more items and more chances of winning in the ^1Raffle!", BTT.UCID);

if (Conn.DisplaysOpen == true && Conn.InStore == true && Conn.InGameIntrfc == 0)
{
InSim.Send_BTN_CreateButton("^7Total Item bought: ^2(" + Conn.TotalSale + ")^7 Raffle for ^1€300", Flags.ButtonStyles.ISB_LEFT, 4, 100, 73, 54, 116, Conn.UniqueID, 2, false);
InSim.Send_BTN_CreateButton("^2Raffle!", Flags.ButtonStyles.ISB_LIGHT | Flags.ButtonStyles.ISB_CLICK, 4, 10, 73, 100, 120, Conn.UniqueID, 2, false);
}
}
if (Conn.DisplaysOpen == true && Conn.InStore == true && Conn.InGameIntrfc == 0)
{
InSim.Send_BTN_CreateButton("^2Buy", Flags.ButtonStyles.ISB_LIGHT | Flags.ButtonStyles.ISB_CLICK, 4, 10, 65, 100, 118, Conn.UniqueID, 2, false);
}
}
}
break;
#endregion

But when i click the buy button nothing seems to happen . Can someone tell me what I am doing wrong ?
I discovered that the number 2 in ButtonStyles.ISB_CLICK, 4, 10, 65, 100, 2, 118, Conn.UniqueID is the dialog that shows when i click buy but I didn't understand what exactly it represents , or if it leads to something else
I think you need to post the definition of the function of InSim.Send_BTN_CreateButton too. Otherwise only people who have some experience with this particular code can say something about it.
Quote from cargame.nl :I think you need to post the definition of the function of InSim.Send_BTN_CreateButton too. Otherwise only people who have some experience with this particular code can say something about it.

I didn't understand what you tried to say :P
I think the problem is that in the original code it is intended that when a user clicks a button he then has a dialogue asking for input. When the user sends that message lfs sends out an insim packet called "IS_BTT", 'Button type'.

Now if you go and remove the byte in the Send_BTN_CreateButton method call that tells lfs to create a button that when clicked produces an input dialogue, lfs creates a plain clickable button and when clicking a simple button like that you receive an insim packet called IS_BTC, 'Button click' in response.

TL;DR your code is never triggered because the packet receiving action is never called because you are expecting the wrong type of a packet.
Thank you very much ! you are right , it is in IS_BTT not in IS_BTC
Im gonna change it and see how it goes

EDIT: Yep it worked ...
Thank you ridiculously good at coding guy :P

FGED GREDG RDFGDR GSFDG