Issues binding a key through Lua

I want to change the IN_ZOOM to a KEY_V (Input Enum) I’ve been looking through the wiki and,well, google but it seems like I’m completely overwhelmed and clueless. Could anyone point me in the right direction to rebind this TTT traitor chat to KEY_V?

Here are the main pieces of code:

cl_keys.lua:


function GM:KeyPress(ply, key)
   if not IsFirstTimePredicted() then return end
   if not IsValid(ply) or ply != LocalPlayer() then return end

   if key == IN_USE and ply:IsActiveTraitor() then
      timer.Simple(0.05, function() RunConsoleCommand("+voicerecord") end)
   end
end

cl_voice.lua:



if client == ply then
      if client:IsActiveTraitor() then
         if (not client:KeyDown(IN_USE)) and (not client:KeyDownLast(IN_USE)) then
            client.traitor_gvoice = true
            RunConsoleCommand("tvog", "1")
         else
            client.traitor_gvoice = false
            RunConsoleCommand("tvog", "0")
         end
      end


numpad lib has some useful functions that have callbacks for when a key is pressed. (exactly like hooks).
Sorry for the bad example and lack of explanation, I will write that in a second.



function MODULE.Functions.AddBind( key , identifier , callback , ply )


    if not key or not identifier or not callback then 
        return
    end
    
    for k,v in pairs( MODULE._Data.ValidKeys ) do
    
        if v == key then
            break
        end
        
        Error( 'Key is not valid' )
        return
    
    end
    
    if MODULE.Functions.GetBinds( key )[identifier] then
        Error( 'Identifier is not valid' )
        return
    end
    
    MODULE.Functions.GetBinds( key )[key .. identifier .. ply] = callback
    numpad.Register( key .. identifier .. ply , callback )
    numpad.OnDown( ply , key , key .. identifier .. ply )


end


function MODULE.Functions.RemoveBind( key , identifier , ply )


    for k,v in pairs( Ananke.binds.GetBinds( key ) ) do 
        if k == ( key .. identifier .. ply ) then
            v = nil
        end
    end
    
    numpad.Remove( key .. identifier .. ply )
     
end


Thanks for the help dingusnin but I have to confess that I don’t quite understand that bit of code :frowning: