# CFX::SET_TIMECYCLE_MODIFIER_VAR

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

## Signature

```c
void SET_TIMECYCLE_MODIFIER_VAR(char* modifierName, char* varName, float value1, float value2);
```

## Parameters

- `modifierName` (`char*`) — The name of timecycle modifier.
- `varName` (`char*`) — The name of timecycle variable.
- `value1` (`float`) — The first value of variable.
- `value2` (`float`) — The second value of variable.

## Returns

`void`

## Usage

### Lua

```lua
SetTimecycleModifierVar(modifierName, varName, value1, value2)

-- always available, by hash
Citizen.InvokeNative(0x6e0a422b, modifierName, varName, value1, value2)
```

### JavaScript

```js
SetTimecycleModifierVar(modifierName, varName, value1, value2);

// by hash
Citizen.invokeNative('0x6e0a422b', modifierName, varName, value1 + 0.0000001, value2 + 0.0000001);
```

### C#

```csharp
Function.Call((Hash)0x6e0a422b, modifierName, varName, value1, value2);
```

- Float parameters: Lua integers (`10`, or whole numbers decoded from NUI/JSON) are sent as ints and read as garbage. Write `10.0` or `value + 0.0`. The generated JS wrappers add `0.0000001` to non-zero floats for the same reason.

## Examples

*Source: Cfx.re native reference*

```lua
local modifierName = "superDARK"
local varName = "postfx_noise"

if DoesTimecycleModifierHasVar(modifierName, varName) then
  local success, value1, value2 = GetTimecycleModifierVar(modifierName, varName)

  if success then
    print(string.format("[%s] removed var %s with values: %f %f", modifierName, varName, value1, value2))
    RemoveTimecycleModifierVar(modifierName, varName)
  end
else
    SetTimecycleModifierVar(modifierName, varName, 1.0, 1.0)
    print(string.format("[%s] created var %s", modifierName, varName))
end
```

## See also

- [CFX::GET_TIMECYCLE_MODIFIER_VAR](https://natives.borderlinerp.com/natives/CFX/GET_TIMECYCLE_MODIFIER_VAR.md)
- [CFX::REMOVE_TIMECYCLE_MODIFIER_VAR](https://natives.borderlinerp.com/natives/CFX/REMOVE_TIMECYCLE_MODIFIER_VAR.md)

*Sources: Cfx.re native reference.*
