Right now, I’m using SetArtificialLightsState(true) on clients loading into the server - but the lights aren’t actually going out. Do I need to add more to this or am I going about this the wrong way entirely?
This is the right way.
Don’t forget SetArtificialLightsStateAffectsVehicles
for preventing vehiclelights to shutdown, too.
Are you using some weather- or timesync script?
Often they set this native manually.
You can try to put SetArtificialLightsState
in a testfunction to set it to true, while you are ingame and check, if there is some difference.
How does one do that in a test function? Just create a script that only does that on initiation?
Put this in some clientscript and start it. Then press “E” and take a look at your console, if there is the message “Lights are going down” and if the lights are out.
If there is the message, but the lights are always on, then you have an other script on your server, that sets the lightstate.
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
if IsControlJustReleased(0, 38) then
SetArtificialLightsState(true)
print('Lights are going down')
end
end
end)
With your script I’m seeing that when the lights go off - they seem to immediately go back on again. Is there a way to keep them off until disconnecting?
nvm, fixed it. Thank you for the help @NovaHorizon