# Keys/Chat/Events/Exports

## Chat Commands

* You can rename or disable these chat commands in the `[configs/config.lua]`.

| **Command**     | **Description**                       |
| --------------- | ------------------------------------- |
| **`/easytime`** | The command for staff to open the UI. |

***

***

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

* These events are entirely optional and can be used as needed.

{% tabs %}
{% tab title="client-side to client-side" %}
**Open UI**

{% code title="This event opens the UI, enabling players to access its features. A permissions check ensures that only authorized players can trigger it." %}

```lua
TriggerServerEvent('cd_easytime:OpenUI')
```

{% endcode %}
{% endtab %}

{% tab title="server-side to server-side" %}
**Open UI**

{% code title="This event opens the UI, enabling players to access its features. A permissions check ensures that only authorized players can trigger it." %}

```lua
TriggerEvent('cd_easytime:OpenUI', source)
```

{% endcode %}
{% endtab %}
{% endtabs %}

***

***

## Exports <a href="#exports" id="exports"></a>

These exports are entirely optional and can be used as needed.

***

{% tabs %}
{% tab title="client-side exports" %}

### **Get All Data**

{% code title="This export retrieves detailed weather, time and settings data from cd\_easytime." overflow="wrap" lineNumbers="true" fullWidth="true" %}

```lua
local data = exports['cd_easytime']:GetAllData()

print(data.weather) -- "EXTRASUNNY" [string]
print(data.hours) -- 08 [number]
print(data.mins) -- 00 [number]
print(data.freeze) -- true/false [boolean)
print(data.dynamic) -- true/false [boolean) 
print(data.blackout) -- true/false [boolean)
print(data.tsunami) -- true/false [boolean)
print(data.timemethod) -- "realtime"/"gametime" [string]
print(data.weathermethod) -- "realweather"/"gameweather" [string]
```

{% endcode %}

Explanation

This export returns a table containing the following information:

* `data.weather`: The current in-game weather condition (string).
* `data.hours`: The current hour (number).
* `data.mins`: The current minutes (number).
* `data.freeze`: Indicates if time/weather synchronization is frozen (boolean).
* `data.dynamic`: Indicates if the weather is dynamic (boolean).
* `data.blackout`: Indicates if a blackout is in effect (boolean).
* `data.tsunami`: Indicates if a tsunami warning is active (boolean).
* `data.timemethod`: The method of tracking time, either "realtime" or "gametime" (string).
* `data.weathermethod`: The method of tracking weather, either "realweather" or "gameweather" (string).

***

### **Get Pause Sync State**

<pre class="language-lua" data-title="This export returns a boolean indicating whether time and weather synchronization is paused, such as when a player has entered a shell." data-overflow="wrap" data-line-numbers data-full-width="true"><code class="lang-lua"><strong>local pause_sync = exports['cd_easytime']:GetPauseSyncState()
</strong>
print(pause_sync) -- true/false [boolean]
</code></pre>

{% endtab %}

{% tab title="server-side exports" %}

### **Get All Data**

{% code title="This export retrieves detailed weather, time and settings data from cd\_easytime." overflow="wrap" lineNumbers="true" fullWidth="true" %}

```lua
local data = exports['cd_easytime']:GetAllData()

print(data.weather) -- "EXTRASUNNY" [string]
print(data.hours) -- 08 [number]
print(data.mins) -- 00 [number]
print(data.freeze) -- true/false [boolean)
print(data.dynamic) -- true/false [boolean) 
print(data.blackout) -- true/false [boolean)
print(data.tsunami) -- true/false [boolean)
print(data.instantweather) -- true/false [boolean)
print(data.instanttime) -- true/false [boolean)
print(data.timemethod) -- "realtime"/"gametime" [string]
print(data.weathermethod) -- "realweather"/"gameweather" [string]
```

{% endcode %}

Explanation

This export returns a table containing the following information:

* `data.weather`: The current in-game weather condition (string).
* `data.hours`: The current hour (number).
* `data.mins`: The current minutes (number).
* `data.freeze`: Indicates if time/weather synchronization is frozen (boolean).
* `data.dynamic`: Indicates if the weather is dynamic (boolean).
* `data.blackout`: Indicates if a blackout is in effect (boolean).
* `data.tsunami`: Indicates if a tsunami warning is active (boolean).
* `data.instantweather`: Indicates if the weather changes are instant (boolean).
* `data.instanttime`: Indicates if the time changes are instant (boolean).
* `data.timemethod`: The method of tracking time, either "realtime" or "gametime" (string).
* `data.weathermethod`: The method of tracking weather, either "realweather" or "gameweather" (string).

***

### **Get Real Time & Weather Data**

{% code title="The export retrieves real-time and weather data from cd\_easytime:" overflow="wrap" lineNumbers="true" fullWidth="true" %}

```lua
local data = exports['cd_easytime']:GetRealData()

print(data.hours) -- 08 [number]
print(data.mins) -- 08 [number]
print(data.gta_weather) -- "EXTRASUNNY" [string]
print(data.real_weather) -- "Clear" [string]
print(data.real_weather_description) -- "clear sky" [string]
print(data.country) -- "GB" [string]
print(data.city) -- "London" [string]
```

{% endcode %}

Explanation

This export returns a table containing the following information:

* `data.hours`: The current hour (number).
* `data.mins`: The current minutes (number).
* `data.gta_weather`: The in-game weather condition (string).
* `data.real_weather`: The actual weather condition (string).
* `data.real_weather_description`: A description of the real weather (string).
* `data.country`: The country code (string).
* `data.city`: The city name (string).
  {% endtab %}
  {% endtabs %}


---

# 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://docs.codesign.pro/free-scripts/easytime-time-and-weather-management/keys-chat-events-exports.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.
