# CFX::APPLY_WEATHER_CYCLES

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

## Signature

```c
BOOL APPLY_WEATHER_CYCLES(int numEntries, int msPerCycle);
```

## Parameters

- `numEntries` (`int`) — The number of cycle entries. Must be between 1 and 256
- `msPerCycle` (`int`) — The duration in milliseconds of each cycle. Must be between 1000 and 86400000 (24 hours)

## Returns

`BOOL` — Returns true if all parameters were valid, otherwise false.

## Usage

### Lua

```lua
local retval = ApplyWeatherCycles(numEntries, msPerCycle)

-- always available, by hash
local retval = Citizen.InvokeNative(0x3422291c, numEntries, msPerCycle, Citizen.ReturnResultAnyway())
```

### JavaScript

```js
const retval = ApplyWeatherCycles(numEntries, msPerCycle);

// by hash
const retval = Citizen.invokeNative('0x3422291c', numEntries, msPerCycle, Citizen.returnResultAnyway());
```

### C#

```csharp
bool retval = Function.Call<bool>((Hash)0x3422291c, numEntries, msPerCycle);
```

## Examples

*Source: Cfx.re native reference*

```lua
-- Cycle between XMAS weather for 30 seconds (3 * 10000 milliseconds), and SMOG weather for 20 seconds (2 * 10000 milliseconds)
local success = SetWeatherCycleEntry(0, "XMAS", 3) and
                SetWeatherCycleEntry(1, "SMOG", 2) and
                ApplyWeatherCycles(2, 10000)
```

*Sources: Cfx.re native reference.*
