> ## Documentation Index
> Fetch the complete documentation index at: https://docs.spurdoverse.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Convars

> Read console variable values from the engine.

```ts theme={null}
import Convars from "@native/convars";
```

The `Convars` module reads console variable (cvar) values from the engine.

***

## Methods

### Convars.get

<br />

```ts theme={null}
Convars.get(name: string): boolean | number | string | Color | Vector
```

Returns the convar value with its natural type.

<ParamField path="name" type="string" required>
  Console variable name.
</ParamField>

```ts theme={null}
const sens = Convars.get("sensitivity");    // number
const cheats = Convars.get("sv_cheats");    // boolean
```

***

### Convars.getFloat

<br />

```ts theme={null}
Convars.getFloat(name: string): number
```

Returns the convar value as a float.

<ParamField path="name" type="string" required>
  Console variable name.
</ParamField>

```ts theme={null}
const sens = Convars.getFloat("sensitivity"); // 2.5
const vol = Convars.getFloat("volume");       // 0.8
```

***

### Convars.getInt

<br />

```ts theme={null}
Convars.getInt(name: string): number
```

Returns the convar value as an integer.

<ParamField path="name" type="string" required>
  Console variable name.
</ParamField>

```ts theme={null}
const alpha = Convars.getInt("cl_crosshairalpha"); // 200
const team = Convars.getInt("mp_autoteambalance"); // 1
```

***

### Convars.getBool

<br />

```ts theme={null}
Convars.getBool(name: string): boolean
```

Returns the convar value as a boolean.

<ParamField path="name" type="string" required>
  Console variable name.
</ParamField>

```ts theme={null}
if (Convars.getBool("sv_cheats")) {
    console.log("Cheats enabled");
}
```

***

### Convars.getString

<br />

```ts theme={null}
Convars.getString(name: string): string
```

Returns the convar value as a string.

<ParamField path="name" type="string" required>
  Console variable name.
</ParamField>

```ts theme={null}
const mapGroup = Convars.getString("game_type");
const hostname = Convars.getString("hostname");
```
