Jump to content
BlacKnightBK

how to create a new keybind

Recommended Posts

Hello guys, I would like to know how to create new keybinds without using mods.

 

E.g when player presses shift+h his weapon gets holstered.

 

Sorry if the answer is already available somewhere I am busy with so many other stuff I was not bothered googling it with it not being a high priority issue for me.
 

Cheers

Share this post


Link to post
Share on other sites

initPlayerLocal:

waitUntil {!isNull (findDisplay 46)};
(findDisplay 46) displayAddEventHandler
[	"KeyDown",
	{	params ["_disp","_code","_shift","_strg","_alt"];
		private _return = false;
		if (_code isEqualTo 35 && _shift) then	
		{	player action ["SwitchWeapon", player, player, 100];
			_return = true;
		};
     	_return
	}
];

untested

Share this post


Link to post
Share on other sites

to get the _code place  -> hint str (_this); <-   before params...

Share this post


Link to post
Share on other sites

There is CBA_fnc_addKeybind command, maybe it's what you are looking for. Use the function viewer in editor to read how to use it.

 

there's also more keybinding commands found in the functions viewer under "Keybinding"

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×