In this tutorial, you'll learn how to create a custom weather and time control system for your FiveM server using the VolticHost Game Panel. This system enables administrators to dynamically change the in-game weather and time via chat commands, enhancing the immersive roleplay experience. 🚀
📌 Prerequisites
-
A FiveM server purchased at VolticHost.com
-
Access to the VolticHost Game Panel
-
Basic knowledge of Lua scripting and FiveM resource management
-
Familiarity with file editing via the File Manager
1️⃣ First Step - Creating Your Weather and Time Control Resource
-
Log in to VolticHost Game Panel.
-
Navigate to the File Manager from the main dashboard.
-
Go to the
/resources/
directory. -
Create a new folder named
weather_time_control
. -
Inside the
weather_time_control
folder, create a new file namedfxmanifest.lua
and add the following content:fx_version 'cerulean' game 'gta5' author 'YourName' description 'Custom Weather and Time Control System' version '1.0.0' client_script 'weather_time_control_client.lua' server_script 'weather_time_control_server.lua'
-
Create two additional files in the same folder:
weather_time_control_client.lua
andweather_time_control_server.lua
.
✅ Resource folder and manifest created successfully!
2️⃣ Next Step - Uploading and Editing the Script Files
A. Server-Side Script (weather_time_control_server.lua)
-
Open
weather_time_control_server.lua
for editing and paste the following code:-- weather_time_control_server.lua RegisterCommand("setweather", function(source, args, rawCommand) local weather = args[1] if not weather then TriggerClientEvent('chat:addMessage', source, { args = { "Weather Control", "Usage: /setweather [weatherType]" } }) return end -- Broadcast the weather change to all players TriggerClientEvent("weather_time_control:setWeather", -1, weather) TriggerClientEvent('chat:addMessage', source, { args = { "Weather Control", "Weather changed to " .. weather } }) end, true) RegisterCommand("settime", function(source, args, rawCommand) local hour = tonumber(args[1]) local minute = tonumber(args[2]) if hour == nil or minute == nil then TriggerClientEvent('chat:addMessage', source, { args = { "Time Control", "Usage: /settime [hour] [minute]" } }) return end -- Broadcast the time change to all players TriggerClientEvent("weather_time_control:setTime", -1, hour, minute) TriggerClientEvent('chat:addMessage', source, { args = { "Time Control", "Time set to " .. hour .. ":" .. minute } }) end, true)
-
Save the file.
B. Client-Side Script (weather_time_control_client.lua)
-
Open
weather_time_control_client.lua
for editing and paste the following code:-- weather_time_control_client.lua RegisterNetEvent("weather_time_control:setWeather") AddEventHandler("weather_time_control:setWeather", function(weather) SetWeatherTypeNowPersist(weather) SetWeatherTypeNow(weather) SetOverrideWeather(weather) print("Weather set to " .. weather) end) RegisterNetEvent("weather_time_control:setTime") AddEventHandler("weather_time_control:setTime", function(hour, minute) NetworkOverrideClockTime(hour, minute, 0) print("Time set to " .. hour .. ":" .. minute) end)
-
Save the file.
✅ Server and client scripts uploaded and saved successfully!
3️⃣ Next Step - Adding the Resource to Your Server Configuration
-
In the VolticHost Game Panel, open the
server.cfg
file from your FiveM server's root directory. -
Add the following line to start your new resource:
start weather_time_control
-
Save the changes.
✅ Resource added to server configuration successfully!
4️⃣ Next Step - Testing and Refining Your Weather & Time Control System
-
Restart your server from the VolticHost Game Panel to load the new resource.
-
Join your server and open the in-game chat/console.
-
Test the weather command by typing:
/setweather CLEAR
(Replace
CLEAR
with any valid weather type likeRAIN
,FOGGY
, etc.) -
Test the time command by typing:
/settime 15 30
This should set the in-game time to 3:30 PM.
-
Verify that the changes are reflected in-game and adjust your script if necessary.
✅ Weather and time control system tested and refined successfully!
🎉 Conclusion
You have now successfully created a custom weather and time control system on your FiveM server using the VolticHost Game Panel! Enhance your roleplay environment by dynamically adjusting weather and time to suit your server's narrative. 🚀
For more assistance, contact VolticHost Support.