0


Благодарности/Неодобрения |
Получено: 1/0 Отправлено: 2/0 |
class TimeOfDay
description.ext
init.sqfКод:class Params { class TimeOfDay { title = "Time of Day"; values[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23}; texts[] = {"0000","0100","0200","0300","0400","0500","0600","0700","0800","0900","1000","1100","1200","1300","1400","1500","1600","1700","1800","1900","2000","2100","2200","2300"}; default = 16; }; };
Код:skiptime (((paramsarray select 0) - daytime + 24) % 24);
Тут не исправить уже ничего.. Господь, жги!
Благодарности/Неодобрения |
Получено: 13/0 Отправлено: 165/0 |
Менять время можно так
skiptime is not the best way to synchronize this (It used to be).
Best way now is setdate
Look up the following commands in the comref:
- "addpublicvariableeventhandler"
- call compile preprocessfilelinumbers
- Date
- SetDate
INIT.SQF
- Define a publicvariable eventhandler for the variable Tag_NewDate
- Have the pv eventhandler call a function
The code for that function would be just one line of code nothing else:
Код:setdate _this select 1;What this doesКод:// SERVERSIDE SCRIPT If ! (IsServer)exitwith{}; _addtime = 10; // Number of minutes you want to advance per cycle) _delay = 180; // delay in seconds between loops (3 minutes in this example) While{TRUE}do { sleep _delay; Tag_NewDate = [date select 0, date select 1, date select 2, date select 3, (date select 4 + _addtime)]; PublicVariable "Tag_NewDate"; SetDate Tag_NewDate; };
- The server script, in the above example loops every 3 minutes
- On each loop it gets the current date array which contains the current time as part of its elements
- It then saves that date array as variable called Tag_NewDate and amends the value of the minutes (date select 4)
- Don't worry, if you have a value of 58 minutes when you add 10 minutes, it will still increment the time 10 minutes into the next hour
- It then broadcasts this value over the net to the clients
- The clients receive this via the PublicVariablEventHandler
- That eventhandler then launches a function
- The value of Tag_NewDate is passed to the function as _this select 0
- Setdate command then redefines Date with the new value defined by Tag_NewDate
Important to note.
The server will not initialize the PublicVariablEventHandler
this is why you have the code SetDate Tag_NewDate; in the serverside script loop
Play around with these values
- _delay
- _addtime
Until you can create a smooth transition, especially around 1st light and last light.