HZ Scripts

Configuration

All configuration is done in the config/ folder. Changes made via the admin panel are saved to the database and take priority over file values.

FilePurpose
config/config.luaMain configuration
config/seasons.luaSeason presets and cycle
config/zones.luaDefault weather zones
config/weather_types.luaWeather type properties
config/locales/en.luaEnglish translations
config/locales/fr.luaFrench translations

General

Config.Debug = false
Config.Locale = 'en'
Config.AdminPermission = 'hz_weather.admin'
Config.TemperatureUnit = 'C'
ParameterTypeDefaultDescription
DebugbooleanfalseDetailed logs in server/client console
Localestring'en'Language file from config/locales/
AdminPermissionstring'hz_weather.admin'ACE permission for admin access
TemperatureUnitstring'C'Display unit: 'C' (Celsius) or 'F' (Fahrenheit)

Weather

Config.DefaultWeather = 'CLEAR'
Config.DynamicWeather = true
Config.WeatherChangeInterval = 600
Config.TransitionDuration = 25.0
Config.ZoneTransitionDistance = 800.0
Config.ZoneCheckInterval = 500
Config.PredictiveLoadDistance = 500.0
Config.FreezeWeather = false
ParameterTypeDefaultDescription
DefaultWeatherstring'CLEAR'Weather type on first start (before DB load)
DynamicWeatherbooleantrueAutomatic weather changes over time
WeatherChangeIntervalnumber600Seconds between automatic weather changes
TransitionDurationnumber25.0Seconds for each transition step (GTA native fade)
ZoneTransitionDistancenumber800.0Meters to complete a full zone weather transition
ZoneCheckIntervalnumber500Milliseconds between zone boundary checks (client)
PredictiveLoadDistancenumber500.0Meters before zone border to start preloading weather
FreezeWeatherbooleanfalseFreeze weather at startup (no automatic changes)
Available weather types: EXTRASUNNY, CLEAR, CLOUDS, OVERCAST, RAIN, THUNDER, CLEARING, FOGGY, SMOG, SNOW, SNOWLIGHT, BLIZZARD, XMAS

Weather Influence (Zone Blending)

Config.WeatherInfluence = {
    enabled = true,
    maxDiff = 2,
}
ParameterTypeDefaultDescription
enabledbooleantrueNeighboring zones blend their weather naturally
maxDiffnumber2Max steps on the weather scale between neighbors
Weather scale: EXTRASUNNY(1) > CLEAR(2) > CLOUDS(3) > OVERCAST(4) > RAIN(5) > THUNDER(6). With maxDiff = 2, if one zone has THUNDER, the neighbor can be at most OVERCAST.

Time

Config.TimeScale = 1.0
Config.FreezeTime = false
Config.StartTime = { hour = 8, minute = 0 }
Config.NightSpeedMultiplier = 2.0
Config.UseNightSpeedMultiplier = false
Config.SyncInterval = 60
Config.UseRealTime = false
Config.NightTime = { beginning = 22, ending = 6 }
ParameterTypeDefaultDescription
TimeScalenumber1.0Time speed. 1.0 = real-time, 2.0 = 2x faster
FreezeTimebooleanfalseFreeze time at startup
StartTimetable{hour=8, minute=0}Time on first start (then loaded from DB)
NightSpeedMultipliernumber2.0Night passes X times faster than day
UseNightSpeedMultiplierbooleanfalseEnable faster nights
SyncIntervalnumber60Seconds between full time syncs to all clients
UseRealTimebooleanfalseUse server's real clock instead of game time
NightTimetable{beginning=22, ending=6}Hours defining the night period

Temperature

Config.TemperatureEnabled = true
Config.TemperatureMode = 'hybrid'
Config.TemperatureUpdateInterval = 5
Config.TemperatureRandomVariation = 2.0
Config.HeatPeakHour = 14
ParameterTypeDefaultDescription
TemperatureEnabledbooleantrueEnable temperature system
TemperatureModestring'hybrid'Calculation mode (see below)
TemperatureUpdateIntervalnumber5Seconds between recalculations
TemperatureRandomVariationnumber2.0Random variation in degrees
HeatPeakHournumber14Hour of peak temperature (24h format)
Temperature modes:
  • 'zone' — Based only on zone min/max settings
  • 'weather' — Based only on the current weather type modifier
  • 'hybrid' — Combines zone base + weather modifier + time-of-day curve (recommended)

