[NEED HELP] How set BLACKOUT by zone


#1

Hi everyone, i need help please !

I want to create a script for set Blackout by zone but i dont know how to do that… I have take vSync ressource for see what value set blackout. I’ve find this in code :


CLIENT SCRIPT:

Citizen.CreateThread(function()
    while true do
        if lastWeather ~= CurrentWeather then
            lastWeather = CurrentWeather
            SetWeatherTypeOverTime(CurrentWeather, 15.0)
            Citizen.Wait(15000)
        end
        Citizen.Wait(100) -- Wait 0 seconds to prevent crashing.
        SetBlackout(blackout)
        ClearOverrideWeather()
        ClearWeatherTypePersist()
        SetWeatherTypePersist(lastWeather)
        SetWeatherTypeNow(lastWeather)
        SetWeatherTypeNowPersist(lastWeather)
        if lastWeather == 'XMAS' then
            SetForceVehicleTrails(true)
            SetForcePedFootstepsTracks(true)
        else
            SetForceVehicleTrails(false)
            SetForcePedFootstepsTracks(false)
        end
    end
end)

SERVER SCRIPT :

local blackout = true

AddEventHandler('vSync:requestSync', function()
    TriggerClientEvent('vSync:updateWeather', -1, CurrentWeather, blackout)
    TriggerClientEvent('vSync:updateTime', -1, baseTime, timeOffset, freezeTime)
end)

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)

Citizen.CreateThread(function()
    while true do
        Citizen.Wait(300000)
        TriggerClientEvent('vSync:updateWeather', -1, CurrentWeather, blackout)
    end
end)

For moment, scipt work like this :
Blackout is always active , when i write “/blackout” blackout set off

I want script do this :
Blackout always active on all the map but, some zone have blackout set off.

I have 2 question. First, how can i set zone for blackout off ? 2nd, When blackout is on, is disable car light … How enable car light when blackout on ?

Sorry for my English, thanks for the attention, best regards :v:


#2

Its technically a weather type I believe which affects the whole level (map). So unless you shut off every light by region via some other means that wont work. It shuts off every light including car lights too.


#3

I understand what you say, i have an idea ! If i stream empty light (texture or whatever used by light in city) and i replace the current light texture by this stream empty texture ?

It’s possible to do that with stream folder ? If yes, what i write in __resource.lua for stream this type of texture ?


#4

You’ll need to check the player’s position and check the zone their in. Then either enable or disable blackout based on their zone. This will cause hard-changes between zones though.

That’s the way that native works. There’s no way to enable vehicle lights when blackout mode is active. That’s just how gta v works.


#5

“You’ll need to check the player’s position and check the zone their in. Then either enable or disable blackout based on their zone. This will cause hard-changes between zones though.”

It’s not what i want, if i do this, when player come in zone, all light of all the map is turn on but i want only the zone set.

Thanks anyway

I think need to find other way than Blackout for do this…

do you know how work light in game ? It’s a texture or another like that ?


#6

You can’t set blackout for certain regions, it has to be map-wide. I’m not sure if there is even a way to do this at all. Don’t think textures will work.