Synced weather and time for QB-Core Framework π
QBCore Framework
Copyright (C) 2021 Joshua Eger
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>
- Syncs the weather for all players
## Credit: Additional Features added by: WiseByDesign - Discord: wisebydesign
-
Option for enabling Xmas Weather in December Automatically
-
Extra Xmas Weather Effect VFX and SFX Options
-
Player Vehicle Accumulates Snow While out in the Weather and Accumulates more While Vehicle is in Motion
-
Player Vehicle Snow will Slowly "Melt" while Inside of an Interior, but not 100%, Some Dirt will Always Remain During Xmas if Vehicle has been Driven out in the Weather
-
Player Vehicle Will Remain Clean if Spawned Clean in an Interior until Exiting and Going Out into Xmas Weather
-
Iced Lake IPL Resource Support
-
Option to Add "ice chunks" VFX to All Bodies of Water
-
2 New Weather Types Added: 'RAIN_HALLOWEEN' and 'SNOW_HALLOWEEN' - Instructions on How to Add to QB-AdminMenu Below
-
Tested on Game Builds:
3570, 3717
- Tested on Artifacts:
22819, 22934, 23368, 23683
- Tested Graphics:
NVE, Vanilla (Legacy)
## Credit: Additional Features added by: WiseByDesign - Discord: wisebydesign
- Download the script and put it in the
[qb]directory. - Add the following code to your server.cfg/resouces.cfg
ensure qb-core
ensure qb-weathersync
You can adjust available weather and defaults in config.lua
to adjust weather patterns you need to modify nextWeatherStage() in server/server.lua
## Credit: Additional Features added by: WiseByDesign - Discord: wisebydesign
New Weather Options:
RAIN_HALLOWEEN
SNOW_HALLOWEEN
qb-adminmenu/client/client.lua
[15] = {
icon = 'π',
label = Lang:t('weather.halloween'),
value = 'HALLOWEEN',
description = Lang:t('weather.halloween_desc')
},
--Copy Paste Here, MAKE SURE TO ADD COMMA AFTER CLOSING } IF NOT ALREADY THERE--
[16] = {
icon = 'βοΈπ',
label = Lang:t('weather.halloween_rain'),
value = 'RAIN_HALLOWEEN',
description = Lang:t('weather.halloween_rain_desc')
},
[17] = {
icon = 'βοΈπ',
label = Lang:t('weather.halloween_snow'),
value = 'SNOW_HALLOWEEN',
description = Lang:t('weather.halloween_snow_desc')
}
----------------------------------------------------------
qb=adminmenu/locales/en.lua
heavy_snow = 'Heavy Snow (XMAS)',
heavy_snow_desc = 'Snowball Fight!',
halloween = 'Halloween',
halloween_desc = 'What Was That Noise?!',
-------------------------------------------------- HERE
halloween_rain = 'Halloween Rain',
halloween_rain_desc = 'Rain, Rain, Go Away?!',
halloween_snow = 'Halloween Snow',
halloween_snow_desc = 'It is Beginning to Look a lot Like. . .',
--------------------------------------------------
weather_changed = 'Weather Changed To: %{value}',
## Credit: Additional Features added by: WiseByDesign - Discord: wisebydesign
/freezetime - Toggle time progression
/freezeweather - Toggle dynamic weather
/weather [type] - Set weather
/blackout - Toggle blackout
/morning - Set time to 9am
/noon - Set time to 12pm
/evening - Set time to 6pm
/night - Set time to 11pm
/time [hour] (minute) - Set time to whatever you want
Triggers event to switch weather to next stage
-- LUA EXAMPLE
local success = exports["qb-weathersync"]:nextWeatherStage();// JAVASCRIPT EXAMPLE
const success = global.exports["qb-weathersync"].nextWeatherStage();Switch to a specified weather type from Config.AvailableWeatherTypes
-- LUA EXAMPLE
local success = exports["qb-weathersync"]:setWeather("snow");// JAVASCRIPT EXAMPLE
const success = global.exports["qb-weathersync"].setWeather("snow");Sets sun position based on time to specified
-- LUA EXAMPLE
local success = exports["qb-weathersync"]:setTime(8, 10); -- 8:10 AM// JAVASCRIPT EXAMPLE
const success = global.exports["qb-weathersync"].setTime(15, 30); // 3:30PMSets or toggles blackout state and returns the state
-- LUA EXAMPLE
local newStatus = exports["qb-weathersync"]:setBlackout(); -- Toggle// JAVASCRIPT EXAMPLE
const newStatus = global.exports["qb-weathersync"].setBlackout(true); // EnableSets or toggles time freeze state and returns the state
-- LUA EXAMPLE
local newStatus = exports["qb-weathersync"]:setTimeFreeze(); -- Toggle// JAVASCRIPT EXAMPLE
const newStatus = global.exports["qb-weathersync"].setTimeFreeze(true); // EnableSets or toggles dynamic weather state and returns the state
-- LUA EXAMPLE
local newStatus = exports["qb-weathersync"]:setDynamicWeather(); -- Toggle// JAVASCRIPT EXAMPLE
const newStatus = global.exports["qb-weathersync"].setDynamicWeather(true); // EnableReturns if blackout is enabled or disabled
-- LUA EXAMPLE
local state = exports["qb-weathersync"]:getBlackoutState();// JAVASCRIPT EXAMPLE
const state = global.exports["qb-weathersync"].getBlackoutState();Returns if time progression is enabled or disabled
-- LUA EXAMPLE
local state = exports["qb-weathersync"]:getTimeFreezeState();// JAVASCRIPT EXAMPLE
const state = global.exports["qb-weathersync"].getTimeFreezeState();Returns the current weather type
-- LUA EXAMPLE
local currentWeather = exports["qb-weathersync"]:getWeatherState();// JAVASCRIPT EXAMPLE
const currentWeather = global.exports["qb-weathersync"].getWeatherState();Returns if time progression is enabled or disabled
-- LUA EXAMPLE
local state = exports["qb-weathersync"]:getDynamicWeather();// JAVASCRIPT EXAMPLE
const state = global.exports["qb-weathersync"].getDynamicWeather();qb-weathersync:server:RequestStateSync - Sync time and weather for everyone
qb-weathersync:server:setWeather [type] - Set Weather type (List in Config)
qb-weathersync:server:setTime [hour] (minute) - Set simulated time
qb-weathersync:server:toggleBlackout (true|false) - Enable, disable or toggle blackout
qb-weathersync:server:toggleFreezeTime (true|false) (minute) - Enable, disable or toggle time progression
qb-weathersync:server:toggleDynamicWeather (true|false) - Enable, disable or toggle dynamic weather