-
Notifications
You must be signed in to change notification settings - Fork 9
/
ExileServer_object_player_database_load.sqf
264 lines (260 loc) · 7.77 KB
/
ExileServer_object_player_database_load.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
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
/**
* ExileServer_object_player_database_load
*
* Exile Mod
* www.exilemod.com
* © 2015 Exile Mod Team
*
* This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
*
*
* Modified by ynpmoose of ZeroSurvival.com / Vehicle Protection System
*/
private["_data","_oldPlayerObject","_playerUID","_sessionID","_position","_direction","_player","_clanID","_clanName","_clanData","_clanGroup","_devFriendlyMode","_devs","_requestingPlayer","_bambiPlayer","_headgear","_goggles","_binocular","_primaryWeapon","_handgunWeapon","_secondaryWeapon","_currentWeapon","_uniform","_vest","_backpack","_uniformContainer","_vestContainer","_backpackContainer","_assignedItems"];
_data = _this select 0;
_oldPlayerObject = _this select 1;
_playerUID = _this select 2;
_sessionID = _this select 3;
_name = name _oldPlayerObject;
_position = [_data select 11, _data select 12, _data select 13];
_direction = _data select 10;
_player = (createGroup independent) createUnit ["Exile_Unit_Player", _position, [], 0, "CAN_COLLIDE"];
_player setDir _direction;
_player setPosATL _position;
_player disableAI "FSM";
_player disableAI "MOVE";
_player disableAI "AUTOTARGET";
_player disableAI "TARGET";
_player disableAI "CHECKVISIBLE";
_clanID = (_data select 42);
_clanName = (_data select 43);
if !((typeName _clanID) isEqualTo "SCALAR") then
{
_clanID = -1;
_clanData = [];
}
else
{
_clanData = missionnamespace getVariable [format ["ExileServer_clan_%1",_clanID],[]];
if(isNull (_clanData select 5))then
{
_clanGroup = createGroup independent;
_clanData set [5,_clanGroup];
_clanGroup setGroupIdGlobal [_clanData select 0];
missionNameSpace setVariable [format ["ExileServer_clan_%1",_clanID],_clanData];
}
else
{
_clanGroup = (_clanData select 5);
};
[_player] joinSilent _clanGroup;
};
_player setDamage (_data select 3);
_player setName _name;
_player setVariable ["ExileMoney", (_data select 38), true];
_player setVariable ["ExileScore", (_data select 39)];
_player setVariable ["ExileKills", (_data select 40)];
_player setVariable ["ExileDeaths", (_data select 41)];
_player setVariable ["ExileClanID", _clanID];
_player setVariable ["ExileClanData", _clanData];
_player setVariable ["ExileName", _name];
_player setVariable ["ExileOwnerUID", _playerUID];
_player setVariable ["ExileDatabaseID", _data select 0];
_player setVariable ["ExileHunger", _data select 4];
_player setVariable ["ExileThirst", _data select 5];
_player setVariable ["ExileAlcohol", _data select 6];
_player setVariable ["ExileTemperature", _data select 44];
_player setVariable ["ExileWetness", _data select 45];
_player setVariable ["ExileIsBambi", false];
_player setVariable ["ExileXM8IsOnline", false, true];
_player setOxygenRemaining (_data select 7);
_player setBleedingRemaining (_data select 8);
_player setVariable ["ExileLocker", (_data select 46), true];
[_player, _data select 9] call ExileClient_util_player_applyHitPointMap;
_devFriendlyMode = getNumber (configFile >> "CfgSettings" >> "ServerSettings" >> "devFriendyMode");
if (_devFriendlyMode isEqualTo 1) then
{
_devs = getArray (configFile >> "CfgSettings" >> "ServerSettings" >> "devs");
{
if ((getPlayerUID _requestingPlayer) isEqualTo (_x select 0))exitWith
{
if((name _requestingPlayer) isEqualTo (_x select 1))then
{
_bambiPlayer setVariable ["ExileMoney", 500000, true];
_bambiPlayer setVariable ["ExileScore", 100000];
};
};
}
forEach _devs;
};
_player call ExileClient_util_playerCargo_clear;
_headgear = _data select 23;
if (_headgear != "") then
{
_player addHeadgear _headgear;
};
_goggles = _data select 20;
if (_goggles != "") then
{
_player addGoggles _goggles;
};
_binocular = _data select 24;
if (_binocular != "") then
{
_player addWeaponGlobal _binocular;
};
_primaryWeapon = _data select 26;
if (_primaryWeapon != "") then
{
_player addWeaponGlobal _primaryWeapon;
removeAllPrimaryWeaponItems _player;
{
if (_x != "") then
{
_player addPrimaryWeaponItem _x;
};
}
forEach (_data select 27);
};
_handgunWeapon = _data select 22;
if (_handgunWeapon != "") then
{
_player addWeaponGlobal _handgunWeapon;
removeAllHandgunItems _player;
{
if (_x != "") then
{
_player addHandgunItem _x;
};
}
forEach (_data select 21);
};
_secondaryWeapon = _data select 28;
if (_secondaryWeapon != "") then
{
_player addWeaponGlobal _secondaryWeapon;
{
if (_x != "") then
{
_player addSecondaryWeaponItem _x;
};
}
forEach (_data select 29);
};
_currentWeapon = _data select 19;
if (_currentWeapon != "") then
{
_player selectWeapon _currentWeapon;
};
{
_player addWeaponItem [_x select 0, [_x select 1, _x select 2, _x select 3]];
}
forEach (_data select 25);
_uniform = _data select 30;
_vest = _data select 34;
_backpack = _data select 15;
if (_uniform != "") then
{
_player forceAddUniform _uniform;
};
if (_vest != "") then
{
_player addVest _vest;
};
if (_backpack != "") then
{
_player addBackpackGlobal _backpack;
};
_uniformContainer = uniformContainer _player;
if !(isNil "_uniformContainer") then
{
{
_uniformContainer addWeaponCargoGlobal _x;
}
forEach (_data select 33);
{
_uniformContainer addMagazineAmmoCargo [_x select 0, 1, _x select 1];
}
forEach (_data select 32);
{
_uniformContainer addItemCargoGlobal _x;
}
forEach (_data select 31);
};
_vestContainer = vestContainer _player;
if !(isNil "_vestContainer") then
{
{
_vestContainer addWeaponCargoGlobal _x;
}
forEach (_data select 37);
{
_vestContainer addMagazineAmmoCargo [_x select 0, 1, _x select 1];
}
forEach (_data select 36);
{
_vestContainer addItemCargoGlobal _x;
}
forEach (_data select 35);
};
_backpackContainer = backpackContainer _player;
if !(isNil "_backpackContainer") then
{
{
_backpackContainer addWeaponCargoGlobal _x;
}
forEach (_data select 18);
{
_backpackContainer addMagazineAmmoCargo [_x select 0, 1, _x select 1];
}
forEach (_data select 17);
{
_backpackContainer addItemCargoGlobal _x;
}
forEach (_data select 16);
};
_assignedItems = _data select 14;
if !(_assignedItems isEqualTo []) then
{
{
_player linkItem _x;
}
forEach _assignedItems;
};
_player addMPEventHandler ["MPKilled", {_this call ExileServer_object_player_event_onMpKilled}];
if (getNumber (configFile >> "CfgSettings" >> "VehicleSpawn" >> "thermalVision") isEqualTo 0) then
{
_player addEventHandler ["WeaponAssembled", {(_this select 1) disableTIEquipment true;}];
};
[
_sessionID,
"loadPlayerResponse",
[
(netId _player),
str (_player getVariable ["ExileScore", 0]),
(_player getVariable ["ExileKills", 0]),
(_player getVariable ["ExileDeaths", 0]),
(_player getVariable ["ExileHunger", 100]),
(_player getVariable ["ExileThirst", 100]),
(_player getVariable ["ExileAlcohol", 0]),
(_player getVariable ["ExileClanData", []]),
(_player getVariable ["ExileTemperature", 0]),
(_player getVariable ["ExileWetness", 0])
]
]
call ExileServer_system_network_send_to;
[_sessionID, _player] call ExileServer_system_session_update;
// Vehicle Protection System
// Start: Owned Vehicles Vulnerable Upon Login
_vehObjects = allMissionObjects "Car" + allMissionObjects "Air" + allMissionObjects "Ship";
_ownerCheck = _player getVariable "ExileOwnerUID";
{
_vehicleOwner = _x getVariable "ExileOwnerUID"; //get vehicle owner ID
if (_ownerCheck isEqualTo _vehicleOwner) then
{
_x allowDamage true; //Allow damage if vehicle is owned
};
} forEach _vehObjects;
// End: Owned Vehicles Vulnerable Upon Login
true