=C.R= Boomshanka
12th March 2009, 01:46
Hia guys can anyone tell me were i went wrong here, all im trying to do is make a button apper on the screen to a player and give the option to take away cash.
When playerA types the command !tow (AMOUNT) playerB, it should create a few buttons to playerB saying PlayerA wants to tow you do you except yes/no, if yes then -(AMOUNT) and gives to playerA if no then says playerB refuses your offer
here's the code
case"!tow":
if (StrMsg.Length > 2)
{
int TradeCash = 0;
try
{
TradeCash = Convert.ToInt32(StrMsg[2]);
if (TradeCash >= 0)
{
foreach (clsConnection Recipient in Connections)
{
if (Recipient.Username == Msg.Remove(0, (9 + StrMsg[1].Length + StrMsg[2].Length)))
{
if (Recipient.Cash >= TradeCash)
{
InSim.Send_BTN_CreateButton("^7" + Connections[GetConnIdx(MSO.UCID)].Username + " wants to tow you.", Flags.ButtonStyles.ISB_LEFT, 5, 100, 30, 72, 215, Recipient.UniqueID, 40, false);
InSim.Send_BTN_CreateButton("^7Price: €" + TradeCash, Flags.ButtonStyles.ISB_LEFT, 5, 100, 35, 72, 216, Recipient.UniqueID, 40, false);
InSim.Send_BTN_CreateButton("^7Do you except the tow?", Flags.ButtonStyles.ISB_LEFT, 5, 100, 40, 72, 217, Recipient.UniqueID, 40, false);
InSim.Send_BTN_CreateButton("^2Yes", Flags.ButtonStyles.ISB_C1 | Flags.ButtonStyles.ISB_DARK | Flags.ButtonStyles.ISB_CLICK, 5, 10, 47, 77, 218, Recipient.UniqueID, 40, false);
InSim.Send_BTN_CreateButton("^1No", Flags.ButtonStyles.ISB_C1 | Flags.ButtonStyles.ISB_DARK | Flags.ButtonStyles.ISB_CLICK, 5, 10, 47, 97, 219, Recipient.UniqueID, 40, false);
SenderUCID = MSO.UCID;
SentMoney = TradeCash;
}
else
{
InSim.Send_MTC_MessageToConnection("^6|^7 The recipient doesn't have enough cash!", MSO.UCID, 0);
}
}
}
}
else
{
InSim.Send_MTC_MessageToConnection("^6|^7 Invalid selection. Please try again", MSO.UCID, 0);
}
}
catch
{
InSim.Send_MTC_MessageToConnection("^6|^7 an error in code has happened please contact a admin", 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;
thanks guys
When playerA types the command !tow (AMOUNT) playerB, it should create a few buttons to playerB saying PlayerA wants to tow you do you except yes/no, if yes then -(AMOUNT) and gives to playerA if no then says playerB refuses your offer
here's the code
case"!tow":
if (StrMsg.Length > 2)
{
int TradeCash = 0;
try
{
TradeCash = Convert.ToInt32(StrMsg[2]);
if (TradeCash >= 0)
{
foreach (clsConnection Recipient in Connections)
{
if (Recipient.Username == Msg.Remove(0, (9 + StrMsg[1].Length + StrMsg[2].Length)))
{
if (Recipient.Cash >= TradeCash)
{
InSim.Send_BTN_CreateButton("^7" + Connections[GetConnIdx(MSO.UCID)].Username + " wants to tow you.", Flags.ButtonStyles.ISB_LEFT, 5, 100, 30, 72, 215, Recipient.UniqueID, 40, false);
InSim.Send_BTN_CreateButton("^7Price: €" + TradeCash, Flags.ButtonStyles.ISB_LEFT, 5, 100, 35, 72, 216, Recipient.UniqueID, 40, false);
InSim.Send_BTN_CreateButton("^7Do you except the tow?", Flags.ButtonStyles.ISB_LEFT, 5, 100, 40, 72, 217, Recipient.UniqueID, 40, false);
InSim.Send_BTN_CreateButton("^2Yes", Flags.ButtonStyles.ISB_C1 | Flags.ButtonStyles.ISB_DARK | Flags.ButtonStyles.ISB_CLICK, 5, 10, 47, 77, 218, Recipient.UniqueID, 40, false);
InSim.Send_BTN_CreateButton("^1No", Flags.ButtonStyles.ISB_C1 | Flags.ButtonStyles.ISB_DARK | Flags.ButtonStyles.ISB_CLICK, 5, 10, 47, 97, 219, Recipient.UniqueID, 40, false);
SenderUCID = MSO.UCID;
SentMoney = TradeCash;
}
else
{
InSim.Send_MTC_MessageToConnection("^6|^7 The recipient doesn't have enough cash!", MSO.UCID, 0);
}
}
}
}
else
{
InSim.Send_MTC_MessageToConnection("^6|^7 Invalid selection. Please try again", MSO.UCID, 0);
}
}
catch
{
InSim.Send_MTC_MessageToConnection("^6|^7 an error in code has happened please contact a admin", 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;
thanks guys