Simple Blackout (NP Inspired)

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-

  1. Gets triggered after every 10minutes, (you can definitely change the timing to an hour or something)
  2. choose random number to miss or do a blackout (if missed, then there will not be a blackout for that time)
  3. 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.

Preview-
848514ab134a508ed74cc3dd0360ce72

303c0515e7560edbd4b9ec285f867483

Download-

Other Projects -
Nopixel Inspired Voting UI - Np Inspired Voting UI

|-------------------------------------|----------------------------|
| Code is accessible | Yes |
| Subscription-based | No |
|Lines (approximately) |50-60 |
| Requirements | Chat or Notification dependency|
| Support | Yes |

4 Likes

can we check if its blackout or not?

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.

1 Like

I think they mean like a export of is blackout active for other scripts to use. IE radios, phones, ATM’s

2 Likes

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

1 Like

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
image

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)

@aymannajim did you checked the server script? i think you didn’t… there is already a thread there and it just triggers the client event.

did u even try the script? Trust me, you need a client loop for those 2 natives to work :upside_down_face:

@an-services well i tried it on my friends server, it works fine for me but yaa appreciate for your review

Can you share us the chat script you have?

it is for np-base

Sorry, I’m a novice. How can I start the script? Thank you very much

is there a way to manualy trigger it like/blackout

how do you even use it? whats the command?

there is no command for it… This script is designed in a way that every hour there is a 50/50 chances that it randomly go blackout (check server thread) but you can easily add any command instead of thread if you have little knowledge, or else reply back i will help you more <3

Yes I have little knowledge so some help would be nice to add a command.