# Weather Sync

<https://randolio.tebex.io/package/6562579>

<figure><img src="https://3824174005-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAe388H3zYCl3SCyQNPaU%2Fuploads%2FIkbhRwUASHqEv8I4kkPC%2Fweather.png?alt=media&#x26;token=3934da93-015c-4f9d-b3c0-28dbab72d997" alt=""><figcaption></figcaption></figure>

## YOU MAY NEED TO manually ensure randol\_weather in your server.cfg before other scripts otherwise you may error out.

## Client

```lua
-- Can be used across client scripts to toggle weather sync.
exports.randol_weather:ToggleSync(boolean) -- true or false

-- Gets triggered when time changes. Good as a listener to handle third party resources.
AddEventHandler('randol_weather:client:onTimeChange', function(data)
    -- print(data.hours, data.minutes)
end)
```

## Server

<pre class="language-lua"><code class="lang-lua"><strong>-- List of all global states used to manage sync.
</strong>GlobalState.CURRENT_WEATHER
GlobalState.CURRENT_TIME (GlobalState.CURRENT_TIME.hours, GlobalState.CURRENT_TIME.minutes)
GlobalState.BLACKOUT_STATE,
GlobalState.WEATHER_FROZEN,
GlobalState.TIME_FROZEN

-- Some exports if you're unfamiliar with global states.
exports.randol_weather:SetWeather(weather) -- string 'THUNDER' as an example
exports.randol_weather:SetTime(hours, minutes) -- number: 12, 15
exports.randol_weather:ToggleBlackout(boolean) -- boolean: true or false

-- Gets triggered when time changes. Used as a listener in third party resources.
AddEventHandler('randol_weather:server:onTimeChange', function(data)
    -- print(data.hours, data.minutes)
end)
</code></pre>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://randolio.gitbook.io/docs/paid-scripts/weather-sync.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
