hi
i'm develop a Buy and Sell commands but i have a lil problem
i want that a user can buy max 20(foods)
but if he bought 15 already and he bought a another 15(foods) then he will exceed the limit of 20 foods. but the max is 20
could u guys help me pls
thx
see the code below
i'm develop a Buy and Sell commands but i have a lil problem
i want that a user can buy max 20(foods)
but if he bought 15 already and he bought a another 15(foods) then he will exceed the limit of 20 foods. but the max is 20
could u guys help me pls
thx
see the code below
case "!buyfood":
if (Connections[GetConnIdx(MSO.UCID)].Instore == 1)
{
int foods = int.Parse(StrMsg[1]);
if (foods > 20 || Connections[GetConnIdx(MSO.UCID)].foods >= 20)
{
InSim.Send_MTC_MessageToConnection("^1Wrong amount", MSO.UCID, 0);
}
else
{
Connections[GetConnIdx(MSO.UCID)].foods += foods;
Connections[GetConnIdx(MSO.UCID)].Cash -= foods * Connections[GetConnIdx(MSO.UCID)].Food;
InSim.Send_MTC_MessageToConnection("^7U bought " + foods + " Foods", MSO.UCID, 0);
InSim.Send_MTC_MessageToConnection("^7U paid " + foods * Connections[GetConnIdx(MSO.UCID)].Food, MSO.UCID, 0);
}
}
break;