NX CreativeNX CreativeDocs
ScriptsFourseasons

Exports

Public exports registered by nx_fourseasons. All exports are client-side.

nx_fourseasons registers only client-side exports. Call them from any client script via exports.nx_fourseasons:<Name>().

State

exports.nx_fourseasons:GetCurrentWeatherclient

Return 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:GetCurrentTemperatureclient

Return the current temperature in Celsius.

Returns

number
local temp = exports.nx_fourseasons:GetCurrentTemperature()
if temp < 0 then
    -- Player is in sub-zero conditions
end
exports.nx_fourseasons:GetCurrentSeasonclient

Return the active season id.

Returns

'SPRING' | 'SUMMER' | 'FALL' | 'WINTER'
local season = exports.nx_fourseasons:GetCurrentSeason()
exports.nx_fourseasons:GetCurrentTimeclient

Return 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:GetCurrentStormStateclient

Return the current storm state broadcast by the server. Nil if storms are disabled.

Returns

table | nil
local storm = exports.nx_fourseasons:GetCurrentStormState()
exports.nx_fourseasons:IsPlayerIndoorsclient

Return whether the player is currently detected as indoors. Uses a cached check so it is cheap to poll.

Returns

boolean
if exports.nx_fourseasons:IsPlayerIndoors() then
    -- Skip outdoor-only FX
end

Forecast

exports.nx_fourseasons:GetForecastclient

Return the server-provided forecast. With no argument, returns the full forecast array. With a day offset, returns that single day.

Parameters

  • daysAhead?number0 for today, 1 for tomorrow, up to Config.ForecastDays - 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

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:PauseSyncclient

Pause or resume weather and time sync on this client. Pending updates are replayed on resume.

Parameters

  • pausedbooleantrue 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:RequestSyncclient

Ask the server to resend the full weather, forecast, and storm state to this client.

Returns

true
exports.nx_fourseasons:RequestSync()
exports.nx_fourseasons:IsSyncPausedclient

Return whether sync is currently paused on this client.

Returns

boolean
if exports.nx_fourseasons:IsSyncPaused() then
    exports.nx_fourseasons:PauseSync(false)
end

Road traction

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:ToggleCurrentRoadEffectsclient

Enable or disable the active weather-driven road effect on a vehicle.

Parameters

  • vehiclenumberVehicle entity handle.
  • enabledbooleantrue to apply, false to suspend.
local veh = GetVehiclePedIsIn(PlayerPedId(), false)
exports.nx_fourseasons:ToggleCurrentRoadEffects(veh, false)
exports.nx_fourseasons:SetVehicleRoadEffectclient

Override the traction reduction applied to a vehicle. Value replaces the active weather default.

Parameters

  • vehiclenumber
  • overrideReductionnumberTraction reduction in the range 0.0 (none) to 1.0 (max).
exports.nx_fourseasons:SetVehicleRoadEffect(veh, 0.5)
exports.nx_fourseasons:GetVehicleRoadEffectclient

Return the road-effect state currently tracked for a vehicle.

Parameters

  • vehiclenumber

Returns

table | nil
exports.nx_fourseasons:ResetVehicleRoadEffectclient

Clear any override set by SetVehicleRoadEffect and reapply the active weather default.

Parameters

  • vehiclenumber

Screen weather FX

Toggle the screen-space rain drops and the global weather screen overlay per-player. Preferences are kept on the client.

exports.nx_fourseasons:SetRainScreenDropsEnabledclient

Enable or disable screen-space rain drops.

Parameters

  • enabledboolean

Returns

boolean
exports.nx_fourseasons:IsRainScreenDropsEnabledclient

Returns

boolean
exports.nx_fourseasons:ToggleRainScreenDropsclient

Toggle screen-space rain drops and return the new state.

Returns

boolean
exports.nx_fourseasons:SetScreenWeatherEnabledclient

Enable or disable the full screen weather overlay (umbrella of screen-space FX driven by the active weather).

Parameters

  • enabledboolean

Returns

boolean
exports.nx_fourseasons:IsScreenWeatherEnabledclient

Returns

boolean
exports.nx_fourseasons:ToggleScreenWeatherclient

Toggle the full screen weather overlay and return the new state.

Returns

boolean