Hour Modifiers (Day/Night Curve)

Config.TemperatureHourModifiers = {
    [0]  = -8,    -- Midnight
    [4]  = -10,   -- 4 AM (coldest)
    [8]  = -3,    -- 8 AM (sunrise)
    [12] = 3,     -- Noon
    [14] = 5,     -- 2 PM (peak)
    [20] = 1      -- 8 PM (evening)
}

Values are added to the base temperature. Hours in between are interpolated automatically.


Seasons

Config.SeasonsEnabled = true
Config.SeasonAutoStart = true
Config.DefaultSeasonPreset = 'summer'
Config.SyncRealWorldSeasons = false
ParameterTypeDefaultDescription
SeasonsEnabledbooleantrueEnable season system
SeasonAutoStartbooleantrueStart season cycle automatically
DefaultSeasonPresetstring'summer'Default season on first start
SyncRealWorldSeasonsbooleanfalseMap real calendar months to seasons
Full season presets are configured in config/seasons.lua — see Season Presets below.

Gameplay Effects

All effects are configured under Config.Effects:

Vehicle Traction

vehicleTraction = {
    enabled = false,
    rainModifier = 0.7,
    snowModifier = 0.5,
    blizzardModifier = 0.3,
}
ParameterTypeDefaultDescription
enabledbooleanfalseEnable traction modification
rainModifiernumber0.770% grip in rain
snowModifiernumber0.550% grip in snow
blizzardModifiernumber0.330% grip in blizzard

Reduced Visibility

reducedVisibility = {
    enabled = true,
    fogDensity = 0.5,
    rainDensity = 0.2,
    blizzardDensity = 0.6,
}
ParameterTypeDefaultDescription
enabledbooleantrueEnable visibility effects
fogDensitynumber0.5Fog density (FOGGY weather)
rainDensitynumber0.2Rain fog density
blizzardDensitynumber0.6Blizzard fog density

Auto Wipers

autoWipers = { enabled = true }

Automatically activates vehicle wipers during rain and snow.

Auto Headlights

autoLights = {
    enabled = false,
    nightStart = 20,
    nightEnd = 6,
}
ParameterTypeDefaultDescription
enabledbooleanfalseEnable automatic headlights
nightStartnumber20Hour when headlights turn on
nightEndnumber6Hour when headlights turn off

Player Effects (Cold / Heat)

playerEffects = {
    enabled = true,
    notifications = true,
    freezing = true,
    heatStroke = true,
    coldThreshold = 10,
    heatThreshold = 30,
    screenFx = true,
}
ParameterTypeDefaultDescription
enabledbooleantrueEnable player weather effects
notificationsbooleantrueShow a notification when entering a cold / heat state. Throttled to one notification per 2 minutes per state (v1.1.5+), so rapid temperature oscillation around the threshold can't spam the feed. Set to false to disable.
freezingbooleantrueShivering animation, screen frost
heatStrokebooleantrueSweat animation, screen distortion
coldThresholdnumber10Below this temperature = cold effects. v1.1.5+ adds a 2 °C hysteresis buffer — once in the Cold state, the temperature must rise to coldThreshold + 2 before effects switch off.
heatThresholdnumber30Above this temperature = heat effects. v1.1.5+ adds a 2 °C hysteresis buffer — once in the Heat state, the temperature must drop to heatThreshold − 2 before effects switch off.
screenFxbooleantrueEnable screen post-processing effects

Speed Reduction

speedReduction = {
    enabled = false,
    blizzardModifier = 0.85,
}

Players sprint at 85% speed during blizzard conditions.

Ambient Sounds

ambientSounds = {
    enabled = true,
    sounds = {
        RAIN = 'rain_loop',
        THUNDER = 'thunder_loop',
        WIND = 'wind_loop',
    },
}

Weather-specific ambient sounds with automatic indoor attenuation.

Synced Lightning

syncedLightning = {
    enabled = true,
    flashDuration = 0.5,
    thunderDelay = 2.0,
    minInterval = 5,
    maxInterval = 15,
}
ParameterTypeDefaultDescription
enabledbooleantrueEnable synchronized lightning
flashDurationnumber0.5Flash duration in seconds
thunderDelaynumber2.0Delay between flash and thunder sound
minIntervalnumber5Min seconds between lightning strikes
maxIntervalnumber15Max seconds between strikes

Wind

