-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOnPauseScript.sqf
35 lines (28 loc) · 921 Bytes
/
OnPauseScript.sqf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
//OnPauseScript.sqf
//Runs on players
//Called by players when opening Esc Menu
//pvs
private ["_display", "_pauseTime", "_musicStartTime", "_track", "_trackLength", "_timePaused"];
//setup
disableSerialization;
_display = _this select 0;
0.01 fadeMusic 0;
_pauseTime =0+time;
//get global values
_musicStartTime = missionNamespace getVariable "PauseMusicTime";
_track = missionNamespace getVariable "HGMusic";
_trackLength = getNumber(configfile >> "CfgMusic" >> _track >> "duration");
//start music
sleep 0.4;
playMusic [_track, _musicStartTime];
2 fadeMusic 0.3;
//waitUntil pause screen closed
waitUntil {isNull _display};
//save music quit point
_timePaused = time - _pauseTime + _musicStartTime;
_musicStartTime = _timePaused % _trackLength;
missionNamespace setVariable ["PauseMusicTime", _musicStartTime];
//fade out and end music
0.5 fadeMusic 0;
sleep 0.5;
playMusic "";