That's kinda what I thought would work, but I don't know how to do it.
Do you think you could show me how to do one, and I can do the rest? Thanks.
This is untested, and I'm overtired at the moment, so I could've missed something.Also, do note that you will not be able to build with the script enabled, but you could make some amendments to allow this. I assume you'll have the build ready anyway, with a default minigame set up.
Building must be enabled in the minigame for this to work as is.
1) When you connect, it will fill your cart with 1x1 bricks. The client needs a brick in the slot to allow the slot to be selected, and in turn, allow the server-sided command to be called.
2) If they try to buy bricks on their own, it will not let them. Since the client will empty the cart, you need to tell them to put the ten 1x1 bricks back in.
3) When they use a slot, it will send a message based on the slot they chose. I used a basic switch statement to control this.
4) InstantUseBrick is a server command that is called when you right-click a brick. Since we'll have building enabled, this has to be disabled or they could actually plant bricks.
package VoiceCommands
{
function GameConnection::onClientEnterGame(%this)
{
Parent::onClientEnterGame(%this);
serverCmdBuyBrick(%this);
}
function serverCmdBuyBrick(%cl)
{
for(%i = 0; %i < 10; %i++)
{
Parent::serverCmdBuyBrick(%cl,%i,201);
messageClient(%cl,'MsgSetInvData',"",%i,201);
}
}
function serverCmdUseInventory(%cl,%slot)
{
switch(%slot)
{
case 0: %msg = "Incoming! Get ready!";
case 1: %msg = "Cover me, I've got the flag!";
case 2: %msg = "Help me defend this point!";
}
if(%msg !$= "")
serverCmdMessageSent(%cl,%msg);
}
function serverCmdInstantUseBrick() {}
};
activatePackage(VoiceCommands);