Config.WindEnabled = true
Config.WindUpdateInterval = 10
Config.WindGustsEnabled = true
Config.WindGustsProbability = 0.2
Config.WindGustsMultiplier = 1.5
ParameterTypeDefaultDescription
WindEnabledbooleantrueEnable wind system
WindUpdateIntervalnumber10Seconds between wind updates
WindGustsEnabledbooleantrueEnable random wind gusts
WindGustsProbabilitynumber0.220% chance of gust each interval
WindGustsMultipliernumber1.5Gust strength multiplier

Blackout

Config.BlackoutEnabled = true
Config.BlackoutAffectsVehicles = false
Config.BlackoutAutoThunder = true
Config.BlackoutThunderProbability = 0.3
Config.BlackoutMinDuration = 5
Config.BlackoutMaxDuration = 10
Config.BlackoutExceptions = { 'Pillbox Hospital', 'Mission Row PD' }
ParameterTypeDefaultDescription
BlackoutEnabledbooleantrueEnable blackout system
BlackoutAffectsVehiclesbooleanfalseVehicle headlights also turn off
BlackoutAutoThunderbooleantrueAuto-trigger blackout during THUNDER
BlackoutThunderProbabilitynumber0.330% chance per thunderstorm
BlackoutMinDurationnumber5Min blackout duration (minutes)
BlackoutMaxDurationnumber10Max blackout duration (minutes)
BlackoutExceptionsstring[]{...}Zone names that keep lights during blackout

Tornado

Config.Tornado = { ... }

General

ParameterTypeDefaultDescription
EnabledbooleantrueEnable tornado system
Commandstring'tornado'Admin command name
WarningDurationnumber30Alert before touchdown (seconds)
ActiveDurationnumber180Active on ground (seconds)
DissipatingDurationnumber30Dissipation fadeout (seconds)
IntensityRampUpnumber30Seconds to reach 100% intensity
TickIntervalnumber50Server update interval (ms)

Movement

ParameterTypeDefaultDescription
MovementEnabledbooleantrueTornado moves across the map
MoveSpeednumber0.3Movement speed (units/tick)
DestinationMinDistnumber80.0Min distance for next waypoint
DestinationMaxDistnumber250.0Max distance for next waypoint

Visual (Particle System)

ParameterTypeDefaultDescription
ParticleLayersnumber8Vertical particle layers
ParticlesPerLayernumber2Particles per layer
BaseRadiusnumber9.4Base funnel radius
LayerSeparationnumber22.0Vertical spacing between layers
RotationSpeednumber2.0Rotation speed (rad/s)
GirthModifiernumber5.0Top-of-funnel flare
DebrisLayersnumber2Dark debris layers at base
CloudTopLayersnumber2Wide cloud layers at top

Physics (3-Force Vortex Model)

ParameterTypeDefaultDescription
HorizontalPullForcenumber1.2Attraction toward center
VerticalForcenumber1.0Upward lift force
TangentialForcenumber0.8Spinning/rotational force
ForceScalenumber2.0Global force multiplier
MaxEntitySpeednumber35.0Speed cap for thrown entities
EntityCollectRadiusnumber45.0Radius to detect entities
MaxTrackedEntitiesnumber20Max simultaneous tracked entities
ThrowVehiclesbooleantrueThrow NPC vehicles
ThrowPedsbooleantrueThrow NPCs
ThrowObjectsbooleanfalseThrow world props (disabled — may crash GTA)
AffectPlayerbooleantruePlayer gets pulled (ragdoll + forces)
PlayerForceMultipliernumber1.2Force multiplier on player

Debris Props

ParameterTypeDefaultDescription
SpawnDebrisbooleantrueSpawn flying debris objects
MaxDebrisPropsnumber5Max simultaneous debris
DebrisSpawnMinnumber3000Min spawn interval (ms)
DebrisSpawnMaxnumber6000Max spawn interval (ms)
DebrisLifetimenumber6500Debris lifetime (ms)
DebrisModelsstring[]{...}Prop model names to use

Tsunami

Config.Tsunami = { ... }

General

ParameterTypeDefaultDescription
EnabledbooleantrueEnable tsunami system
Commandstring'tsunami'Admin command name
WarningDurationnumber30Alert duration before water rises (s)
MaxWaterHeightnumber200.0Maximum water height (meters)
RiseSpeednumber0.08Meters per tick while rising
RecedeSpeednumber0.04Meters per tick while receding
TickIntervalnumber100Milliseconds between ticks
PeakDurationnumber300Seconds at max height (5 min)
DisableTrafficbooleantrueDisable NPC traffic during tsunami
PedsDieInWaterbooleantrueNPCs die when submerged

