SAFScriptsDocs

Configuration

SAF Weather is coming soon. These docs describe the build that will ship.

On this page

Everything is in config.lua. Framework hooks (who is staff, names, logs, notifications) are in bridge/, covered in Custom servers.

General

OptionDefaultWhat it does
Config.Framework'auto''auto', 'qbx', 'qb', 'esx', 'nd', 'ox' or 'standalone'
Config.StaffAce'weather.staff'ACE that opens the panel and allows staff commands
Config.StaffGroupsadmin, god, superadminFramework groups that also count as staff

Commands and keys

Set a command to false to turn it off. Keys are defaults players can rebind in Settings > Key Bindings > FiveM. '' means no default key.

OptionDefaultWhat it does
Config.Commands.Panel'weather'Staff control panel
Config.Commands.PanelKey''Default key for the panel
Config.Commands.Forecast'forecast'Forecast card, for everyone
Config.Commands.ForecastKey''Default key for the forecast
Config.Commands.SetWeather'setweather'/setweather rain [seconds]
Config.Commands.SetTime'settime'/settime 18 30
Config.Commands.FreezeTime'freezetime'Toggles the frozen clock
Config.Commands.Blackout'blackout'Toggles the blackout

Time

OptionDefaultWhat it does
Config.Time.Start'08:00'Time on the very first start. After that the saved clock is used
Config.Time.DayLength48Real minutes for one in-game day at 1x. 48 is the GTA default
Config.Time.Speeds{ 0.25, 0.5, 1, 2, 4, 8 }Speed buttons in the panel
Config.Time.MaxSpeed20Highest speed allowed, from the panel or an export
Config.Time.EaseSeconds6When staff change the time, clients run the clock forward over this long. 0 snaps
Config.Time.RealTimefalseFollow the real-world clock instead
Config.Time.RealTimeOffset0Hours from UTC for real time, e.g. -7 for Los Angeles in summer

Weather

OptionDefaultWhat it does
Config.Weather.Start'CLEAR'Weather on the very first start
Config.Weather.TransitionSeconds45Default blend time between two weathers
Config.Weather.MaxTransitionSeconds600Longest blend allowed
Config.Weather.Typesall 17 typesLabel, temperature and wind per type, see below

Each type has a label, an average temperature temp in C, a swing between the night low and the afternoon high, and a wind range in m/s picked when the weather changes with wind on auto.

IdLabelTemp (C)SwingWind (m/s)
EXTRASUNNYExtra sunny29120.5 to 2.5
CLEARClear25110.5 to 3.0
NEUTRALNeutral2281.0 to 3.5
SMOGSmog2670.0 to 1.5
FOGGYFog1550.0 to 1.5
CLOUDSCloudy2181.5 to 4.5
OVERCASTOvercast1862.0 to 5.5
CLEARINGClearing1762.0 to 5.0
RAINRain1543.5 to 7.5
THUNDERThunderstorm1446.0 to 11.0
SNOWLIGHTLight snow-141.0 to 4.0
SNOWSnow-342.5 to 6.0
BLIZZARDBlizzard-838.0 to 12.0
XMASChristmas-240.5 to 3.0
HALLOWEENHalloween1252.0 to 6.0
RAIN_HALLOWEENHalloween rain1044.0 to 8.0
SNOW_HALLOWEENHalloween snow-243.0 to 7.0

Dynamic weather

Each weather lasts a random number of real minutes between Duration[1] and Duration[2]. Then the next one is picked by weight from the list under the current weather. A weather can only follow one listed under it, so clear skies never jump straight to a thunderstorm.

