Use Coupon WELCOME to save 20%

$ USD
  • $ USD
  • € EUR
  • £ GBP
  • $ AUD
  • R$ BRL
  • CHF CHF
  • ¥ JPY
How to Enable Snow in FiveM

How to Enable Snow in FiveM

Enable FiveM snow with a small resource: the server owns the state, ACE protects the command, and clients apply documented weather natives.

The configuration and code examples here target FiveM for GTA V Legacy. Enhanced has different runtime and compatibility rules; check Cfx.re’s Legacy-to-Enhanced changes before applying them to an Enhanced server.

Create the resource

Create a resource folder such as resources/[local]/fmx-snow and add the following fxmanifest.lua. The manifest uses the current cerulean FXv2 version, declares GTA V, and loads one client and one server script.

fx_version 'cerulean'
game 'gta5'

client_script 'client.lua'
server_script 'server.lua'

Keep the switch on the server

Put this in server.lua. The command accepts only on or off and leaves the state unchanged after any other argument. Its restricted RegisterCommand delegates access to ACE; assign the fmxsnow-admin principal only to the small operator group that needs it. GlobalState supplies the current server-owned value to clients.

local snowEnabled = false
GlobalState.fmxSnowEnabled = false

RegisterCommand('fmxsnow', function(source, args)
    local mode = args[1]
    if mode ~= 'on' and mode ~= 'off' then
        print(('fmxsnow: usage fmxsnow on|off (source %s)'):format(source))
        return
    end

    snowEnabled = mode == 'on'
    GlobalState.fmxSnowEnabled = snowEnabled
end, true)
add_ace group.fmxsnow-admin command.fmxsnow allow
ensure fmx-snow

Render the state on each client

Put this in client.lua. The client reads the replicated GlobalState value at startup, listens for later state-bag updates, and uses the documented weather natives. No client event can change the server-owned state.

local function applySnow(enabled)
    if enabled then
        SetWeatherTypeNowPersist('XMAS')
        SetOverrideWeather('XMAS')
    else
        ClearOverrideWeather()
        ClearWeatherTypePersist()
    end
end

AddStateBagChangeHandler('fmxSnowEnabled', nil, function(_, _, value)
    applySnow(value == true)
end)

applySnow(GlobalState.fmxSnowEnabled == true)

AddEventHandler('onClientResourceStop', function(name)
    if name == GetCurrentResourceName() then
        ClearOverrideWeather()
        ClearWeatherTypePersist()
    end
end)

Add ensure fmx-snow to server.cfg after saving the files, then restart the resource or server. Test fmxsnow on and off with an authorized account, verify invalid arguments print the usage without changing the state, and confirm an unprivileged account has no command access.

Primary sources: Cfx resource-manifest, server-command, native-reference and server-security documentation.

Check ownership and recovery

Use only one weather controller. Disable competing weather synchronization on the test instance before running this example. It switches to XMAS immediately; it does not persist the choice across a resource/server restart.

GlobalState requires the server’s state-awareness support. Assign the shown ACE group to your actual authorized administrator using your existing permission workflow. Test on/off, reconnect and stopping the resource. After removing it, let your normal weather controller restore the intended weather.

Reference documentation

Cfx.re — resource manifest · Cfx.re — state bags

Leave a Reply