Visual Effects

ParameterTypeDefaultDescription
CameraShakebooleantrueCamera shake during event
ShakeIntensitynumber0.3Shake intensity (0.0–1.0)
ScreenOverlaybooleantrueBlue/cyan screen overlay
OverlayAlphanumber40Overlay opacity (0–255)
TimecyclebooleantrueDark atmosphere timecycle
ForceWeatherbooleantrueForce THUNDER weather
ForceWindbooleantrueIncrease wind speed
WindSpeednumber12.0Wind speed during tsunami

Notification Messages

ParameterDefaultTrigger
WarningMessage'~r~TSUNAMI ALERT~s~ — Evacuate to high ground!'Warning start
PeakMessage'~b~TSUNAMI~s~ — Maximum level reached'Peak reached
RecedeMessage'~g~TSUNAMI~s~ — Waters are receding'Receding start
EndMessage'~g~END TSUNAMI~s~ — Back to normal'Event end

Database

Config.DatabasePrefix = 'hz_weather'
Config.UseDatabaseConfig = true
Config.SaveConfigToDB = true
ParameterTypeDefaultDescription
DatabasePrefixstring'hz_weather'Table name prefix
UseDatabaseConfigbooleantrueLoad config overrides from database
SaveConfigToDBbooleantrueAdmin panel changes persist to database

Compatibility

Config.EnableQBCompat = true
Config.EnableCDCompat = true
ParameterTypeDefaultDescription
EnableQBCompatbooleantrueExpose qb-weathersync exports and events
EnableCDCompatbooleantrueExpose cd_easytime exports and events
Set to false if you don't use scripts that depend on these resources.

HUD

Config.HUD = {
    Enabled = true,
    UpdateInterval = 5000,
}
ParameterTypeDefaultDescription
EnabledbooleantrueShow in-game weather HUD
UpdateIntervalnumber5000HUD refresh rate (milliseconds)

Performance

Config.MaxZones = 50
Config.MaxHistoryDays = 30
Config.CleanHistoryOnStart = true
ParameterTypeDefaultDescription
MaxZonesnumber50Maximum number of weather zones
MaxHistoryDaysnumber30Days of history to keep in database
CleanHistoryOnStartbooleantrueClean old history on resource start

Season Presets (config/seasons.lua)

This file defines the 4 season presets and the cycle behavior.

Cycle Mode

cycleMode = 'auto'  -- 'disabled', 'auto', 'realtime'
  • disabled — No automatic season cycle. Use admin panel or commands.
  • auto — Rotate through seasons based on cycleDuration.
  • realtime — Map real calendar months to seasons (January = Winter, etc.).

Cycle Duration

cycleDuration = 120  -- Minutes for a full 4-season cycle (30 min per season)

Preset Structure

Each season defines a weather sequence, temperature modifiers, wind profile, and effects:

spring = {
    label = { fr = "Printemps", en = "Spring" },
    icon = "...",

weatherSequence = {
{ weather = 'CLEAR', duration = 8 },
{ weather = 'CLOUDS', duration = 6 },
{ weather = 'RAIN', duration = 4 },
{ weather = 'CLEARING', duration = 3 },
},

temperatureModifiers = {
base = 16.0,
morning = -3,
afternoon = 5,
night = -6,
},

windModifiers = {
base = 15.0,
gusts = 25.0,
},

effects = {
roadWetness = 0.3,
snowOnGround = false,
visibility = 0.95,
},
}

Season Transitions

transitions = {
    enabled = true,
    duration = 2,  -- Transition duration (minutes)
    transitionWeather = {
        ['spring_to_summer'] = 'CLEAR',
        ['summer_to_autumn'] = 'CLOUDS',
        ['autumn_to_winter'] = 'OVERCAST',
        ['winter_to_spring'] = 'CLEARING',
    },
}

Locales (config/locales/)

Set the active locale in config/config.lua:

Config.Locale = 'en'  -- or 'fr'

Adding a New Language

  1. Copy config/locales/en.lua to config/locales/xx.lua (e.g. de.lua)
  2. Translate all string values
  3. Set Config.Locale = 'xx'
return {
    ['key_name'] = 'Translated string',
    ['weather_changed'] = 'Weather changed to %s',
}

After modifying config files, restart the resource with ensure HZ-Weather or restart the server.