[Release] Additional Server Synchronization and ACL [1.0.6]

Yep, I looked at the code and I can immediately see why.

Anyway, for the time being, you can use /blackout without any arguments to turn it off again.

If you or anyone want to make the change to make the argument work, change:

ASData.blackout = not not tonumber( table.remove( args, 1 ) )

to

ASData.blackout = tonumber( table.remove( args, 1 ) ) ~= 0 and true or false

1 Like

Thanks for the reply, Your suggestion worked!

I am now attempting to create a script which would check what time it is (in game) and @ 7am i want to script to trigger a event.

So far i have added only 1 .lua in the client folder which contains the following script:

RegisterNetEvent(‘MSQPlaySound’)
local MSQPlaySound = true

AddEventHandler(‘MSQPlaySound’, function(time)
Citizen.CreateThread(function()
while true do
Citizen.Wait(1)
if ASData.time.h = 7 then
TriggerEvent(‘example’)
end
end)
end)

**If anyone has the time, can you please review the above and let me know what im missing?

Remove that function entirely. Go to the client’s additional-sync.lua, find the thread function -- In-game Clock Manipulation Loop. You’ll want it to look something like the following:

-- In-game Clock Manipulation Loop
Citizen.CreateThread( function()
	while not hasBeenInitialised do
		Wait( 500 )
	end
	
	local timeBuffer = 0.0
	local triggered7amToday = false
	local triggered8amToday = false
	
	while true do
		Wait( 33 ) -- (int)(GetMillisecondsPerGameMinute() / 60)
		
		if not ASData.time.frozen then
			local gameSecond = 33.333 / ASData.time.rates.night
			
			if secondOfDay >= 19800 and secondOfDay <= 75600 then
				gameSecond = 33.333 / ASData.time.rates.day
			end
			
			timeBuffer = timeBuffer + round( 33.0 / gameSecond, 0 )
			
			if timeBuffer >= 1.0 then
				local skipSeconds = math.floor( timeBuffer )
				
				timeBuffer = timeBuffer - skipSeconds
				secondOfDay = secondOfDay + skipSeconds
				
				if secondOfDay >= 86400 then
					secondOfDay = secondOfDay % 86400
				end
			end
		end
		
		-- Apply time
		ASData.time.h = math.floor( secondOfDay / 3600 )
		ASData.time.m = math.floor( (secondOfDay - (ASData.time.h * 3600)) / 60 )
		ASData.time.s = secondOfDay - (ASData.time.h * 3600) - (ASData.time.m * 60)
		
		NetworkOverrideClockTime( ASData.time.h, ASData.time.m, ASData.time.s )
		
		-- Trigger time based events
		if ASData.time.h == 7 and ASData.time.m == 0 and triggered7amToday == false then
			triggered7amToday = true;
			TriggerEvent( "My7amEvent" );
		elseif ASData.time.h == 7 and ASData.time.m > 0 then
			triggered7amToday = false;
		end
		
		if ASData.time.h == 8 and ASData.time.m == 0 and triggered8amToday == false then
			triggered8amToday = true;
			TriggerEvent( "My8amEvent" );
		elseif ASData.time.h == 8 and ASData.time.m > 0 then
			triggered8amToday = false;
		end
	end
end)

It’s coded like this because you probably want the event to fire only once, and with the time rate in mind, it’s possible to skip seconds, that’s why you reset the variable when it’s safe to do so (when the minute has passed) so it won’t get called twice that day. You’ll still have to make your “My7amEvent” etc. yourself


1 Like

Hi !

With es_roleplay, i have a weird and unconfortable bug. The game “blink” and “flash” sometimes ( like all the 20 sec), when i disable ACL, it’s gone.

Someone can help me with that ? I really need this script for whitelisting with SteamID

Update ! I tried to record the bug, and i think with what i found can help me to resolve the problem. The time set to to night like 0.3ms, and i don’t know why. I remove all the sync related in es_roleplay, but still happenning. I REALLY need you’re help guys ! :confused:

Video proof : https://www.youtube.com/watch?v=M0vtEf-MCBc

Screen taken in the record :

1 Like

Good day,

I wanted to ask if you could please point me to what string is syncing time as players are stating they are not syncing.

EDIT: My server is currently running 1.0.6

I’m assuming its the MSQASInit ?

Thanks in advance!

@Ryload I don’t know anything about es_roleplay but if it’s doing its own synchronization you really do need to disable that entirely (video is unavailable for me).

@J_Sickness Players should be syncing. The leading variable on the server is secondsOfDay. You are correct that MSQASInit initializes the client on spawn.

1 Like

Oh yeah sorry about the video, private Youtube shit
 Well i tried to disable everything about sync in es_roleplay but even with that it didn’t work :frowning:

Quick update - i got the time sync officially working on my server!
All i did was change line 174 in the (\client\additonal-sync.lua) from

AddEventHandler( “onClientMapStart”, function()

to

AddEventHandler( “OnClientMapStart”, function()

So you cancel the first modification ? (Msq thing)

Yes, i just deleted that comment in efforts to prevent confusion.

1 Like

There is a “No wanted level script” [Release] Disable Wanted Level

Otherwise, i would assume that you would need to find the hash for each type of police and then force disable them on the server - similar to what is scripted for the no peds in this script.

Time and weather command doesn’t work anymore for me. Am i the only one ?

I wondering if it is possible to disable the time sync, but enable the traffic control?
How can i do that?

Time Sync doesn’t work, someone have a FIX ?

what is not working? the server is by night?

The Time is notre synced, somme players have day thé other players have night

i’ve the same issue, if i put day, all people already here will have day, but newly arrived peoples will have night. that’s why i would like remove time sync but keep others functionalities of this mod.
Edit: work now perfectly with the v1.0.6 and admins IP replaced! Also you have to be admin to use any commands otherwise it don’t work.

I installed the additional server sync in my server resources, added it to citmp-server, but ingame, when I use chat (T) and
write for example /playerstatus or /time NIGHT nothing happens and in the RCom panel this appears:

error during NUI callback chatResult: citizen:/scripting/lua/scheduler.lua243: bad argument #1 to ‘unpack’ (table expected got nil)

Hello guys, thx for this awesome release MsQerade.
I have a litte problem and I don’t know where to check.
Every new player can join when I add the steam ID they have.

Everything work, every player, except one, I tried to put him at the top, at the middle of the list, I have a “,” at every line except the last.
All player can connect except him, he has steam opening and when he try to connect he has the message “this is a private server, 
” but in the console its the same ID steam in the file.
here is my ACL config and the console when he connect.
Its Meteorys in the file and Materiax in the console.

So where is the problem ? his steam app, his five M, our serveur?