-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.sqf
216 lines (177 loc) · 5.35 KB
/
init.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
#include "macros.hpp"
/*
@
@ Author: Slep.
@ File: initPlayerLo.sqf
@ Description: Clientside initialisation for TDM
@
*/
/* Init */
//Admin Users ~~ Slep. ~ Joshua ~ Red ~ M9' ~ James32 ~ Asnee ~ Nevetos ~ Mitch ~ Leeseven ~ pkisbest
//AllowedAdmins localised into fn_allowedUser.sqf allowedAdmins = ["76561198116711642", "76561198243429216", "76561198038557796", "76561198062672956", "76561198042385883", "76561198062186998", "76561198078615667", "76561198191010871", "76561198147006208", "76561198078903168"];
// Variable Init
preInit = false;
spawnsEast = ["cz_east_1","cz_east_2","cz_east_3"];
spawnsWest = ["cz_blue_1","cz_blue_2","cz_blue_3"];
if (isServer) then {
ltime = 0;
dEast = 0;
lvEast = 0;
dWest = 0;
lvWest = 0;
curRnd = 1;
playerCountE = 0;
playerCountW = 0;
uidMrksEast = "0";
uidMrksWest = "0";
playersW = ["_ARR_INIT_"];
playersE = ["_ARR_INIT_"];
playersReady = ["_ARR_INIT_"];
gameActive = false;
gameover = false;
winner = "NOT_DEFINED";
publicVariable "ltime";
publicVariable "dEast";
publicVariable "dWest";
publicVariable "lvWest";
publicVariable "lvEast";
publicVariable "curRnd";
publicVariable "playersE";
publicVariable "playersW";
publicVariable "playerCountE";
publicVariable "playerCountW";
publicVariable "uidMrksEast";
publicVariable "uidMrksWest";
publicVariable "playersReady";
publicVariable "gameActive";
publicVariable "gameover";
publicVariable "winner";
addMissionEventHandler ["HandleDisconnect", {
params ["_unit", "_id", "_uid", "_name"];
if (uidMrksEast == _uid) then {
uidMrksEast = "0";
publicVariable "uidMrksEast";
};
if (uidMrksWest == _uid) then {
uidMrksWest = "0";
publicVariable "uidMrksWest";
};
if (_uid in playersReady) then {
playersReady = playersReady - [uid];
publicVariable "playersReady";
};
if (_uid in playersE) then {
playersE = playersE - [_uid];
playerCountE = (count playersE) - 1;
publicVariable "playersE";
publicVariable "playerCountE";
};
if (_uid in playersW) then {
playersW = playersW - [_uid];
playerCountW = (count playersW) - 1;
publicVariable "playersW";
publicVariable "playerCountW";
};
}];
diag_log "<CT Server>: PublicVariables Initialised";
call ct_fnc_roundInit;
waituntil {gameover};
winner call BIS_fnc_endMissionServer;
};
if (hasInterface && !isServer) then {
waitUntil { !(isNull player) };
// Player Init
0 cutText ["Initialising Client", "BLACK FADED", 99999999];
removeAllWeapons player;
removeAllItems player;
removeVest player;
removeBackpack player;
removeHeadgear player;
removeGoggles player;
player enableStamina false;
player setCustomAimCoef 0.3;
setTerrainGrid 25;
uid = getPlayerUID player;
idPlayer = player;
playerName = profileName;
player addEventHandler ["Killed", {
params ["_unit", "_killer", "_instigator", "_useEffects"];
switch (playerSide) do {
case west: {
dWest = dWest + 1;
publicVariable "dWest";
};
case east: {
dEast = dEast + 1;
publicVariable "dEast";
};
};
}];
player addEventHandler ["Respawn", {
params ["_unit", "_corpse"];
player enableStamina false;
player setCustomAimCoef 0.3;
removeAllWeapons player;
removeAllItems player;
removeAllAssignedItems player;
removeVest player;
removeBackpack player;
removeHeadgear player;
removeGoggles player;
setTerrainGrid 25;
player allowDamage false;
{
deleteVehicle _x;
} forEach allDeadMen;
if ((uid == uidMrksEast)||(uid == uidMrksWest)) then { ["MARKSMAN", true] call ct_fnc_setUnitLoadout } else { "ASSAULT" call ct_fnc_setUnitLoadout };
switch (playerSide) do {
case west: {
spm(rsw);
};
case east: {
spm(rse);
};
};
}];
if ((playerSide == independent) && !(uid call ct_fnc_allowedUser)) exitWith {
player enableSimulation false;
titleCut ["", "BLACK FADED", 999];
"notAdmin" call BIS_fnc_endMission;
};
switch (playerSide) do {
case west: {
playersW = playersW + [uid];
playerCountW = (count playersW)-1;
spm(rsw);
publicVariable "playersW";
publicVariable "playerCountW";
};
case east: {
playersE = playersE + [uid];
playerCountE = (count playersE)-1;
spm(rse);
publicVariable "playersE";
publicVariable "playerCountE";
};
case independent: {spm(rsi)};
};
if (playerSide != independent) then {
player addEventHandler ["InventoryOpened", {
params ["_unit", "_container"];
true;
}];
0 enableChannel [true, false]; // Enable user ability to send text but disable voice on global channel
} else {
player allowDamage false;
player addAction ["Admin Teleport", {[] spawn ct_fnc_admin_teleport}];
player addAction ["Admin Invisibility", {call ct_fnc_admin_invisibility}];
"GAMEMASTER" call ct_fnc_setUnitLoadout;
};
[] execVM "scripts\QS_icons.sqf";
0 cutText ["","BLACK IN"];
//Local Earplugs
originalaudio = [soundVolume, musicVolume]; //Collect user presets, will use them later
waitUntil {!(isNull (findDisplay 46))};
(findDisplay 46) displayAddEventHandler ["KeyDown", "_this call ct_fnc_keyHandler"];
call ct_fnc_roundInit;
};