hi guys i have a new problem i've made a few menus on my server for shops and for some reason when any player other than the first player that joined clicks one of the buttons they do nothing, where as the first player that joins has all the buttons working perfectly.
my code is :
the code is longer i just couldnt fit it all in
i dont see anything that i could have done wrong here, but like i said it only works for the first player that joined the server any ideas?
my code is :
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);
}
}
the code is longer i just couldnt fit it all in
i dont see anything that i could have done wrong here, but like i said it only works for the first player that joined the server any ideas?