Skip to main content
px_climate exposes a small set of exports for retrieving the current synced environment. These exports are available on both server and client, making it easy to integrate weather and time into any resource.

Export Reference

ExportReturnsDescription
getWeatherTypestringReturns the current GTA weather type.
getLATimenumber, number, numberReturns Los Angeles time as hour, minute, second.
getLATimeFormattedstringReturns formatted 12-hour time (e.g. 3:45PM).
getWeatherAndTimetableReturns combined weather and time data.

Usage

Use the exports object from px_climate to access the current environment state:
local climate = exports.px_climate

local weather = climate:getWeatherType()
local hour, minute, second = climate:getLATime()
local formatted = climate:getLATimeFormatted()

-- Retrieve everything at once
local data = exports.px_climate:getWeatherAndTime()

-- data.weather   -> EXTRASUNNY, RAIN, etc
-- data.hour      -> 0-23
-- data.minute
-- data.second
-- data.formatted -> 12-hour formatted string

-- Returned structure
-- weather = "CLEAR"
-- hour = 14
-- minute = 32
-- second = 10
-- formatted = "2:32PM"

-- Notes
-- All values are synced from the server using GlobalState.
-- Exports always return the latest known state.
-- Safe to call at any time, including during startup fallback.
-- No dependency on client-side state.

-- Events

-- Request
TriggerServerEvent('px_climate:requestWeatherAndTime')

-- Response
RegisterNetEvent('px_climate:responseWeatherAndTime', function(data)
    print(data.weather, data.formatted)
end)