# CFX::GET_CONVAR

- **Hash:** `0x6CCD2564`
- **Namespace:** CFX
- **Runtime name (Lua/JS):** `GetConvar`
- **Side:** shared (Cfx runtime native)
- **Name status:** official
- **Documentation:** described with examples
- **URL:** https://natives.borderlinerp.com/natives/CFX/GET_CONVAR

## Signature

```c
char* GET_CONVAR(char* varName, char* default_);
```

## Parameters

- `varName` (`char*`) — The console variable to look up.
- `default_` (`char*`) — The default value to set if none is found.

## Returns

`char*` — Returns the convar value if it can be found, otherwise it returns the assigned `default`.

## Description

*Source: Cfx.re native reference*

Can be used to get a console variable of type `char*`, for example a string.

## Usage

### Lua

```lua
local retval = GetConvar(varName, default_)

-- always available, by hash
local retval = Citizen.InvokeNative(0x6ccd2564, varName, default_, Citizen.ResultAsString())
```

### JavaScript

```js
const retval = GetConvar(varName, default_);

// by hash
const retval = Citizen.invokeNative('0x6ccd2564', varName, default_, Citizen.returnResultAnyway(), Citizen.resultAsString());
```

### C#

```csharp
string retval = Function.Call<string>((Hash)0x6ccd2564, varName, default_);
```

## Examples

*Source: Cfx.re native reference*

```lua
if GetConvar('voice_useNativeAudio', 'false') == 'true' then
    Citizen.Trace('Native Audio is enabled.')
end
```

*Sources: Cfx.re native reference.*
