Author Topic: Key Press  (Read 752 times)

I am making a script, and I want to do the function when I press C, i've searched and I have no idea how to do this.

I am not making Keybinds.

Use a guiInputCtrl in a GUI. There is probably some more information on the forums, so search around for that. I'm not certain, but RTB might use it somewhere.

Im not using a GUI. Its for a weapon.

I want to change it from right click.
I am using
Code: [Select]
          function Armor::onTrigger(%this, %player, %slot, %val)
But I dont want it right click, I want it to be C
« Last Edit: December 12, 2011, 01:38:27 PM by Aware »

moveMap.bindCmd(keyboard,"c","","someCoolFunction();");

moveMap.bindCmd(keyboard,"c","","someCoolFunction();");

And were do I put that?

Also, I belive that is Client sided. I want it for a weapon, which is not client sided.

And were do I put that?

Also, I belive that is Client sided. I want it for a weapon, which is not client sided.

You should be more specific about things then, how did I know you were making a weapon?

Im not using a GUI. Its for a weapon.

I want to change it from right click.
I am using
Code: [Select]
          function Armor::onTrigger(%this, %player, %slot, %val)
But I dont want it right click, I want it to be C

You can't bind an arbitrary key serverside, only something which is bound to either an engine-ghosted function (image triggers) or a serverCmd (serverCmdLight and whatnot). Other keys are not handled or acknowledged by the server.

Your options are:
a) deal with it
b) clientside mod (deal with it)

if you're not having a clientsided mod to make the keybind with the serversided weapon part, i don't think this is possible
the server doesn't actualy detect keypresses, the client does and sends commands to the server based on what the key is

C = the slow down command, slow walk.
I am sure there is some serverCmd called.
because walk normally then hold down C.
Same in a vehicle.

C = the slow down command, slow walk.
I am sure there is some serverCmd called.
because walk normally then hold down C.
Same in a vehicle.

Thats what I though, any idea what it is tho?

Unfortunately, the only function called for that is walk(), which is merely the client side code that responds to the key press. I guess that, since it is related to movement, it has to respond too quickly (to feel responsive and fluid) to make a function call to the server before it takes effect.

I'm just going to keep Right click.

Sence this is impossible mere serverside.