Multiple binds for command to excecute

I have made a script for opening the trunk and the hood, I used RegisterKeyMapping:

RegisterKeyMapping(‘+openhood’, ‘Open the hood of a vehicle’, ‘keyboard’, ‘PAGEUP’)
RegisterKeyMapping(‘+opentrunk’, ‘Open the trunk of a vehicle’, ‘keyboard’, ‘PAGEDOWN’)

Now I want to make keybinds for the windows and was wondering how to make a command that executes only when 2 binds are pressed ( for example SHIFT + 1). I know that is possible using threads, but they take a toll on the cpu, is there anyway I could achieve this using KeyMapping or any other method ?

Register another key mapping for the shift key and set a variable to true/false and check that variable in your “real” key mappings.

local shiftPressed = false
RegisterKeyMapping("+shiftmodifier", "Left Shift Modifier", "KEYBOARD", "LSHIFT")
RegisterCommand("+shiftmodifier", function(src, args, raw)
    shiftPressed = true
end, false)
RegisterCommand("-shiftmodifier", function(src, args, raw)
    shiftPressed = false
end, false)

RegisterKeyMapping("+openhood", "Open the hood of a vehicle", "KEYBOARD", "PAGEUP")
RegisterCommand("+openhood", function(src, args, raw)
    -- early return when modifier key was not pressed
    if (not shiftPressed) then return end

    -- continue your code here
end, false)