Links

Easytime - Time & Weather Management

Step-by-step installation guide, common issues & solutions, code snippets, error codes, config previews, locales previews, SQL previews, and changelogs; all in 1 easily accessible place.

Translate

INSTALLATION GUIDE

1. Unzip the cd_easytime.zip folder and place this folder in your server's resource folder.
2. Before starting the script, please read the config.lua (this is located inside the main cd_easytime folder) and configure the script to suit your server's needs.
3. Add the resource to your server start config: ensure cd_easytime (it must be placed anywhere below your framework resource eg., es_extended, not above). The name of the folder must not be changed or the resource will not function correctly.

Step 1 - How do I use it?

The default command to open the UI is /easytime. It comes pre-configured for esx, qbus, vrp and ace permissions, you just need to add your desired permission groups in the Config.framework_perms in the configs/config.lua.

Step 2 - Persistent weather

The settings which are saved in the settings.txt file will automatically be applied on server start or script restart.
From client to server
There are 3 ways to save the settings.
  1. 1.
    Staff members with the correct permissions can use the "Save Settings" option on the UI when in-game.
  2. 2.
    When the script is restarted the settings will automatically be saved.
  3. 3.
    By triggering this server event below at least 30 seconds before a server restart.
TriggerServerEvent('cd_easytime:SaveSettings')

Step 3 - Shell support

If you do not use shells, ignore this step.
When a player enters/exits a shell you will need to trigger the client event below. So now when you enter a shell the time will change to 11 PM and the weather will change to CLEAR for the player's client to ensure there are no visual anomalies such as shadows or rain/snow etc inside the shell.
When entering a shell
When exiting a shell
TriggerEvent('cd_easytime:PauseSync', true)
TriggerEvent('cd_easytime:PauseSync', false)

Step 4 - Tsunami warning

First, configure the Config.TsunamiWarning_time so the script knows how long the tsunami warning should last. Then this server event needs to be triggered x amount of minutes before a server restart.
Example: If you set the Config.TsunamiWarning_time to 2 minutes, then this event needs to be triggered 2 minutes before a server restart. The Halloween weather will start to change immediately, then the blackout and tsunami warning sound will start 90 seconds later.
Notes:
  • The blackout and tsunami warning will start when 3/4 of the Config.TsunamiWarning_time time has expired.
  • If you txAdmin's scheduled restart feature, you only need to configure the Config.TsunamiWarning_time, you do not need to trigger this event as this event will be triggered automatically.
From server to server
From client to server
TriggerEvent('cd_easytime:StartTsunamiCountdown', boolean)
TriggerServerEvent('cd_easytime:StartTsunamiCountdown', -1, boolean)

Information

vMenu

The time and weather sync in vMenu must be disabled. To do this make sure your permissions.cfg of vMenu for the time and weather looks like this.
credits to J̫o̫e̫ M̫a̫m̫a̫#1570.

Exports

These exports are completely optional, you can use them if needed.
Export
Description
exports['cd_easytime']:GetWeather()
Returns a table with all of the current weather data. This export can be used on both server and client side. Usage example.

SCRIPT NOT WORKING?

Common Issues

🔔 Folder Name Make sure the name of the folder is cd_easytime.
Screen Flickering If your screen is flickering while using cd_easytime, this is due to you having multiple time/weather sync scripts running at the same time fighting each other eg., vSync or vMenu.
✔️ Stop the other time/weather script that is causing this.
Permission Checks Error If you are having errors related to the permission checks for the /easytime command.
✔️ Look for the PermissionsCheck function in the server/server.lua. And make sure you have configured the Config.Framework_perms as mentioned in Step 1.
Footprints If players have footprints when the weather is not snowing (summer, clear etc).
✔️ This is because of a script you are using called fanox-hunting. Remove these 2 lines in the client side.
if Config.EnableFootprints then
SetForcePedFootstepsTracks(true)
end

Troubleshooting

1. Check for obvious error prints in the server console and the client F8 console. If you don't see any obvious errors make sure to restart the script while the server is live and check again.
2. If none of the above worked, have a second read through the installation guide above, you may have missed something - you are only human.
If all else fails, contact the Codesign Team in the Codesign Discord.

CHANGELOG

