-
Notifications
You must be signed in to change notification settings - Fork 345
/
onPlayerRespawn.sqf
246 lines (234 loc) · 7.24 KB
/
onPlayerRespawn.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
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
if (isDedicated) exitWith {};
private ["_nuevo","_viejo"];
_nuevo = _this select 0;
_viejo = _this select 1;
if (isNull _viejo) exitWith {};
waitUntil {alive player};
_nul = [_viejo] spawn A3A_fnc_postmortem;
if !(hayACEMedical) then
{
_viejo setVariable ["INCAPACITATED",false,true];
_nuevo setVariable ["INCAPACITATED",false,true];
};
if (side group player == buenos) then
{
_owner = _viejo getVariable ["owner",_viejo];
if (_owner != _viejo) exitWith {hint "Died while remote controlling AI"; selectPlayer _owner; disableUserInput false; deleteVehicle _nuevo};
_nul = [0,-1,getPos _viejo] remoteExec ["A3A_fnc_citySupportChange",2];
_score = _viejo getVariable ["score",0];
_punish = _viejo getVariable ["punish",0];
_dinero = _viejo getVariable ["dinero",0];
_dinero = round (_dinero - (_dinero * 0.1));
_elegible = _viejo getVariable ["elegible",true];
_rango = _viejo getVariable ["rango","PRIVATE"];
_dinero = round (_dinero - (_dinero * 0.05));
if (_dinero < 0) then {_dinero = 0};
_nuevo setVariable ["score",_score -1,true];
_nuevo setVariable ["owner",_nuevo,true];
_nuevo setVariable ["punish",_punish,true];
_nuevo setVariable ["respawning",false];
_nuevo setVariable ["dinero",_dinero,true];
//_nuevo setUnitRank (rank _viejo);
_nuevo setVariable ["compromised",0];
_nuevo setVariable ["elegible",_elegible,true];
_nuevo setVariable ["spawner",true,true];
_viejo setVariable ["spawner",nil,true];
[_nuevo,false] remoteExec ["setCaptive",0,_nuevo];
_nuevo setCaptive false;
_nuevo setRank (_rango);
_nuevo setVariable ["rango",_rango,true];
_nuevo setUnitTrait ["camouflageCoef",0.8];
_nuevo setUnitTrait ["audibleCoef",0.8];
{
_nuevo addOwnedMine _x;
} count (getAllOwnedMines (_viejo));
//if (!hayACEMedical) then {[_nuevo] call A3A_fnc_initRevive};
disableUserInput false;
//_nuevo enableSimulation true;
if (_viejo == theBoss) then
{
[_nuevo] call A3A_fnc_theBossInit;
};
removeAllItemsWithMagazines _nuevo;
{_nuevo removeWeaponGlobal _x} forEach weapons _nuevo;
removeBackpackGlobal _nuevo;
removeVest _nuevo;
if ((not("ItemGPS" in unlockedItems)) and ("ItemGPS" in (assignedItems _nuevo))) then {_nuevo unlinkItem "ItemGPS"};
if ((!hayTFAR) and (!hayACRE) and ("ItemRadio" in (assignedItems player)) and (!haveRadio)) then {player unlinkItem "ItemRadio"};
if (!isPlayer (leader group player)) then {(group player) selectLeader player};
player addEventHandler ["FIRED",
{
_player = _this select 0;
if (captive _player) then
{
if ({if (((side _x == malos) or (side _x == muyMalos)) and (_x distance player < 300)) exitWith {1}} count allUnits > 0) then
{
[_player,false] remoteExec ["setCaptive",0,_player];
_player setCaptive false;
}
else
{
_ciudad = [ciudades,_player] call BIS_fnc_nearestPosition;
_size = [_ciudad] call A3A_fnc_sizeMarker;
_datos = server getVariable _ciudad;
if (random 100 < _datos select 2) then
{
if (_player distance getMarkerPos _ciudad < _size * 1.5) then
{
[_player,false] remoteExec ["setCaptive",0,_player];
_player setCaptive false;
if (vehicle _player != _player) then
{
{if (isPlayer _x) then {[_x,false] remoteExec ["setCaptive",0,_x]; _x setCaptive false}} forEach ((assignedCargo (vehicle _player)) (crew (vehicle _player)) - [_player]);
};
};
};
};
}
}
];
player addEventHandler ["InventoryOpened",
{
private ["_jugador","_contenedor","_tipo"];
_control = false;
_jugador = _this select 0;
if (captive _jugador) then
{
_contenedor = _this select 1;
_tipo = typeOf _contenedor;
if (((_contenedor isKindOf "Man") and (!alive _contenedor)) or (_tipo == NATOAmmoBox) or (_tipo == CSATAmmoBox)) then
{
if ({if (((side _x== muyMalos) or (side _x== malos)) and (_x knowsAbout _jugador > 1.4)) exitWith {1}} count allUnits > 0) then
{
[_jugador,false] remoteExec ["setCaptive",0,_jugador];
_jugador setCaptive false;
}
else
{
_ciudad = [ciudades,_jugador] call BIS_fnc_nearestPosition;
_size = [_ciudad] call A3A_fnc_sizeMarker;
_datos = server getVariable _ciudad;
if (random 100 < _datos select 2) then
{
if (_jugador distance getMarkerPos _ciudad < _size * 1.5) then
{
[_jugador,false] remoteExec ["setCaptive",0,_jugador];
_jugador setCaptive false;
};
};
};
};
};
_control
}];
/*
player addEventHandler ["InventoryClosed",
{
_control = false;
_uniform = uniform player;
_typeSoldier = getText (configfile >> "CfgWeapons" >> _uniform >> "ItemInfo" >> "uniformClass");
_sideType = getNumber (configfile >> "CfgVehicles" >> _typeSoldier >> "side");
if ((_sideType == 1) or (_sideType == 0) and (_uniform != "")) then
{
if !(player getVariable ["disfrazado",false]) then
{
hint "You are wearing an enemy uniform, this will make the AI attack you. Beware!";
player setVariable ["disfrazado",true];
player addRating (-1*(2001 rating player));
};
}
else
{
if (player getVariable ["disfrazado",false]) then
{
hint "You removed your enemy uniform";
player addRating (rating player * -1);
};
};
_control
}];
*/
if (tkPunish) then
{
player addEventHandler ["Fired",
{
_tipo = _this select 1;
if ((_tipo == "Put") or (_tipo == "Throw")) then
{
if (player distance petros < 50) then
{
deleteVehicle (_this select 6);
if (_tipo == "Put") then
{
if (player distance petros < 10) then {[player,60] spawn A3A_fnc_castigo};
};
};
};
}];
};
player addEventHandler ["HandleHeal",
{
_player = _this select 0;
if (captive _player) then
{
if ({((side _x== muyMalos) or (side _x== malos)) and (_x knowsAbout player > 1.4)} count allUnits > 0) then
{
[_player,false] remoteExec ["setCaptive",0,_player];
_player setCaptive false;
}
else
{
_ciudad = [ciudades,_player] call BIS_fnc_nearestPosition;
_size = [_ciudad] call A3A_fnc_sizeMarker;
_datos = server getVariable _ciudad;
if (random 100 < _datos select 2) then
{
if (_player distance getMarkerPos _ciudad < _size * 1.5) then
{
[_player,false] remoteExec ["setCaptive",0,_player];
_player setCaptive false;
};
};
};
}
}
];
player addEventHandler ["WeaponAssembled",
{
private ["_veh"];
_veh = _this select 1;
if (_veh isKindOf "StaticWeapon") then
{
if (not(_veh in staticsToSave)) then
{
staticsToSave pushBack _veh;
publicVariable "staticsToSave";
[_veh] call A3A_fnc_AIVEHinit;
};
}
else
{
_veh addEventHandler ["Killed",{[_this select 0] remoteExec ["A3A_fnc_postmortem",2]}];
};
}];
player addEventHandler ["WeaponDisassembled",
{
_bag1 = _this select 1;
_bag2 = _this select 2;
//_bag1 = objectParent (_this select 1);
//_bag2 = objectParent (_this select 2);
[_bag1] call A3A_fnc_AIVEHinit;
[_bag2] call A3A_fnc_AIVEHinit;
}
];
[true] execVM "reinitY.sqf";
[player] execVM "OrgPlayers\unitTraits.sqf";
[] spawn A3A_fnc_statistics;
}
else
{
_viejo setVariable ["spawner",nil,true];
_nuevo setVariable ["spawner",true,true];
if (hayRHS) then {[player] call A3A_fnc_RHSdress};
if (hayACE) then {[] call A3A_fnc_ACEpvpReDress};
};