Exports
Public exports registered by nx_fourseasons. Client-side weather state plus the server-side Weather Platform API.
nx_fourseasons registers client exports for weather state, sync, road
traction, and screen FX, plus server exports that form the Weather
Platform API. Call client exports from any client script and server
exports from any server script, both via exports.nx_fourseasons:<Name>().
The server exports are gated by Config.API.Enabled. The weather-control
exports (RequestWeather, LockWeather, ReleaseWeather,
GetWeatherControlOwner) also require Config.API.AllowControl.
State (client)
exports.nx_fourseasons:GetCurrentWeatherclientReturn the current weather snapshot for this client.
Returns
{ weather: string, type: string, intensity: number, temperature: number, season: string, storm: table | nil }local w = exports.nx_fourseasons:GetCurrentWeather()
print(w.weather, w.intensity, w.temperature)exports.nx_fourseasons:GetCurrentTemperatureclientReturn the current temperature in Celsius.
Returns
numberlocal temp = exports.nx_fourseasons:GetCurrentTemperature()
if temp < 0 then
-- Player is in sub-zero conditions
endexports.nx_fourseasons:GetCurrentSeasonclientReturn the active season id.
Returns
'SPRING' | 'SUMMER' | 'FALL' | 'WINTER'local season = exports.nx_fourseasons:GetCurrentSeason()exports.nx_fourseasons:GetCurrentTimeclientReturn the synced clock for this client.
Returns
{ hour: number, minute: number, second: number, day: number, month: number, year: number, useRealTime: boolean, freeze: boolean }local t = exports.nx_fourseasons:GetCurrentTime()
print(('%02d:%02d'):format(t.hour, t.minute))exports.nx_fourseasons:GetCurrentStormStateclientReturn the current storm state broadcast by the server. Nil if storms are disabled.
Returns
table | nillocal storm = exports.nx_fourseasons:GetCurrentStormState()exports.nx_fourseasons:IsPlayerIndoorsclientReturn whether the player is currently detected as indoors. Uses a cached check so it is cheap to poll.
Returns
booleanif exports.nx_fourseasons:IsPlayerIndoors() then
-- Skip outdoor-only FX
endExposure (client)
exports.nx_fourseasons:GetExposureLevelclientReturn the local player's current body-temperature exposure. level is 0 (comfortable) to 3 (severe). kind is the direction of the danger, or false when comfortable. Available only while Config.Exposure.Enabled is true.
Returns
{ level: number, kind: 'cold' | 'heat' | false }local e = exports.nx_fourseasons:GetExposureLevel()
if e.level >= 2 and e.kind == 'cold' then
-- Player is in cold danger
endForecast (client)
exports.nx_fourseasons:GetForecastclientReturn the server-provided forecast. With no argument, returns the full forecast array. With a day offset, returns that single day.
Parameters
daysAhead?number— 0 for today, 1 for tomorrow, up to Config.Forecast.Days - 1.
Returns
table[] | { weather: string, type: string, temperature: number, intensity: number, day?: number, date?: any }-- Full forecast
local days = exports.nx_fourseasons:GetForecast()
-- Single day
local tomorrow = exports.nx_fourseasons:GetForecast(1)
print(tomorrow.weather, tomorrow.temperature)Sync control (client)
Pause or resume the weather and time sync for the local player. Useful for cutscenes, interiors, and minigames that run in an isolated environment.
exports.nx_fourseasons:PauseSyncclientPause or resume weather and time sync on this client. Pending updates are replayed on resume.
Parameters
pausedboolean— true to pause, false to resume.
Returns
boolean-- Freeze weather during a cutscene
exports.nx_fourseasons:PauseSync(true)
-- Resume after
exports.nx_fourseasons:PauseSync(false)exports.nx_fourseasons:RequestSyncclientAsk the server to resend the full weather, forecast, and storm state to this client.
Returns
trueexports.nx_fourseasons:RequestSync()exports.nx_fourseasons:IsSyncPausedclientReturn whether sync is currently paused on this client.
Returns
booleanif exports.nx_fourseasons:IsSyncPaused() then
exports.nx_fourseasons:PauseSync(false)
endRoad traction (client)
Override traction reductions on individual vehicles. Useful for scripted missions where a vehicle should ignore the active weather, or for adding a stronger penalty to a specific vehicle class.
exports.nx_fourseasons:ToggleCurrentRoadEffectsclientEnable or disable the active weather-driven road effect on a vehicle.
Parameters
vehiclenumber— Vehicle entity handle.enabledboolean— true to apply, false to suspend.
local veh = GetVehiclePedIsIn(PlayerPedId(), false)
exports.nx_fourseasons:ToggleCurrentRoadEffects(veh, false)exports.nx_fourseasons:SetVehicleRoadEffectclientOverride the traction reduction applied to a vehicle. Value replaces the active weather default.
Parameters
vehiclenumberoverrideReductionnumber— Traction reduction in the range 0.0 (none) to 1.0 (max).
exports.nx_fourseasons:SetVehicleRoadEffect(veh, 0.5)exports.nx_fourseasons:GetVehicleRoadEffectclientReturn the road-effect state currently tracked for a vehicle.
Parameters
vehiclenumber
Returns
table | nilexports.nx_fourseasons:ResetVehicleRoadEffectclientClear any override set by SetVehicleRoadEffect and reapply the active weather default.
Parameters
vehiclenumber
Screen weather FX (client)
Toggle the screen-space rain drops and the global weather screen overlay per-player. Preferences are kept on the client.
exports.nx_fourseasons:SetRainScreenDropsEnabledclientEnable or disable screen-space rain drops.
Parameters
enabledboolean
Returns
booleanexports.nx_fourseasons:IsRainScreenDropsEnabledclientReturns
booleanexports.nx_fourseasons:ToggleRainScreenDropsclientToggle screen-space rain drops and return the new state.
Returns
booleanexports.nx_fourseasons:SetScreenWeatherEnabledclientEnable or disable the full screen weather overlay (umbrella of screen-space FX driven by the active weather).
Parameters
enabledboolean
Returns
booleanexports.nx_fourseasons:IsScreenWeatherEnabledclientReturns
booleanexports.nx_fourseasons:ToggleScreenWeatherclientToggle the full screen weather overlay and return the new state.
Returns
booleanWeather Platform API: read (server)
Server-side reads of the authoritative weather state. Registered only
when Config.API.Enabled is true. For a push model, read the
nxWeather and nxSnowDepth GlobalState keys or listen for the on*
events on the Events page.
exports.nx_fourseasons:GetWeatherserverReturn the current weather type. Nil before the first sync.
Returns
string | nillocal weather = exports.nx_fourseasons:GetWeather()exports.nx_fourseasons:GetSeasonserverReturn the active season id.
Returns
'SPRING' | 'SUMMER' | 'FALL' | 'WINTER' | nilexports.nx_fourseasons:GetTemperatureserverReturn the current ambient temperature in Celsius.
Returns
number | nilexports.nx_fourseasons:GetWeatherStateserverReturn the merged weather state blob. This is the same shape published on GlobalState.nxWeather and passed to the onWeatherChanged event.
Returns
{ weather: string, intensity: number, season: string, temperature: number, feelsLike: number, isBlackout: boolean, snowDepth: number, storm: table, forecastStamp: any }local s = exports.nx_fourseasons:GetWeatherState()
print(s.weather, s.feelsLike, s.snowDepth, s.isBlackout)exports.nx_fourseasons:GetStormStateserverReturn the current storm state (blackout, strike, and ocean fields). Nil if storms are disabled.
Returns
table | nilexports.nx_fourseasons:GetForecastserverReturn the full server forecast array. Each entry carries a nested stats table with humidity, wind, UV, dew point, and feels-like.
Returns
table[]exports.nx_fourseasons:GetIntradaySlotsserverReturn today's intraday prediction slots (the timeline that betting settles against). Nil if the forecast is not ready.
Returns
table | nilexports.nx_fourseasons:IsBlackoutserverReturn whether a storm blackout pulse is currently active.
Returns
booleanexports.nx_fourseasons:GetSnowDepthserverReturn the current tracked snow depth in metres. Also published on GlobalState.nxSnowDepth.
Returns
numberexports.nx_fourseasons:GetPlayerExposureserverReturn a player's body-temperature exposure. Also mirrored on the player statebag nxExposure. Returns level 0 with kind false when exposure is disabled or the player has no record.
Parameters
srcnumber— Player server id.
Returns
{ level: number, kind: 'cold' | 'heat' | false }local e = exports.nx_fourseasons:GetPlayerExposure(source)
if e.level >= 2 then
-- Player is in a danger tier
endWeather control (server)
Request or lock the weather from another resource. Registered only when
both Config.API.Enabled and Config.API.AllowControl are true. Every
lock is attributed to the invoking resource and auto-reverts when that
resource stops. Higher priority wins; the applied owner is published on
GlobalState.nxWeatherLockOwner.
exports.nx_fourseasons:RequestWeatherserverRequest a weather type at default priority 10. Returns a token, or false if control is disabled or the caller is unattributable. Auto-expires after opts.durationMs when provided.
Parameters
weatherTypestring— A GTA weather type, e.g. 'THUNDER' or 'SNOW'.opts?table— { intensity?: number (0.0-1.0), durationMs?: number, priority?: number }. Intensity is snapshotted at register time; omit to reuse the current value.
Returns
string | false-- Ask for thunder for 10 minutes
local token = exports.nx_fourseasons:RequestWeather('THUNDER', { durationMs = 600000 })exports.nx_fourseasons:LockWeatherserverLock a weather type at default priority 100. A lock never auto-expires: any durationMs is ignored. Returns a token, or false if control is disabled or the caller is unattributable.
Parameters
weatherTypestringopts?table— { intensity?: number (0.0-1.0), priority?: number }.
Returns
string | falselocal token = exports.nx_fourseasons:LockWeather('EXTRASUNNY')
-- ... later
exports.nx_fourseasons:ReleaseWeather(token)exports.nx_fourseasons:ReleaseWeatherserverRelease the calling resource's lock. The token must match the lock owned by the invoking resource. A nil token releases the caller's own lock unconditionally. Returns true when a lock was released.
Parameters
token?string— The token returned by RequestWeather or LockWeather.
Returns
booleanexports.nx_fourseasons:GetWeatherControlOwnerserverReturn the resource name whose lock is currently applied, or nil when no lock is active.
Returns
string | nil