Adding a command instead of hotkey for menu

I am using this menu here [Release] Vehicle Extra Menu

I am trying to figure out how to change it from using the keybind to using /extras to open the menu.

I tried registering a command but I just can’t get it working correctly.

Here is the client.lua
(there is no server.lua but I created one for testing while trying to get it working)

		if IsControlJustPressed(1, 168) or IsDisabledControlJustPressed(1, 168) then
			if not menu then
				if IsPedInAnyVehicle(GetPlayerPed(-1), 0) and (GetPedInVehicleSeat(GetVehiclePedIsIn(GetPlayerPed(-1), 0), -1) == GetPlayerPed(-1)) then
					menu = true
				else
					drawNotification("~r~You have to be the driver of a vehicle to use this Menu.")
				end
			elseif menu then
				menu = false
			end
		end
		
		if IsDisabledControlJustPressed(1, 177) then
			if menu then
				menu = false
				bool = true
				ExtraCount = 0
			elseif trailer then
				trailer = false
				bool = true
				ExtraCount = 0
				menu = true
			end
		elseif not (IsPedInAnyVehicle(GetPlayerPed(-1), 0) and (GetPedInVehicleSeat(GetVehiclePedIsIn(GetPlayerPed(-1), 0), -1) == GetPlayerPed(-1))) then
			menu = false
			trailer = false
			bool = true
			ExtraCount = 0
		end

		if menu then
			TriggerEvent("VEM:Title", "~y~~bold~Vehicle Extra Menu")

Declare boolean variable and register a command at the top of your client.lua file like this. This will set the variable to true once the command /extras is typed in.

local extrasCmd = false;
RegisterCommand("extras", function(source, args, rawCommand)
	if not extrasCmd then
		extrasCmd = true
	end
end, false)

Then just change the initial menu open code to also allow that variable = true to open the menu and once it’s open set that variable back to false again like this

		if IsControlJustPressed(1, 168) or IsDisabledControlJustPressed(1, 168) or extrasCmd then
			if not menu then
				if IsPedInAnyVehicle(GetPlayerPed(-1), 0) and (GetPedInVehicleSeat(GetVehiclePedIsIn(GetPlayerPed(-1), 0), -1) == GetPlayerPed(-1)) then
					menu = true
				else
					drawNotification("~r~You have to be the driver of a vehicle to use this Menu.")
				end
			elseif menu then
				menu = false
			end
			extrasCmd = false
		end