Diff
checker
Text
Text
Images
Documents
Excel
Folders
Legal
Enterprise
Desktop
Pricing
Sign in
Download Diffchecker Desktop
Compare text
Find the difference between two text files
Tools
History
Real-time editor
Hide unchanged lines
Disable line wrap
Layout
Split
Unified
Diff precision
Smart
Word
Char
Syntax highlighting
Choose syntax
Ignore
Transform text
Go to first change
Edit input
Diffchecker Desktop
The most secure way to run Diffchecker. Get the Diffchecker Desktop app: your diffs never leave your computer!
Get Desktop
Untitled diff
Created
8 years ago
Diff never expires
Clear
Export
Share
Explain
10 removals
Lines
Total
Removed
Characters
Total
Removed
To continue using this feature, upgrade to
Diff
checker
Pro
View Pricing
361 lines
Copy
1 addition
Lines
Total
Added
Characters
Total
Added
To continue using this feature, upgrade to
Diff
checker
Pro
View Pricing
352 lines
Copy
Copy
Copied
Copy
Copied
------------------ change this -------------------
admins = {
'steam:110000105959047',
--'license:1234975143578921327',
}
-- Set this to false if you don't want the weather to change automatically every 10 minutes.
-- Set this to false if you don't want the weather to change automatically every 10 minutes.
DynamicWeather = true
DynamicWeather = true
--------------------------------------------------
--------------------------------------------------
debugprint = false -- don't touch this unless you know what you're doing or you're being asked by Vespura to turn this on.
debugprint = false -- don't touch this unless you know what you're doing or you're being asked by Vespura to turn this on.
--------------------------------------------------
--------------------------------------------------
-------------------- DON'T CHANGE THIS --------------------
-------------------- DON'T CHANGE THIS --------------------
AvailableWeatherTypes = {
AvailableWeatherTypes = {
'EXTRASUNNY',
'EXTRASUNNY',
'CLEAR',
'CLEAR',
'NEUTRAL',
'NEUTRAL',
'SMOG',
'SMOG',
'FOGGY',
'FOGGY',
'OVERCAST',
'OVERCAST',
'CLOUDS',
'CLOUDS',
'CLEARING',
'CLEARING',
'RAIN',
'RAIN',
'THUNDER',
'THUNDER',
'SNOW',
'SNOW',
'BLIZZARD',
'BLIZZARD',
'SNOWLIGHT',
'SNOWLIGHT',
'XMAS',
'XMAS',
'HALLOWEEN',
'HALLOWEEN',
}
}
Copy
Copied
Copy
Copied
CurrentWeather = "EXTRASUNNY"
local baseTime = 0
local timeOffset = 0
local freezeTime = false
local freezeTime = false
local blackout = false
local blackout = false
local newWeatherTimer = 10
local newWeatherTimer = 10
RegisterServerEvent('vSync:requestSync')
RegisterServerEvent('vSync:requestSync')
AddEventHandler('vSync:requestSync', function()
AddEventHandler('vSync:requestSync', function()
TriggerClientEvent('vSync:updateWeather', -1, CurrentWeather, blackout)
TriggerClientEvent('vSync:updateWeather', -1, CurrentWeather, blackout)
TriggerClientEvent('vSync:updateTime', -1, baseTime, timeOffset, freezeTime)
TriggerClientEvent('vSync:updateTime', -1, baseTime, timeOffset, freezeTime)
end)
end)
function isAllowedToChange(player)
function isAllowedToChange(player)
local allowed = false
local allowed = false
for i,id in ipairs(admins) do
for i,id in ipairs(admins) do
for x,pid in ipairs(GetPlayerIdentifiers(player)) do
for x,pid in ipairs(GetPlayerIdentifiers(player)) do
if debugprint then print('admin id: ' .. id .. '\nplayer id:' .. pid) end
if debugprint then print('admin id: ' .. id .. '\nplayer id:' .. pid) end
if string.lower(pid) == string.lower(id) then
if string.lower(pid) == string.lower(id) then
allowed = true
allowed = true
end
end
end
end
end
end
return allowed
return allowed
end
end
RegisterCommand('freezetime', function(source, args)
RegisterCommand('freezetime', function(source, args)
if source ~= 0 then
if source ~= 0 then
if isAllowedToChange(source) then
if isAllowedToChange(source) then
freezeTime = not freezeTime
freezeTime = not freezeTime
if freezeTime then
if freezeTime then
TriggerClientEvent('vSync:notify', source, 'Time is now ~b~frozen~s~.')
TriggerClientEvent('vSync:notify', source, 'Time is now ~b~frozen~s~.')
else
else
TriggerClientEvent('vSync:notify', source, 'Time is ~y~no longer frozen~s~.')
TriggerClientEvent('vSync:notify', source, 'Time is ~y~no longer frozen~s~.')
end
end
else
else
TriggerClientEvent('chatMessage', source, '', {255,255,255}, '^8Error: ^1You are not allowed to use this command.')
TriggerClientEvent('chatMessage', source, '', {255,255,255}, '^8Error: ^1You are not allowed to use this command.')
end
end
else
else
freezeTime = not freezeTime
freezeTime = not freezeTime
if freezeTime then
if freezeTime then
print("Time is now frozen.")
print("Time is now frozen.")
else
else
print("Time is no longer frozen.")
print("Time is no longer frozen.")
end
end
end
end
end)
end)
RegisterCommand('freezeweather', function(source, args)
RegisterCommand('freezeweather', function(source, args)
if source ~= 0 then
if source ~= 0 then
if isAllowedToChange(source) then
if isAllowedToChange(source) then
DynamicWeather = not DynamicWeather
DynamicWeather = not DynamicWeather
if not DynamicWeather then
if not DynamicWeather then
TriggerClientEvent('vSync:notify', source, 'Dynamic weather changes are now ~r~disabled~s~.')
TriggerClientEvent('vSync:notify', source, 'Dynamic weather changes are now ~r~disabled~s~.')
else
else
TriggerClientEvent('vSync:notify', source, 'Dynamic weather changes are now ~b~enabled~s~.')
TriggerClientEvent('vSync:notify', source, 'Dynamic weather changes are now ~b~enabled~s~.')
end
end
else
else
TriggerClientEvent('chatMessage', source, '', {255,255,255}, '^8Error: ^1You are not allowed to use this command.')
TriggerClientEvent('chatMessage', source, '', {255,255,255}, '^8Error: ^1You are not allowed to use this command.')
end
end
else
else
DynamicWeather = not DynamicWeather
DynamicWeather = not DynamicWeather
if not DynamicWeather then
if not DynamicWeather then
print("Weather is now frozen.")
print("Weather is now frozen.")
else
else
print("Weather is no longer frozen.")
print("Weather is no longer frozen.")
end
end
end
end
end)
end)
RegisterCommand('weather', function(source, args)
RegisterCommand('weather', function(source, args)
if source == 0 then
if source == 0 then
local validWeatherType = false
local validWeatherType = false
if args[1] == nil then
if args[1] == nil then
print("Invalid syntax, correct syntax is: /weather <weathertype> ")
print("Invalid syntax, correct syntax is: /weather <weathertype> ")
return
return
else
else
for i,wtype in ipairs(AvailableWeatherTypes) do
for i,wtype in ipairs(AvailableWeatherTypes) do
if wtype == string.upper(args[1]) then
if wtype == string.upper(args[1]) then
validWeatherType = true
validWeatherType = true
end
end
end
end
if validWeatherType then
if validWeatherType then
print("Weather has been updated.")
print("Weather has been updated.")
CurrentWeather = string.upper(args[1])
CurrentWeather = string.upper(args[1])
newWeatherTimer = 10
newWeatherTimer = 10
TriggerEvent('vSync:requestSync')
TriggerEvent('vSync:requestSync')
else
else
print("Invalid weather type, valid weather types are: \nEXTRASUNNY CLEAR NEUTRAL SMOG FOGGY OVERCAST CLOUDS CLEARING RAIN THUNDER SNOW BLIZZARD SNOWLIGHT XMAS HALLOWEEN ")
print("Invalid weather type, valid weather types are: \nEXTRASUNNY CLEAR NEUTRAL SMOG FOGGY OVERCAST CLOUDS CLEARING RAIN THUNDER SNOW BLIZZARD SNOWLIGHT XMAS HALLOWEEN ")
end
end
end
end
else
else
if isAllowedToChange(source) then
if isAllowedToChange(source) then
local validWeatherType = false
local validWeatherType = false
if args[1] == nil then
if args[1] == nil then
TriggerClientEvent('chatMessage', source, '', {255,255,255}, '^8Error: ^1Invalid syntax, use ^0/weather <weatherType> ^1instead!')
TriggerClientEvent('chatMessage', source, '', {255,255,255}, '^8Error: ^1Invalid syntax, use ^0/weather <weatherType> ^1instead!')
else
else
for i,wtype in ipairs(AvailableWeatherTypes) do
for i,wtype in ipairs(AvailableWeatherTypes) do
if wtype == string.upper(args[1]) then
if wtype == string.upper(args[1]) then
validWeatherType = true
validWeatherType = true
end
end
end
end
if validWeatherType then
if validWeatherType then
TriggerClientEvent('vSync:notify', source, 'Weather will change to: ~y~' .. string.lower(args[1]) .. "~s~.")
TriggerClientEvent('vSync:notify', source, 'Weather will change to: ~y~' .. string.lower(args[1]) .. "~s~.")
CurrentWeather = string.upper(args[1])
CurrentWeather = string.upper(args[1])
newWeatherTimer = 10
newWeatherTimer = 10
TriggerEvent('vSync:requestSync')
TriggerEvent('vSync:requestSync')
else
else
TriggerClientEvent('chatMessage', source, '', {255,255,255}, '^8Error: ^1Invalid weather type, valid weather types are: ^0\nEXTRASUNNY CLEAR NEUTRAL SMOG FOGGY OVERCAST CLOUDS CLEARING RAIN THUNDER SNOW BLIZZARD SNOWLIGHT XMAS HALLOWEEN ')
TriggerClientEvent('chatMessage', source, '', {255,255,255}, '^8Error: ^1Invalid weather type, valid weather types are: ^0\nEXTRASUNNY CLEAR NEUTRAL SMOG FOGGY OVERCAST CLOUDS CLEARING RAIN THUNDER SNOW BLIZZARD SNOWLIGHT XMAS HALLOWEEN ')
end
end
end
end
else
else
TriggerClientEvent('chatMessage', source, '', {255,255,255}, '^8Error: ^1You do not have access to that command.')
TriggerClientEvent('chatMessage', source, '', {255,255,255}, '^8Error: ^1You do not have access to that command.')
print('Access for command /weather denied.')
print('Access for command /weather denied.')
end
end
end
end
end, false)
end, false)
RegisterCommand('blackout', function(source)
RegisterCommand('blackout', function(source)
if source == 0 then
if source == 0 then
blackout = not blackout
blackout = not blackout
if blackout then
if blackout then
print("Blackout is now enabled.")
print("Blackout is now enabled.")
else
else
print("Blackout is now disabled.")
print("Blackout is now disabled.")
end
end
else
else
if isAllowedToChange(source) then
if isAllowedToChange(source) then
blackout = not blackout
blackout = not blackout
if blackout then
if blackout then
TriggerClientEvent('vSync:notify', source, 'Blackout is now ~b~enabled~s~.')
TriggerClientEvent('vSync:notify', source, 'Blackout is now ~b~enabled~s~.')
else
else
TriggerClientEvent('vSync:notify', source, 'Blackout is now ~r~disabled~s~.')
TriggerClientEvent('vSync:notify', source, 'Blackout is now ~r~disabled~s~.')
end
end
TriggerEvent('vSync:requestSync')
TriggerEvent('vSync:requestSync')
end
end
end
end
end)
end)
RegisterCommand('morning', function(source)
RegisterCommand('morning', function(source)
if source == 0 then
if source == 0 then
print("For console, use the \"/time <hh> <mm>\" command instead!")
print("For console, use the \"/time <hh> <mm>\" command instead!")
return
return
end
end
if isAllowedToChange(source) then
if isAllowedToChange(source) then
ShiftToMinute(0)
ShiftToMinute(0)
ShiftToHour(9)
ShiftToHour(9)
TriggerClientEvent('vSync:notify', source, 'Time set to ~y~morning~s~.')
TriggerClientEvent('vSync:notify', source, 'Time set to ~y~morning~s~.')
TriggerEvent('vSync:requestSync')
TriggerEvent('vSync:requestSync')
end
end
end)
end)
RegisterCommand('noon', function(source)
RegisterCommand('noon', function(source)
if source == 0 then
if source == 0 then
print("For console, use the \"/time <hh> <mm>\" command instead!")
print("For console, use the \"/time <hh> <mm>\" command instead!")
return
return
end
end
if isAllowedToChange(source) then
if isAllowedToChange(source) then
ShiftToMinute(0)
ShiftToMinute(0)
ShiftToHour(12)
ShiftToHour(12)
TriggerClientEvent('vSync:notify', source, 'Time set to ~y~noon~s~.')
TriggerClientEvent('vSync:notify', source, 'Time set to ~y~noon~s~.')
TriggerEvent('vSync:requestSync')
TriggerEvent('vSync:requestSync')
end
end
end)
end)
RegisterCommand('evening', function(source)
RegisterCommand('evening', function(source)
if source == 0 then
if source == 0 then
print("For console, use the \"/time <hh> <mm>\" command instead!")
print("For console, use the \"/time <hh> <mm>\" command instead!")
return
return
end
end
if isAllowedToChange(source) then
if isAllowedToChange(source) then
ShiftToMinute(0)
ShiftToMinute(0)
ShiftToHour(18)
ShiftToHour(18)
TriggerClientEvent('vSync:notify', source, 'Time set to ~y~evening~s~.')
TriggerClientEvent('vSync:notify', source, 'Time set to ~y~evening~s~.')
TriggerEvent('vSync:requestSync')
TriggerEvent('vSync:requestSync')
end
end
end)
end)
RegisterCommand('night', function(source)
RegisterCommand('night', function(source)
if source == 0 then
if source == 0 then
print("For console, use the \"/time <hh> <mm>\" command instead!")
print("For console, use the \"/time <hh> <mm>\" command instead!")
return
return
end
end
if isAllowedToChange(source) then
if isAllowedToChange(source) then
ShiftToMinute(0)
ShiftToMinute(0)
ShiftToHour(23)
ShiftToHour(23)
TriggerClientEvent('vSync:notify', source, 'Time set to ~y~night~s~.')
TriggerClientEvent('vSync:notify', source, 'Time set to ~y~night~s~.')
TriggerEvent('vSync:requestSync')
TriggerEvent('vSync:requestSync')
end
end
end)
end)
function ShiftToMinute(minute)
function ShiftToMinute(minute)
timeOffset = timeOffset - ( ( (baseTime+timeOffset) % 60 ) - minute )
timeOffset = timeOffset - ( ( (baseTime+timeOffset) % 60 ) - minute )
end
end
function ShiftToHour(hour)
function ShiftToHour(hour)
timeOffset = timeOffset - ( ( ((baseTime+timeOffset)/60) % 24 ) - hour ) * 60
timeOffset = timeOffset - ( ( ((baseTime+timeOffset)/60) % 24 ) - hour ) * 60
end
end
RegisterCommand('time', function(source, args, rawCommand)
RegisterCommand('time', function(source, args, rawCommand)
if source == 0 then
if source == 0 then
if tonumber(args[1]) ~= nil and tonumber(args[2]) ~= nil then
if tonumber(args[1]) ~= nil and tonumber(args[2]) ~= nil then
local argh = tonumber(args[1])
local argh = tonumber(args[1])
local argm = tonumber(args[2])
local argm = tonumber(args[2])
if argh < 24 then
if argh < 24 then
ShiftToHour(argh)
ShiftToHour(argh)
else
else
ShiftToHour(0)
ShiftToHour(0)
end
end
if argm < 60 then
if argm < 60 then
ShiftToMinute(argm)
ShiftToMinute(argm)
else
else
ShiftToMinute(0)
ShiftToMinute(0)
end
end
print("Time has changed to " .. argh .. ":" .. argm .. ".")
print("Time has changed to " .. argh .. ":" .. argm .. ".")
TriggerEvent('vSync:requestSync')
TriggerEvent('vSync:requestSync')
else
else
print("Invalid syntax, correct syntax is: time <hour> <minute> !")
print("Invalid syntax, correct syntax is: time <hour> <minute> !")
end
end
elseif source ~= 0 then
elseif source ~= 0 then
if isAllowedToChange(source) then
if isAllowedToChange(source) then
if tonumber(args[1]) ~= nil and tonumber(args[2]) ~= nil then
if tonumber(args[1]) ~= nil and tonumber(args[2]) ~= nil then
local argh = tonumber(args[1])
local argh = tonumber(args[1])
local argm = tonumber(args[2])
local argm = tonumber(args[2])
if argh < 24 then
if argh < 24 then
ShiftToHour(argh)
ShiftToHour(argh)
else
else
ShiftToHour(0)
ShiftToHour(0)
end
end
if argm < 60 then
if argm < 60 then
ShiftToMinute(argm)
ShiftToMinute(argm)
else
else
ShiftToMinute(0)
ShiftToMinute(0)
end
end
local newtime = math.floor(((baseTime+timeOffset)/60)%24) .. ":"
local newtime = math.floor(((baseTime+timeOffset)/60)%24) .. ":"
local minute = math.floor((baseTime+timeOffset)%60)
local minute = math.floor((baseTime+timeOffset)%60)
if minute < 10 then
if minute < 10 then
newtime = newtime .. "0" .. minute
newtime = newtime .. "0" .. minute
else
else
newtime = newtime .. minute
newtime = newtime .. minute
end
end
TriggerClientEvent('vSync:notify', source, 'Time was changed to: ~y~' .. newtime .. "~s~!")
TriggerClientEvent('vSync:notify', source, 'Time was changed to: ~y~' .. newtime .. "~s~!")
TriggerEvent('vSync:requestSync')
TriggerEvent('vSync:requestSync')
else
else
TriggerClientEvent('chatMessage', source, '', {255,255,255}, '^8Error: ^1Invalid syntax. Use ^0/time <hour> <minute> ^1instead!')
TriggerClientEvent('chatMessage', source, '', {255,255,255}, '^8Error: ^1Invalid syntax. Use ^0/time <hour> <minute> ^1instead!')
end
end
else
else
TriggerClientEvent('chatMessage', source, '', {255,255,255}, '^8Error: ^1You do not have access to that command.')
TriggerClientEvent('chatMessage', source, '', {255,255,255}, '^8Error: ^1You do not have access to that command.')
print('Access for command /time denied.')
print('Access for command /time denied.')
end
end
end
end
end)
end)
Citizen.CreateThread(function()
Citizen.CreateThread(function()
while true do
while true do
Citizen.Wait(0)
Citizen.Wait(0)
local newBaseTime = os.time(os.date("!*t"))/2 + 360
local newBaseTime = os.time(os.date("!*t"))/2 + 360
if freezeTime then
if freezeTime then
timeOffset = timeOffset + baseTime - newBaseTime
timeOffset = timeOffset + baseTime - newBaseTime
end
end
baseTime = newBaseTime
baseTime = newBaseTime
end
end
end)
end)
Citizen.CreateThread(function()
Citizen.CreateThread(function()
while true do
while true do
Citizen.Wait(5000)
Citizen.Wait(5000)
TriggerClientEvent('vSync:updateTime', -1, baseTime, timeOffset, freezeTime)
TriggerClientEvent('vSync:updateTime', -1, baseTime, timeOffset, freezeTime)
end
end
end)
end)
Citizen.CreateThread(function()
Citizen.CreateThread(function()
while true do
while true do
Citizen.Wait(300000)
Citizen.Wait(300000)
TriggerClientEvent('vSync:updateWeather', -1, CurrentWeather, blackout)
TriggerClientEvent('vSync:updateWeather', -1, CurrentWeather, blackout)
end
end
end)
end)
Citizen.CreateThread(function()
Citizen.CreateThread(function()
while true do
while true do
newWeatherTimer = newWeatherTimer - 1
newWeatherTimer = newWeatherTimer - 1
Citizen.Wait(60000)
Citizen.Wait(60000)
if newWeatherTimer == 0 then
if newWeatherTimer == 0 then
if DynamicWeather then
if DynamicWeather then
NextWeatherStage()
NextWeatherStage()
end
end
newWeatherTimer = 10
newWeatherTimer = 10
end
end
end
end
end)
end)
function NextWeatherStage()
function NextWeatherStage()
if CurrentWeather == "CLEAR" or CurrentWeather == "CLOUDS" or CurrentWeather == "EXTRASUNNY" then
if CurrentWeather == "CLEAR" or CurrentWeather == "CLOUDS" or CurrentWeather == "EXTRASUNNY" then
local new = math.random(1,2)
local new = math.random(1,2)
if new == 1 then
if new == 1 then
CurrentWeather = "CLEARING"
CurrentWeather = "CLEARING"
else
else
CurrentWeather = "OVERCAST"
CurrentWeather = "OVERCAST"
end
end
elseif CurrentWeather == "CLEARING" or CurrentWeather == "OVERCAST" then
elseif CurrentWeather == "CLEARING" or CurrentWeather == "OVERCAST" then
local new = math.random(1,6)
local new = math.random(1,6)
if new == 1 then
if new == 1 then
if CurrentWeather == "CLEARING" then CurrentWeather = "FOGGY" else CurrentWeather = "RAIN" end
if CurrentWeather == "CLEARING" then CurrentWeather = "FOGGY" else CurrentWeather = "RAIN" end
elseif new == 2 then
elseif new == 2 then
CurrentWeather = "CLOUDS"
CurrentWeather = "CLOUDS"
elseif new == 3 then
elseif new == 3 then
CurrentWeather = "CLEAR"
CurrentWeather = "CLEAR"
elseif new == 4 then
elseif new == 4 then
CurrentWeather = "EXTRASUNNY"
CurrentWeather = "EXTRASUNNY"
elseif new == 5 then
elseif new == 5 then
CurrentWeather = "SMOG"
CurrentWeather = "SMOG"
else
else
CurrentWeather = "FOGGY"
CurrentWeather = "FOGGY"
end
end
elseif CurrentWeather == "THUNDER" or CurrentWeather == "RAIN" then
elseif CurrentWeather == "THUNDER" or CurrentWeather == "RAIN" then
CurrentWeather = "CLEARING"
CurrentWeather = "CLEARING"
elseif CurrentWeather == "SMOG" or CurrentWeather == "FOGGY" then
elseif CurrentWeather == "SMOG" or CurrentWeather == "FOGGY" then
CurrentWeather = "CLEAR"
CurrentWeather = "CLEAR"
end
end
TriggerEvent("vSync:requestSync")
TriggerEvent("vSync:requestSync")
if debugprint then
if debugprint then
print("[vSync] New random weather type has been generated: " .. CurrentWeather .. ".\n")
print("[vSync] New random weather type has been generated: " .. CurrentWeather .. ".\n")
print("[vSync] Resetting timer to 10 minutes.\n")
print("[vSync] Resetting timer to 10 minutes.\n")
end
end
end
end
Copy
Copied
Copy
Copied
Saved diffs
Original text
Open file
------------------ change this ------------------- admins = { 'steam:110000105959047', --'license:1234975143578921327', } -- Set this to false if you don't want the weather to change automatically every 10 minutes. DynamicWeather = true -------------------------------------------------- debugprint = false -- don't touch this unless you know what you're doing or you're being asked by Vespura to turn this on. -------------------------------------------------- -------------------- DON'T CHANGE THIS -------------------- AvailableWeatherTypes = { 'EXTRASUNNY', 'CLEAR', 'NEUTRAL', 'SMOG', 'FOGGY', 'OVERCAST', 'CLOUDS', 'CLEARING', 'RAIN', 'THUNDER', 'SNOW', 'BLIZZARD', 'SNOWLIGHT', 'XMAS', 'HALLOWEEN', } CurrentWeather = "EXTRASUNNY" local baseTime = 0 local timeOffset = 0 local freezeTime = false local blackout = false local newWeatherTimer = 10 RegisterServerEvent('vSync:requestSync') AddEventHandler('vSync:requestSync', function() TriggerClientEvent('vSync:updateWeather', -1, CurrentWeather, blackout) TriggerClientEvent('vSync:updateTime', -1, baseTime, timeOffset, freezeTime) end) function isAllowedToChange(player) local allowed = false for i,id in ipairs(admins) do for x,pid in ipairs(GetPlayerIdentifiers(player)) do if debugprint then print('admin id: ' .. id .. '\nplayer id:' .. pid) end if string.lower(pid) == string.lower(id) then allowed = true end end end return allowed end RegisterCommand('freezetime', function(source, args) if source ~= 0 then if isAllowedToChange(source) then freezeTime = not freezeTime if freezeTime then TriggerClientEvent('vSync:notify', source, 'Time is now ~b~frozen~s~.') else TriggerClientEvent('vSync:notify', source, 'Time is ~y~no longer frozen~s~.') end else TriggerClientEvent('chatMessage', source, '', {255,255,255}, '^8Error: ^1You are not allowed to use this command.') end else freezeTime = not freezeTime if freezeTime then print("Time is now frozen.") else print("Time is no longer frozen.") end end end) RegisterCommand('freezeweather', function(source, args) if source ~= 0 then if isAllowedToChange(source) then DynamicWeather = not DynamicWeather if not DynamicWeather then TriggerClientEvent('vSync:notify', source, 'Dynamic weather changes are now ~r~disabled~s~.') else TriggerClientEvent('vSync:notify', source, 'Dynamic weather changes are now ~b~enabled~s~.') end else TriggerClientEvent('chatMessage', source, '', {255,255,255}, '^8Error: ^1You are not allowed to use this command.') end else DynamicWeather = not DynamicWeather if not DynamicWeather then print("Weather is now frozen.") else print("Weather is no longer frozen.") end end end) RegisterCommand('weather', function(source, args) if source == 0 then local validWeatherType = false if args[1] == nil then print("Invalid syntax, correct syntax is: /weather <weathertype> ") return else for i,wtype in ipairs(AvailableWeatherTypes) do if wtype == string.upper(args[1]) then validWeatherType = true end end if validWeatherType then print("Weather has been updated.") CurrentWeather = string.upper(args[1]) newWeatherTimer = 10 TriggerEvent('vSync:requestSync') else print("Invalid weather type, valid weather types are: \nEXTRASUNNY CLEAR NEUTRAL SMOG FOGGY OVERCAST CLOUDS CLEARING RAIN THUNDER SNOW BLIZZARD SNOWLIGHT XMAS HALLOWEEN ") end end else if isAllowedToChange(source) then local validWeatherType = false if args[1] == nil then TriggerClientEvent('chatMessage', source, '', {255,255,255}, '^8Error: ^1Invalid syntax, use ^0/weather <weatherType> ^1instead!') else for i,wtype in ipairs(AvailableWeatherTypes) do if wtype == string.upper(args[1]) then validWeatherType = true end end if validWeatherType then TriggerClientEvent('vSync:notify', source, 'Weather will change to: ~y~' .. string.lower(args[1]) .. "~s~.") CurrentWeather = string.upper(args[1]) newWeatherTimer = 10 TriggerEvent('vSync:requestSync') else TriggerClientEvent('chatMessage', source, '', {255,255,255}, '^8Error: ^1Invalid weather type, valid weather types are: ^0\nEXTRASUNNY CLEAR NEUTRAL SMOG FOGGY OVERCAST CLOUDS CLEARING RAIN THUNDER SNOW BLIZZARD SNOWLIGHT XMAS HALLOWEEN ') end end else TriggerClientEvent('chatMessage', source, '', {255,255,255}, '^8Error: ^1You do not have access to that command.') print('Access for command /weather denied.') end end end, false) RegisterCommand('blackout', function(source) if source == 0 then blackout = not blackout if blackout then print("Blackout is now enabled.") else print("Blackout is now disabled.") end else if isAllowedToChange(source) then blackout = not blackout if blackout then TriggerClientEvent('vSync:notify', source, 'Blackout is now ~b~enabled~s~.') else TriggerClientEvent('vSync:notify', source, 'Blackout is now ~r~disabled~s~.') end TriggerEvent('vSync:requestSync') end end end) RegisterCommand('morning', function(source) if source == 0 then print("For console, use the \"/time <hh> <mm>\" command instead!") return end if isAllowedToChange(source) then ShiftToMinute(0) ShiftToHour(9) TriggerClientEvent('vSync:notify', source, 'Time set to ~y~morning~s~.') TriggerEvent('vSync:requestSync') end end) RegisterCommand('noon', function(source) if source == 0 then print("For console, use the \"/time <hh> <mm>\" command instead!") return end if isAllowedToChange(source) then ShiftToMinute(0) ShiftToHour(12) TriggerClientEvent('vSync:notify', source, 'Time set to ~y~noon~s~.') TriggerEvent('vSync:requestSync') end end) RegisterCommand('evening', function(source) if source == 0 then print("For console, use the \"/time <hh> <mm>\" command instead!") return end if isAllowedToChange(source) then ShiftToMinute(0) ShiftToHour(18) TriggerClientEvent('vSync:notify', source, 'Time set to ~y~evening~s~.') TriggerEvent('vSync:requestSync') end end) RegisterCommand('night', function(source) if source == 0 then print("For console, use the \"/time <hh> <mm>\" command instead!") return end if isAllowedToChange(source) then ShiftToMinute(0) ShiftToHour(23) TriggerClientEvent('vSync:notify', source, 'Time set to ~y~night~s~.') TriggerEvent('vSync:requestSync') end end) function ShiftToMinute(minute) timeOffset = timeOffset - ( ( (baseTime+timeOffset) % 60 ) - minute ) end function ShiftToHour(hour) timeOffset = timeOffset - ( ( ((baseTime+timeOffset)/60) % 24 ) - hour ) * 60 end RegisterCommand('time', function(source, args, rawCommand) if source == 0 then if tonumber(args[1]) ~= nil and tonumber(args[2]) ~= nil then local argh = tonumber(args[1]) local argm = tonumber(args[2]) if argh < 24 then ShiftToHour(argh) else ShiftToHour(0) end if argm < 60 then ShiftToMinute(argm) else ShiftToMinute(0) end print("Time has changed to " .. argh .. ":" .. argm .. ".") TriggerEvent('vSync:requestSync') else print("Invalid syntax, correct syntax is: time <hour> <minute> !") end elseif source ~= 0 then if isAllowedToChange(source) then if tonumber(args[1]) ~= nil and tonumber(args[2]) ~= nil then local argh = tonumber(args[1]) local argm = tonumber(args[2]) if argh < 24 then ShiftToHour(argh) else ShiftToHour(0) end if argm < 60 then ShiftToMinute(argm) else ShiftToMinute(0) end local newtime = math.floor(((baseTime+timeOffset)/60)%24) .. ":" local minute = math.floor((baseTime+timeOffset)%60) if minute < 10 then newtime = newtime .. "0" .. minute else newtime = newtime .. minute end TriggerClientEvent('vSync:notify', source, 'Time was changed to: ~y~' .. newtime .. "~s~!") TriggerEvent('vSync:requestSync') else TriggerClientEvent('chatMessage', source, '', {255,255,255}, '^8Error: ^1Invalid syntax. Use ^0/time <hour> <minute> ^1instead!') end else TriggerClientEvent('chatMessage', source, '', {255,255,255}, '^8Error: ^1You do not have access to that command.') print('Access for command /time denied.') end end end) Citizen.CreateThread(function() while true do Citizen.Wait(0) local newBaseTime = os.time(os.date("!*t"))/2 + 360 if freezeTime then timeOffset = timeOffset + baseTime - newBaseTime end baseTime = newBaseTime end end) Citizen.CreateThread(function() while true do Citizen.Wait(5000) TriggerClientEvent('vSync:updateTime', -1, baseTime, timeOffset, freezeTime) end end) Citizen.CreateThread(function() while true do Citizen.Wait(300000) TriggerClientEvent('vSync:updateWeather', -1, CurrentWeather, blackout) end end) Citizen.CreateThread(function() while true do newWeatherTimer = newWeatherTimer - 1 Citizen.Wait(60000) if newWeatherTimer == 0 then if DynamicWeather then NextWeatherStage() end newWeatherTimer = 10 end end end) function NextWeatherStage() if CurrentWeather == "CLEAR" or CurrentWeather == "CLOUDS" or CurrentWeather == "EXTRASUNNY" then local new = math.random(1,2) if new == 1 then CurrentWeather = "CLEARING" else CurrentWeather = "OVERCAST" end elseif CurrentWeather == "CLEARING" or CurrentWeather == "OVERCAST" then local new = math.random(1,6) if new == 1 then if CurrentWeather == "CLEARING" then CurrentWeather = "FOGGY" else CurrentWeather = "RAIN" end elseif new == 2 then CurrentWeather = "CLOUDS" elseif new == 3 then CurrentWeather = "CLEAR" elseif new == 4 then CurrentWeather = "EXTRASUNNY" elseif new == 5 then CurrentWeather = "SMOG" else CurrentWeather = "FOGGY" end elseif CurrentWeather == "THUNDER" or CurrentWeather == "RAIN" then CurrentWeather = "CLEARING" elseif CurrentWeather == "SMOG" or CurrentWeather == "FOGGY" then CurrentWeather = "CLEAR" end TriggerEvent("vSync:requestSync") if debugprint then print("[vSync] New random weather type has been generated: " .. CurrentWeather .. ".\n") print("[vSync] Resetting timer to 10 minutes.\n") end end
Changed text
Open file
-- Set this to false if you don't want the weather to change automatically every 10 minutes. DynamicWeather = true -------------------------------------------------- debugprint = false -- don't touch this unless you know what you're doing or you're being asked by Vespura to turn this on. -------------------------------------------------- -------------------- DON'T CHANGE THIS -------------------- AvailableWeatherTypes = { 'EXTRASUNNY', 'CLEAR', 'NEUTRAL', 'SMOG', 'FOGGY', 'OVERCAST', 'CLOUDS', 'CLEARING', 'RAIN', 'THUNDER', 'SNOW', 'BLIZZARD', 'SNOWLIGHT', 'XMAS', 'HALLOWEEN', } local freezeTime = false local blackout = false local newWeatherTimer = 10 RegisterServerEvent('vSync:requestSync') AddEventHandler('vSync:requestSync', function() TriggerClientEvent('vSync:updateWeather', -1, CurrentWeather, blackout) TriggerClientEvent('vSync:updateTime', -1, baseTime, timeOffset, freezeTime) end) function isAllowedToChange(player) local allowed = false for i,id in ipairs(admins) do for x,pid in ipairs(GetPlayerIdentifiers(player)) do if debugprint then print('admin id: ' .. id .. '\nplayer id:' .. pid) end if string.lower(pid) == string.lower(id) then allowed = true end end end return allowed end RegisterCommand('freezetime', function(source, args) if source ~= 0 then if isAllowedToChange(source) then freezeTime = not freezeTime if freezeTime then TriggerClientEvent('vSync:notify', source, 'Time is now ~b~frozen~s~.') else TriggerClientEvent('vSync:notify', source, 'Time is ~y~no longer frozen~s~.') end else TriggerClientEvent('chatMessage', source, '', {255,255,255}, '^8Error: ^1You are not allowed to use this command.') end else freezeTime = not freezeTime if freezeTime then print("Time is now frozen.") else print("Time is no longer frozen.") end end end) RegisterCommand('freezeweather', function(source, args) if source ~= 0 then if isAllowedToChange(source) then DynamicWeather = not DynamicWeather if not DynamicWeather then TriggerClientEvent('vSync:notify', source, 'Dynamic weather changes are now ~r~disabled~s~.') else TriggerClientEvent('vSync:notify', source, 'Dynamic weather changes are now ~b~enabled~s~.') end else TriggerClientEvent('chatMessage', source, '', {255,255,255}, '^8Error: ^1You are not allowed to use this command.') end else DynamicWeather = not DynamicWeather if not DynamicWeather then print("Weather is now frozen.") else print("Weather is no longer frozen.") end end end) RegisterCommand('weather', function(source, args) if source == 0 then local validWeatherType = false if args[1] == nil then print("Invalid syntax, correct syntax is: /weather <weathertype> ") return else for i,wtype in ipairs(AvailableWeatherTypes) do if wtype == string.upper(args[1]) then validWeatherType = true end end if validWeatherType then print("Weather has been updated.") CurrentWeather = string.upper(args[1]) newWeatherTimer = 10 TriggerEvent('vSync:requestSync') else print("Invalid weather type, valid weather types are: \nEXTRASUNNY CLEAR NEUTRAL SMOG FOGGY OVERCAST CLOUDS CLEARING RAIN THUNDER SNOW BLIZZARD SNOWLIGHT XMAS HALLOWEEN ") end end else if isAllowedToChange(source) then local validWeatherType = false if args[1] == nil then TriggerClientEvent('chatMessage', source, '', {255,255,255}, '^8Error: ^1Invalid syntax, use ^0/weather <weatherType> ^1instead!') else for i,wtype in ipairs(AvailableWeatherTypes) do if wtype == string.upper(args[1]) then validWeatherType = true end end if validWeatherType then TriggerClientEvent('vSync:notify', source, 'Weather will change to: ~y~' .. string.lower(args[1]) .. "~s~.") CurrentWeather = string.upper(args[1]) newWeatherTimer = 10 TriggerEvent('vSync:requestSync') else TriggerClientEvent('chatMessage', source, '', {255,255,255}, '^8Error: ^1Invalid weather type, valid weather types are: ^0\nEXTRASUNNY CLEAR NEUTRAL SMOG FOGGY OVERCAST CLOUDS CLEARING RAIN THUNDER SNOW BLIZZARD SNOWLIGHT XMAS HALLOWEEN ') end end else TriggerClientEvent('chatMessage', source, '', {255,255,255}, '^8Error: ^1You do not have access to that command.') print('Access for command /weather denied.') end end end, false) RegisterCommand('blackout', function(source) if source == 0 then blackout = not blackout if blackout then print("Blackout is now enabled.") else print("Blackout is now disabled.") end else if isAllowedToChange(source) then blackout = not blackout if blackout then TriggerClientEvent('vSync:notify', source, 'Blackout is now ~b~enabled~s~.') else TriggerClientEvent('vSync:notify', source, 'Blackout is now ~r~disabled~s~.') end TriggerEvent('vSync:requestSync') end end end) RegisterCommand('morning', function(source) if source == 0 then print("For console, use the \"/time <hh> <mm>\" command instead!") return end if isAllowedToChange(source) then ShiftToMinute(0) ShiftToHour(9) TriggerClientEvent('vSync:notify', source, 'Time set to ~y~morning~s~.') TriggerEvent('vSync:requestSync') end end) RegisterCommand('noon', function(source) if source == 0 then print("For console, use the \"/time <hh> <mm>\" command instead!") return end if isAllowedToChange(source) then ShiftToMinute(0) ShiftToHour(12) TriggerClientEvent('vSync:notify', source, 'Time set to ~y~noon~s~.') TriggerEvent('vSync:requestSync') end end) RegisterCommand('evening', function(source) if source == 0 then print("For console, use the \"/time <hh> <mm>\" command instead!") return end if isAllowedToChange(source) then ShiftToMinute(0) ShiftToHour(18) TriggerClientEvent('vSync:notify', source, 'Time set to ~y~evening~s~.') TriggerEvent('vSync:requestSync') end end) RegisterCommand('night', function(source) if source == 0 then print("For console, use the \"/time <hh> <mm>\" command instead!") return end if isAllowedToChange(source) then ShiftToMinute(0) ShiftToHour(23) TriggerClientEvent('vSync:notify', source, 'Time set to ~y~night~s~.') TriggerEvent('vSync:requestSync') end end) function ShiftToMinute(minute) timeOffset = timeOffset - ( ( (baseTime+timeOffset) % 60 ) - minute ) end function ShiftToHour(hour) timeOffset = timeOffset - ( ( ((baseTime+timeOffset)/60) % 24 ) - hour ) * 60 end RegisterCommand('time', function(source, args, rawCommand) if source == 0 then if tonumber(args[1]) ~= nil and tonumber(args[2]) ~= nil then local argh = tonumber(args[1]) local argm = tonumber(args[2]) if argh < 24 then ShiftToHour(argh) else ShiftToHour(0) end if argm < 60 then ShiftToMinute(argm) else ShiftToMinute(0) end print("Time has changed to " .. argh .. ":" .. argm .. ".") TriggerEvent('vSync:requestSync') else print("Invalid syntax, correct syntax is: time <hour> <minute> !") end elseif source ~= 0 then if isAllowedToChange(source) then if tonumber(args[1]) ~= nil and tonumber(args[2]) ~= nil then local argh = tonumber(args[1]) local argm = tonumber(args[2]) if argh < 24 then ShiftToHour(argh) else ShiftToHour(0) end if argm < 60 then ShiftToMinute(argm) else ShiftToMinute(0) end local newtime = math.floor(((baseTime+timeOffset)/60)%24) .. ":" local minute = math.floor((baseTime+timeOffset)%60) if minute < 10 then newtime = newtime .. "0" .. minute else newtime = newtime .. minute end TriggerClientEvent('vSync:notify', source, 'Time was changed to: ~y~' .. newtime .. "~s~!") TriggerEvent('vSync:requestSync') else TriggerClientEvent('chatMessage', source, '', {255,255,255}, '^8Error: ^1Invalid syntax. Use ^0/time <hour> <minute> ^1instead!') end else TriggerClientEvent('chatMessage', source, '', {255,255,255}, '^8Error: ^1You do not have access to that command.') print('Access for command /time denied.') end end end) Citizen.CreateThread(function() while true do Citizen.Wait(0) local newBaseTime = os.time(os.date("!*t"))/2 + 360 if freezeTime then timeOffset = timeOffset + baseTime - newBaseTime end baseTime = newBaseTime end end) Citizen.CreateThread(function() while true do Citizen.Wait(5000) TriggerClientEvent('vSync:updateTime', -1, baseTime, timeOffset, freezeTime) end end) Citizen.CreateThread(function() while true do Citizen.Wait(300000) TriggerClientEvent('vSync:updateWeather', -1, CurrentWeather, blackout) end end) Citizen.CreateThread(function() while true do newWeatherTimer = newWeatherTimer - 1 Citizen.Wait(60000) if newWeatherTimer == 0 then if DynamicWeather then NextWeatherStage() end newWeatherTimer = 10 end end end) function NextWeatherStage() if CurrentWeather == "CLEAR" or CurrentWeather == "CLOUDS" or CurrentWeather == "EXTRASUNNY" then local new = math.random(1,2) if new == 1 then CurrentWeather = "CLEARING" else CurrentWeather = "OVERCAST" end elseif CurrentWeather == "CLEARING" or CurrentWeather == "OVERCAST" then local new = math.random(1,6) if new == 1 then if CurrentWeather == "CLEARING" then CurrentWeather = "FOGGY" else CurrentWeather = "RAIN" end elseif new == 2 then CurrentWeather = "CLOUDS" elseif new == 3 then CurrentWeather = "CLEAR" elseif new == 4 then CurrentWeather = "EXTRASUNNY" elseif new == 5 then CurrentWeather = "SMOG" else CurrentWeather = "FOGGY" end elseif CurrentWeather == "THUNDER" or CurrentWeather == "RAIN" then CurrentWeather = "CLEARING" elseif CurrentWeather == "SMOG" or CurrentWeather == "FOGGY" then CurrentWeather = "CLEAR" end TriggerEvent("vSync:requestSync") if debugprint then print("[vSync] New random weather type has been generated: " .. CurrentWeather .. ".\n") print("[vSync] Resetting timer to 10 minutes.\n") end end
Find difference