Author Topic: 'Key Bind' a command server-wide?  (Read 1689 times)

Hey.

For my Dogfight, I want to have a thing where you can say team messages, like CS:S or TF2.

I want it like I can hit 1 and it team chats 'Cover Me', but I don't know how to do that server-wide.

Or, I would want it like CS:S, and hit like Z, then a number.

So if you could help, that'd be great. :).

This is why we use packages.

This is why we use packages.
Alright, but what function would I use to get it so if I push 1, it says the team message.

Not possible server-sided.

Not possible server-sided.

Well, if it's going to be in a minigame with no building, he could force 10 bricks into their cart and package the function for selecting a brick. I had done this with a couple scripts, so it's entirely possible.

Well, if it's going to be in a minigame with no building, he could force 10 bricks into their cart and package the function for selecting a brick. I had done this with a couple scripts, so it's entirely possible.
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.

Well, if it's going to be in a minigame with no building, he could force 10 bricks into their cart and package the function for selecting a brick. I had done this with a couple scripts, so it's entirely possible.
Selecting bricks is server-sided? I never really thought of that.

Also, you can do it with the following, Or really any serverCmd.

Code: [Select]
package Lawl
{
function serverCmdLight(%client)
{
echo("Ok");
Parent::serverCmdLight(%client);
}
};
activatePackage(Lawl);

Interesting... so you could make almost ANYTHING serversided... Useful!

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.

Code: [Select]
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);

Alright, I tried it.

It works, except when you do it (hit 1, 3, whatever number) it brings up the slot selector thing.

Could we make it so that doesn't come up, somehow?

Alright, I tried it.

It works, except when you do it (hit 1, 3, whatever number) it brings up the slot selector thing.

Could we make it so that doesn't come up, somehow?

Oh, right. That part's client-sided, so no, the server can't really control that. I have the option set to always show the HUD elements, so I never noticed that when I used it.

Alright, Thanks.

One last thing pretty much, I'm guessing it is, but is it possible to make a client sided GUI where you hit a button and it pops up (like normal) then you push a button and it says that message (It will say the different messages and what button on the GUI)?

Thanks.

Alright, Thanks.

One last thing pretty much, I'm guessing it is, but is it possible to make a client sided GUI where you hit a button and it pops up (like normal) then you push a button and it says that message (It will say the different messages and what button on the GUI)?

Thanks.

I don't see why not, you could enable some action map when the gui wakes and disable it when it sleeps, or just add a test in whatever function gets called when you press those buttons to see of the gui is awake or not.

I think the first option would be better, that way the buttons could be bound to other things while the gui is not open.

That's just a guess, and I'm quite tired at the moment, so I could be wrong.

I don't see why not, you could enable some action map when the gui wakes and disable it when it sleeps, or just add a test in whatever function gets called when you press those buttons to see of the gui is awake or not.

I think the first option would be better, that way the buttons could be bound to other things while the gui is not open.

That's just a guess, and I'm quite tired at the moment, so I could be wrong.
Alright. I have no idea how to code GUI's and stuff, I hope I could get someone to make something like it so I could edit it.