Smal lua help

Hi all,

at christmas i got a new Keyboard the “saitek cyborg Keyboard” and the button bnding is a litle bit shitty :smiley:
and i need to make a lua script wich can help me but im rly rly bad in lua : (
i want to make a script wich creates much convars like “C1” and “C2” and when the right ones of them are true then a command will be run like uuum… “BailOut” or something like this so…


p.s. Sorry for my english im german :smiley:

I don’t think you can bind custom keys like that in Lua without module.

i mean uuum… my keyboard can press much buttons as one and so the script have to create around 3 commands wich will be binded on some buttons like A J and O and if A&O are true runconcommand(“BailOut”). do you know what i mean ?



Ah, let me try something like that with my G15.

no! its no G15 !!! its Saitek Cyborg please dont forget that and uuum… on is a config already uploaded

Yes, but it’s the same idea.


I don’t think you can do this. Running input.IsKeyDown in a think hook is not fast enough for it.

i think you dot understand me… like +C1 commands ind if both are tru the command will be run


and this is the config / script from for the G15

I think he totally understands you.

:frowning: is there really no way to do this ? :frowning:

I once coded a custom-binding system but it can’t be “ripped apart” like that for your usage. I can by now tell you it’s idea
[lua]local function KeyDown_Hook()
local p = LocalPlayer();
if(input.IsKeyDown(KEY_A) and input.IsKeyDown(KEY_B) then
– Do something

The think checks, whether your keys are down or not and then “runs” something in the if-statement (and runs it every frame as long as your keys are pressed - So make sure, you add some code so it won’t run 500 times if you hold down the key for 3 seconds). So far, it is responsible above when you press the key A and B. A complete list for the KEY_* can be found here

Has to be ran clientside.

wow nice i dont think that i get an answer so fast :smiley: TY


i´ll try that

Could use the KeyPress hook…

That is called for each key pressed, you couldn’t use that to check for multiple key presses.

Yep, It can be checked if 2 keys are down, Just takes a little tweaking :3:

The KeyPress hook is only called for IN_ keys, like your mouse buttons and E.

You could do something like this:

Serverside with IN_ keys:
[lua]local oldKeyDown = _R.Player.KeyDown;
function _R.Player:KeyDown(keys)
if type(keys) == “number” then return oldKeyDown(self, keys); end
for k, v in ipairs(keys) do
if !oldKeyDown(self, v) then
return false;
return true;

Clientside with KEY_ keys:
[lua]local oldIsKeyDown = input.IsKeyDown;
function input.IsKeyDown(keys)
if type(keys) == “number” then return oldIsKeyDown(keys); end
for k, v in ipairs(keys) do
if !oldIsKeyDown(v) then
return false;
return true;


Then you can call these functions with tables of keys to check if they are all down

Wait, you want to bind your macro keys to Lua functions?

yes I want because now i got extra keys and i cant use them and that is fucking shitty :smiley:

What would you use them for?

You also have all the letters on your keyboard that arn’t binded, why don’t you just use those.