Skip to content

QRCore-RedM-Re/qr-weathersync

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

qb-weathersync

Synced weather and time for QB-Core Framework 🌅

Dependencies

Features

  • Syncs the weather for all players

Installation

Manual

  • Download the script and put it in the [qr] directory.
  • Add the following code to your server.cfg/resouces.cfg
ensure qr-core
ensure qr-weathersync

Configuration

You can adjust available weather and defaults in config.lua to adjust weather patterns you need to modify nextWeatherStage() in server/server.lua

Commands

/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

Exports

nextWeatherStage

Triggers event to switch weather to next stage

-- LUA EXAMPLE
local success = exports["qr-weathersync"]:nextWeatherStage();
// JAVASCRIPT EXAMPLE
const success = global.exports["qr-weathersync"].nextWeatherStage();

setWeather [type]

Switch to a specified weather type from Config.AvailableWeatherTypes

-- LUA EXAMPLE
local success = exports["qr-weathersync"]:setWeather("snow");
// JAVASCRIPT EXAMPLE
const success = global.exports["qr-weathersync"].setWeather("snow");

setTime [hour] (minute)

Sets sun position based on time to specified

-- LUA EXAMPLE
local success = exports["qr-weathersync"]:setTime(8, 10); -- 8:10 AM
// JAVASCRIPT EXAMPLE
const success = global.exports["qb-weathersync"].setTime(15, 30); // 3:30PM

setBlackout (true|false)

Sets or toggles blackout state and returns the state

-- LUA EXAMPLE
local newStatus = exports["qr-weathersync"]:setBlackout(); -- Toggle
// JAVASCRIPT EXAMPLE
const newStatus = global.exports["qr-weathersync"].setBlackout(true); // Enable

setTimeFreeze (true|false)

Sets or toggles time freeze state and returns the state

-- LUA EXAMPLE
local newStatus = exports["qr-weathersync"]:setTimeFreeze(); -- Toggle
// JAVASCRIPT EXAMPLE
const newStatus = global.exports["qr-weathersync"].setTimeFreeze(true); // Enable

setDynamicWeather (true|false)

Sets or toggles dynamic weather state and returns the state

-- LUA EXAMPLE
local newStatus = exports["qr-weathersync"]:setDynamicWeather(); -- Toggle
// JAVASCRIPT EXAMPLE
const newStatus = global.exports["qb-weathersync"].setDynamicWeather(true); // Enable

getBlackoutState

Returns if blackout is enabled or disabled

-- LUA EXAMPLE
local state = exports["qr-weathersync"]:getBlackoutState();
// JAVASCRIPT EXAMPLE
const state = global.exports["qr-weathersync"].getBlackoutState();

getTimeFreezeState

Returns if time progression is enabled or disabled

-- LUA EXAMPLE
local state = exports["qr-weathersync"]:getTimeFreezeState();
// JAVASCRIPT EXAMPLE
const state = global.exports["qr-weathersync"].getTimeFreezeState();

getWeatherState

Returns the current weather type

-- LUA EXAMPLE
local currentWeather = exports["qr-weathersync"]:getWeatherState();
// JAVASCRIPT EXAMPLE
const currentWeather = global.exports["qr-weathersync"].getWeatherState();

getDynamicWeather

Returns if time progression is enabled or disabled

-- LUA EXAMPLE
local state = exports["qr-weathersync"]:getDynamicWeather();
// JAVASCRIPT EXAMPLE
const state = global.exports["qr-weathersync"].getDynamicWeather();

Events

qr-weathersync:server:RequestStateSync - Sync time and weather for everyone

qr-weathersync:server:setWeather [type] - Set Weather type (List in Config)

qr-weathersync:server:setTime [hour] (minute) - Set simulated time

qr-weathersync:server:toggleBlackout (true|false) - Enable, disable or toggle blackout

qr-weathersync:server:toggleFreezeTime (true|false) (minute) - Enable, disable or toggle time progression

qr-weathersync:server:toggleDynamicWeather (true|false) - Enable, disable or toggle dynamic weather

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages