Simple Blackout script inspired from Nopixel. You can change the time after which you want it to work. Feel free to contact for support and bug report.
Features inside script-
Gets triggered after every 10minutes, (you can definitely change the timing to an hour or something)
choose random number to miss or do a blackout (if missed, then there will not be a blackout for that time)
Power cut and automatic restore power after a specific timing which you can change in config.
Note- It is verified on Np Base but should work on every framework. Change the chat message to whatever notification you want.
Yes, there is already a check when it triggers… If Blackout is already there, it will not blackout again and it will dodge. I hope you will check and come back with the feedbacks.
nope, there isn’t any export for that as for the server i am working on, i am planning to link it with the database ut i will look into it i will get some time
Does this affect vehicle lights as well? We currently use vMenu’s blackout function when we want to RP power outages for storms and such but it also kills lights on vehicles. It may just be a limitation of the game but would like something that will cut streetlights/building lights/etc… but vehicle lights would still work properly.
Your script is broken because these two functions must run inside a loop
Lemme fix that for you real quick, replace your client.lua with this:
local isBlackedOut = false
RegisterNetEvent('blackout:clientblackout')
AddEventHandler('blackout:clientblackout', function(blackout)
isBlackedOut = blackout
SetArtificialLightsState(false)
end)
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
if isBlackedOut then
SetArtificialLightsStateAffectsVehicles(false)
SetArtificialLightsState(true)
end
end
end)