Files Changed: Not every update requires you to replace the whole folder. We do this because we understand it's a pain to redo the configs for every update.
  • All Files - This means you should delete your old cd_easytime folder, download and add in the latest version, reconfigure the configs folder and restart your server.
  • Specific Files - This means you can simply copy and paste the SPECIFIC new files over the old ones and restart the server.
v1.1.4
v1.2.0
v1.3.0
v1.3.1
v1.3.3
v1.3.4
v1.3.5
v1.3.6

20/03/2021 - 22/03/2021

v1.1.4 - v1.1.7
Files Changed:
  • All files
  • Specific Files
Changelog:
Add
  • Added a version check to ensure you stay updated with the progress.
Edit
  • Reworked the FORCED time changes so the changes are a lot smother.
  • Reworked the natural weather changes so the changes are a lot smoother and barely noticeable.
  • Reworded the config to be a bit more user friendly.
  • Added a wait before syncing a players time and weather to ensure stability.
Fix
  • Fixed a typo in causing the time cycle to speed up.
  • Fixed a small issue which would cause the weather to change to clear Instantly when entering a shell due to the pervious updates.
  • File clean-up, removed the old client file which was renamed.
  • Fixed a typo in the client.lua causing a error.

15/05/2021 - 29/06/2021

v1.2.0 - v1.2.1
Files Changed:
  • All files
  • Specific Files
Changelog:
Add
  • Added the ability to toggle the instant time and weather change on the in game UI instead of it being a config option, meaning you can choose whether you want to instantly change the time or make the time change slowly so its barely noticeable to players in game.
  • Added a new config option to allow you to walk around while the UI is open.
  • Added a fail safe check to make sure the time and weather is synced when a player joins the server.
  • Added drag and drop compatibility for qbus and ace permissions (read Step 1 for more information).
  • The settings now automatically save when the script is restarted.
Edit
  • Now when you click the "Save Settings" button on the in game UI, your chosen settings will be saved to the settings.txt file and applied in game, then the UI will close. (previously you needed to open the UI, choose your settings, click the "Change" button, reopen the UI and then click the "Save Settings" button).
  • Edited the Config.NUI_keepinput to disable mouse movement and punching/firing weapons while the UI is open.
Fix
  • Fixed time not syncing for new players when the FreezeTime option is enabled.

18/12/2021

Files Changed:
  • All files
  • Specific Files
Changelog:
Add
  • Tsunami warning (pre-restart warning): This feature adds visual and sound effects to warn players that a server restart is about to happen while keeping it in-character. It changes the weather to Halloween, then shortly after it enables a city wide blackout and plays a tsunami warning alert sound just before the server restart.
  • Added pre-set permissions for each framework config option.
Edit
  • Rewrote parts of the script as some were outdated.
Fix
  • Fixed issues with the weather not being synced on ESX/QBCore servers.
  • Other minor bug fixes.

22/12/2021

Files Changed:
  • All files
  • Specific Files
fxmanifest.lua
server/server.lua
Changelog:
Fix
  • Reverted a change that caused the tsunami warning to have issues.
  • Implemented a fix from a previous GitHub pull request to fix an issue with dynamic weather.

20/04/2022

Files Changed:
  • All files
  • Specific Files
Changelog:
Add
  • Added a option to use a identifier based permission system (steam/license).
  • Added a new config option to allow vehicles lights to stay turned on during blackouts.
Edit
  • Updated the blackout native.
  • Removed unused framework job code.
Fix
  • Fixed QBCore perms.
  • Fixed aceperms.

28/04/2022

Files Changed:
  • All files
  • Specific Files
Changelog:
Add
  • Added drag-and-drop compatibility for cd_easytime to be used on QBCore servers and in replacement for vSync, meaning; dependencies don't need to be removed and events don't need changing when switching from QBCore or vSync to cd_easytime.
Fix
  • Fixed the time and weather not changing when clicking the "Save Settings button".
  • Fixed the client-side errors related to users not being on a high enough game build to support the new blackout natives.

02/05/2022

Files Changed:
  • All files
  • Specific Files
fxmanifest.lua
server/server.lua
Changelog:
Fix

13/06/2022

Files Changed:
  • All files
  • Specific Files
fxmanifest.lua
server/server.lua
client/client.lua
Changelog:
Add
  • Added server and client exports to get the weather data. See docs.