Resource documentation
dzr-environment
Server-authoritative time, weather, and world-condition API for FiveM. One resource owns the sky - your other scripts read it.
On this page
One resource owns the sky: the clock, weather, temperature, road wetness, visibility, wind, blackout, and a forecast. Everything is decided on the server and synced to every player, so the world is consistent for everyone.
The free weather scripts set the sky. This one lets your handling, HUD, and fishing scripts read it - they never have to guess the weather.
local snap = exports['dzr-environment']:GetEnvironmentSnapshot()
if snap.surface == 'slick' then
-- wet roads: reduce grip, warn the HUD, slow the AI convoy...
end
Why it is different
- Server-authoritative. One source of truth. Time and weather are decided server-side and synced; no two players ever disagree about the sky.
- It blends, it never snaps. Weather eases in over a few seconds. The clock drifts smoothly every frame instead of ticking in jumps.
- Believable weather, not random spam. Weather moves through a sensible graph (clear can cloud over and rain; storms clear through a brightening phase) with time-of-day bias - fog mornings, storms evenings.
- The sky becomes data your other scripts read. From the weather it derives temperature, a heat level, visibility, road surface (dry / damp / slick), and wind - all readable through exports. Your handling script, HUD, and fishing script read the same sky.
- A developer API, not just a config file. Read exports, trusted write exports, and broadcast events with full payloads. Build a phone weather app, vehicle traction, or fishing modifiers without touching this resource's code.
What is in the box
- Smooth server-synced time with a configurable day length, freeze, and cinematic time-travel (the clock visibly runs to the target hour).
- A weather engine with nine GTA-native weather types, intensity levels, and smooth transitions.
- Derived conditions: temperature (F and C), heat level, visibility, road surface, wind level, rain duration.
- A forecast your scripts and players can read.
- City blackout as a first-class, staff-controlled feature.
- An admin control panel (
/environment) plus a full set of console commands, gated by one ACE permission. - Timed, auto-restoring environment events for automation and store integrations - a bought or scheduled storm that cleans up after itself.
env:doctor- a one-command health report for setup and conflicts.
What it does NOT do
- Player effects from weather (heat damage, slipping, HUD changes) - it provides the conditions; your scripts react.
- Wind direction or speed vectors - only categorical wind levels.
- Seasons or date-aware climate - the temperature model is a static
mild-climate curve (nudge it with
TemperatureOffset).
Requirements and performance
The only dependency is ox_lib. It works standalone or alongside ESX, QBCore, QBox, and ND - it never hooks into your framework; admin access is a plain ACE permission.
Server cost is fixed regardless of player count: a handful of low-frequency threads, no database, no per-player loops. State persists via FiveM KVP. Designed for 128-player servers.
Where to go next
- Installation - five minutes, two
server.cfglines, one ACE. - Configuration - every option in
shared/config.lua. - Commands - the admin command set.
- Developer API - exports, events, GlobalState.
- Automation and store events - timed overrides, presets, and the zero-Lua Tebex path.
- Troubleshooting - symptom and fix table.
Need help with this? Open a ticket on Discord or read the support guide.