How do you set the time? With the commands provided, or with the reborn trainer/lambda menu? Any other mods that could possibly intervene with the time commands?
Already looking into the night issue, however if you set the time with the /time command then this should apply for everybody, even to newly connected players.
@MJRamon
In the server’s additional-sync.lua, change the third line to: local secondOfDay = (ASData.time.h * 3600) + (ASData.time.m * 60) + ASData.time.s
I change time on server with your command. /time NOON by example.
It works for everybody already here, but newly arrived players are still under night and have to pop the day again for everybody.
Hey, so i downloaded this script and everything was working fine.
Then something happened, the whitelist doesn’t work and none of the in game commands work either
It also shows in your server window/log when you try to connect and you get denied.
@the_welsh_vader
Hmm. Is that an old version you’re running, or are the files tampered with? I see warnings that shouldn’t be there in the first place. Is this something you can reproduce? Also please try the new version (you can likely keep your config files).
I put the folders inside a folder called whitelisted in the resource folder and leave the config as is when downloaded.
I then go to citmp-server and add it to the list so the server knows its there, I start the server and the server is whitelisted and i’m unable to join. I then shut the server down and add an IP/steam id, delete the cache and restart the server. Then when someone who isn’t whitelisted on the server manages to join and I get that error every time someone does join.
Like I said before the script was working wonderfully and then something happened and now it doesn’t work at all. Do I need essential mode on the server for this script to work?
You don’t need essential mode. Do you know what that “something” is that happened? Would you mind zipping your folder and upload it, then send it to me (private message so any private data such as IPs won’t be public)? (Or for good measure, upload every resource you have if it’s not too big)
Good day, @MsQuerade
I am currently having an issue… when i black out the server i am unable to “stop the blackout”…
Using “blackout 1” vs “blackout 0” changes nothing.
*I am running the commands in IceCon - everything appears to be working except the blackout argument in regards to stopping the blackout.
Any suggestions would be greatly appreciated!
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…
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 !
@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.