OptionDefaultWhat it does
Config.Dynamic.EnabledtrueAutomatic weather changes on start
Config.Dynamic.ForecastLength6How many upcoming changes are planned and shown
Config.Dynamic.Duration{ 20, 40 }Minimum and maximum real minutes per weather
Config.Dynamic.MorningFog2.5Fog is this many times likelier when it would start between 04:00 and 09:00
Config.Dynamic.Sequencessee belowWhat can follow each weather, with weights
Config.Dynamic.Wintersee belowUsed instead while Christmas mode is on
Lua
Config.Dynamic.Sequences = {
    EXTRASUNNY = { EXTRASUNNY = 3, CLEAR = 4, CLOUDS = 2, SMOG = 1 },
    CLEAR      = { CLEAR = 3, EXTRASUNNY = 3, CLOUDS = 3, SMOG = 1, FOGGY = 1 },
    NEUTRAL    = { CLEAR = 2, CLOUDS = 2 },
    SMOG       = { CLEAR = 3, CLOUDS = 2, FOGGY = 1, EXTRASUNNY = 1 },
    FOGGY      = { CLEAR = 2, CLOUDS = 3, OVERCAST = 2 },
    CLOUDS     = { CLEAR = 3, CLOUDS = 2, OVERCAST = 3, EXTRASUNNY = 1 },
    OVERCAST   = { CLOUDS = 3, OVERCAST = 2, RAIN = 2, FOGGY = 1, CLEARING = 1 },
    CLEARING   = { CLOUDS = 3, CLEAR = 3, OVERCAST = 1 },
    RAIN       = { CLEARING = 3, RAIN = 1, OVERCAST = 2, THUNDER = 1 },
    THUNDER    = { RAIN = 3, CLEARING = 2 },
}

Config.Dynamic.Winter = {
    XMAS      = { XMAS = 2, SNOWLIGHT = 3, FOGGY = 1 },
    SNOWLIGHT = { SNOWLIGHT = 2, XMAS = 2, SNOW = 2, CLOUDS = 1 },
    SNOW      = { SNOW = 1, SNOWLIGHT = 3, BLIZZARD = 1 },
    BLIZZARD  = { SNOW = 3, SNOWLIGHT = 1 },
    FOGGY     = { XMAS = 2, SNOWLIGHT = 2, CLOUDS = 1 },
    CLOUDS    = { SNOWLIGHT = 3, XMAS = 2, FOGGY = 1 },
}

A higher number makes that weather likelier. RAIN = { CLEARING = 3, THUNDER = 1 } means rain clears three times as often as it turns into a storm.

Snow, blackout and temperature

OptionDefaultWhat it does
Config.Snow.VehicleTrackstrueTyre tracks in snow on the ground
Config.Snow.FootprintstrueFootprints in snow on the ground
Config.Snow.WithXmasWeathertrueThe XMAS weather always puts snow on the ground
Config.Blackout.KeepVehicleLightstrueVehicle lights stay on during a blackout, unless the panel says otherwise
Config.Temperature.Unit'F''F' or 'C' in /forecast and the panel
Config.Temperature.Offset0Shifts every weather's temperature, e.g. -6 for winter

Presets

Config.Presets are the one-click setups in the panel. Leave a field out to keep what's there now.

FieldWhat it sets
id, labelId for the ApplyPreset export, and the name in the panel
time'HH:MM'
freezeFreeze the clock
weatherA weather id
transitionBlend time in seconds
rain0 to 1, or -1 for the weather's default
wind{ speed, direction } or 'auto'
blackout, snow, dynamictrue or false

Presets that ship: Clear noon, Foggy morning, Golden hour, Grey afternoon, Rainy commute, Storm night, City blackout and White Christmas.

Lua
{ id = 'storm_night', label = 'Storm night', time = '23:30', weather = 'THUNDER', rain = 1.0,
  wind = { 11, 250 }, dynamic = false },

Sync and saving

OptionDefaultWhat it does
Config.Sync.ResyncSeconds60Slow clock resync on top of the update sent on every change
Config.Sync.SavetrueKeep the state across restarts in state.json
Config.Sync.WarnConflictstrueConsole warning when another time or weather script is running
Config.Sync.CompattrueAnswer the qb-weathersync events other scripts use

Rate limit

Limits for the panel and staff events, per player.

OptionDefaultWhat it does
Config.RateLimit.Actions20Actions allowed per window
Config.RateLimit.Window10Window in seconds

Forecast card

OptionDefaultWhat it does
Config.ForecastCard.Seconds12How long /forecast stays up. 0 keeps it until the command is used again
Config.ForecastCard.Position'top-right''top-right', 'top-left', 'bottom-right' or 'bottom-left'
Config.ForecastCard.Rows4Upcoming changes shown
SAF Scripts by San Andreas' Finest StoreDiscordsupprot@safrp.org

Not affiliated with or endorsed by Rockstar Games, Take-Two Interactive or Cfx.re.