> For the complete documentation index, see [llms.txt](https://codestudio5m.gitbook.io/codestudio/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://codestudio5m.gitbook.io/codestudio/our-scripts/weather-management/setup.md).

# Setup

## Detailed Config is Provided with the script with detailed information:

<mark style="background-color:red;">**Supports: Every Server**</mark>

<figure><img src="/files/9F6ytNuAiDZm9bm9iUNp" alt=""><figcaption></figcaption></figure>

* Integrated sync of events and exports from `qb-weathersync`, `cd_easytime`, and `vSync`. (**Note**: You only need our script running, no other weather script is required)

## Exports

**setWeather \[type]**

Switch to a specified weather type from CodeStudio.WeatherTypes

```lua
exports["cs_weather"]:setWeather("snow")
```

**setTime \[hour] (minute)**

Sets sun position based on time to specified

```lua
exports["cs_weather"]:setTime(9, 20) -- 9:1=20 AM
```

setTimeFreeze \[toggle]

Freeze or Unfreeze Time

```lua
exports["cs_weather"]:setTimeFreeze(true) -- true/false
```

**setBlackout (true|false)**

Sets or toggles blackout state

```lua
exports["cs_weather"]:setBlackout()
```

\
**setDynamicWeather (true|false)**

Sets or toggles dynamic weather state

```lua
exports["cs_weather"]:setDynamicWeather(); -- Toggle
```

**getBlackoutState**

Returns if the blackout is enabled or disabled

```lua
exports["cs_weather"]:getBlackoutState();
```

**getTimeFreezeState**

Returns if time progression is enabled or disabled

```lua
exports["cs_weather"]:getTimeFreezeState();
```

**getWeatherState**

Returns the current weather type

```lua
exports["cs_weather"]:getWeatherState();
```

**getDynamicWeather**

Returns if time progression is enabled or disabled

```lua
exports["cs_weather"]:getDynamicWeather();
```

getTime

Returns current server time

```lua
exports["cs_weather"]:getTime();
```

### Events <a href="#events" id="events"></a>

***All of these examples are triggered CLIENT side!***

**EnableSync**

```lua
TriggerEvent('cs:weather:client:EnableSync')
```

**DisableSync**

```lua
TriggerEvent("cs:weather:client:DisableSync")
```

**setTime**

```lua
TriggerServerEvent("cs:weather:server:setTime", hour, minute)
```

**setWeather**

```lua
TriggerServerEvent("cs:weather:server:setWeather", TYPE)
```

## Commands

/weather\_panel - Toggle Dashboard

/freezeweather - Freeze weather

/weather \[type] - Set weather

/freezetime \[1/0] - Toggle Freeze Time

/blackout - Toggle blackout

/morning - Set time to 9am

/noon - Set time to 12pm

/evening - Set time to 6pm

/night - Set time to 11pm

/time \[hour] \[minute] - Set time to whatever you want

### *<mark style="background-color:red;">**Additional detailed guidance can be found in the config itself. If you need further assistance, please feel free to contact us on Discord.**</mark>*
