-
Notifications
You must be signed in to change notification settings - Fork 7
/
init.c.merge-expansion-maps
359 lines (317 loc) · 16.8 KB
/
init.c.merge-expansion-maps
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
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
// Replace everything from "class CustomMission: MissionServer" in your init.c with this:
class CustomMission: MissionServer
{
ref array< string > adminMembers = new array< string >;
ref array< string > modMembers = new array< string >;
ref array< string > vipMembersSilver = new array< string >;
ref array< string > vipMembersGold = new array< string >;
void CustomMission()
{
adminMembers = new array< string >;
modMembers = new array< string >;
vipMembersSilver = new array< string >;
vipMembersGold = new array< string >;
InitPlayerWhitelist();
}
// ------------------------------------------------------------
// Override OnInit
// ------------------------------------------------------------
override void OnInit()
{
ExpansionMissionModule missionModule;
if ( Class.CastTo( missionModule, GetModuleManager().GetModule( ExpansionMissionModule ) ) )
{
missionModule.SetMissionConstructor( COMMissionConstructor );
}
super.OnInit();
}
// ------------------------------------------------------------
// Override CreateCharacter
// ------------------------------------------------------------
override PlayerBase CreateCharacter(PlayerIdentity identity, vector pos, ParamsReadContext ctx, string characterName)
{
Entity playerEnt;
playerEnt = GetGame().CreatePlayer( identity, characterName, pos, 0, "NONE" );
Class.CastTo( m_player, playerEnt );
GetGame().SelectPlayer( identity, m_player );
return m_player;
}
// ------------------------------------------------------------
// SetRandomHealth
// ------------------------------------------------------------
void SetRandomHealth(EntityAI itemEnt)
{
if ( itemEnt )
{
float rndHlt = Math.RandomFloat( 0.25, 0.65 );
itemEnt.SetHealth01( "", "", rndHlt );
}
}
// ------------------------------------------------------------
// Override StartingEquipSetup
// ------------------------------------------------------------
void addMags(PlayerBase player, string mag_type, int count)
{
if (count < 1)
return;
EntityAI mag;
for (int i = 0; i < count; i++) {
mag = player.GetInventory().CreateInInventory(mag_type);
}
player.SetQuickBarEntityShortcut(mag, 2, true);
}
void InitPlayerWhitelist()
{
// Example with Bohemia UID: adminMembers.Insert( "JCmXrrt43efttyhfewew7tRLMUCOE6roH2O8SklBB1o=" );
// Example with Steam64 ID: adminMembers.Insert( "76561198040948171" );
// ADMIN MEMBERS: Can be Steam64 ID or Bohemia UID
adminMembers.Insert( "ReplaceWithUniqueID" ); // Admins Name
adminMembers.Insert( "ReplaceWithUniqueID" ); // Admins Name
// MODERATOR MEMBERS: Can be Steam64 ID or Bohemia UID
modMembers.Insert( "ReplaceWithUniqueID" ); // Moderators Name
modMembers.Insert( "ReplaceWithUniqueID" ); // Moderators Name
// Silver VIP MEMBERS: Can be Steam64 ID or Bohemia UID
vipMembersSilver.Insert( "ReplaceWithUniqueID" ); // Players Name
vipMembersSilver.Insert( "ReplaceWithUniqueID" ); // Players Name
// Gold VIP MEMBERS: Can be Steam64 ID or Bohemia UID
vipMembersGold.Insert( "ReplaceWithUniqueID" ); // Players Name
vipMembersGold.Insert( "ReplaceWithUniqueID" ); // Players Name
}
// Admin Loadout
EntityAI adminLoadOut(PlayerBase player)
{
ref TStringArray hatArray = {"BallisticHelmet_Black"};
ref TStringArray topArray = {"M65Jacket_Black"};
ref TStringArray pantsArray = {"CargoPants_Black"};
ref TStringArray vestArray = {"HighCapacityVest_Black"};
ref TStringArray glassesArray = {""};
ref TStringArray shoesArray = {"MilitaryBoots_Black"};
ref TStringArray maskArray = {"BalaclavaMask_Blackskull"};
ref TStringArray glovesArray = {"TacticalGloves_Black"};
ref TStringArray foodArray = {"BakedBeansCan"};
ref TStringArray drinkArray = {"SodaCan_Cola"};
ref TStringArray backpackArray = {""};
ref TStringArray knifeArray = {"HuntingKnife"};
ref TStringArray meleeArray = {"FirefighterAxe"};
player.GetInventory().CreateInInventory(hatArray.GetRandomElement());
player.GetInventory().CreateInInventory(topArray.GetRandomElement());
player.GetInventory().CreateInInventory(pantsArray.GetRandomElement());
player.GetInventory().CreateInInventory(vestArray.GetRandomElement());
player.GetInventory().CreateInInventory(glassesArray.GetRandomElement());
player.GetInventory().CreateInInventory(shoesArray.GetRandomElement());
player.GetInventory().CreateInInventory(maskArray.GetRandomElement());
player.GetInventory().CreateInInventory(glovesArray.GetRandomElement());
player.GetInventory().CreateInInventory(foodArray.GetRandomElement());
player.GetInventory().CreateInInventory(drinkArray.GetRandomElement());
player.GetInventory().CreateInInventory(backpackArray.GetRandomElement());
player.GetInventory().CreateInInventory(knifeArray.GetRandomElement());
player.GetInventory().CreateInInventory("Lockpick");
ItemBase rags = player.GetInventory().CreateInInventory("Rag");
rags.SetQuantity(4);
ItemBase light = player.GetInventory().CreateInInventory("Flashlight");
light.GetInventory().CreateAttachment("Battery9V");
EntityAI gun = player.GetInventory().CreateInInventory("AKM"); // Weapon
gun.GetInventory().CreateAttachment("AK_RailHndgrd"); // Weapon Attachment
ItemBase gunlight = gun.GetInventory().CreateAttachment("UniversalLight"); // Weapon Attachment (Universal Light)
gunlight.GetInventory().CreateAttachment("Battery9V"); // Add battery to Universal Light
addMags(player, "Mag_AKM_30Rnd", 4); // Magazines
ItemBase melee = player.GetInventory().CreateInInventory(meleeArray.GetRandomElement()); // Melee
player.SetQuickBarEntityShortcut(gun, 0, true);
player.SetQuickBarEntityShortcut(melee, 1, true);
return gun;
}
// Moderator Loadout
EntityAI modLoadOut(PlayerBase player)
{
ref TStringArray hatArray = {"BallisticHelmet_Black"};
ref TStringArray topArray = {"M65Jacket_Black"};
ref TStringArray pantsArray = {"CargoPants_Black"};
ref TStringArray vestArray = {"HighCapacityVest_Black"};
ref TStringArray glassesArray = {""};
ref TStringArray shoesArray = {"MilitaryBoots_Black"};
ref TStringArray maskArray = {"BalaclavaMask_Blackskull"};
ref TStringArray glovesArray = {"TacticalGloves_Black"};
ref TStringArray foodArray = {"BakedBeansCan"};
ref TStringArray drinkArray = {"SodaCan_Cola"};
ref TStringArray backpackArray = {""};
ref TStringArray knifeArray = {"HuntingKnife"};
ref TStringArray meleeArray = {"FirefighterAxe"};
player.GetInventory().CreateInInventory(hatArray.GetRandomElement());
player.GetInventory().CreateInInventory(topArray.GetRandomElement());
player.GetInventory().CreateInInventory(pantsArray.GetRandomElement());
player.GetInventory().CreateInInventory(vestArray.GetRandomElement());
player.GetInventory().CreateInInventory(glassesArray.GetRandomElement());
player.GetInventory().CreateInInventory(shoesArray.GetRandomElement());
player.GetInventory().CreateInInventory(maskArray.GetRandomElement());
player.GetInventory().CreateInInventory(glovesArray.GetRandomElement());
player.GetInventory().CreateInInventory(foodArray.GetRandomElement());
player.GetInventory().CreateInInventory(drinkArray.GetRandomElement());
player.GetInventory().CreateInInventory(backpackArray.GetRandomElement());
player.GetInventory().CreateInInventory(knifeArray.GetRandomElement());
player.GetInventory().CreateInInventory("Lockpick");
ItemBase rags = player.GetInventory().CreateInInventory("Rag");
rags.SetQuantity(4);
ItemBase light = player.GetInventory().CreateInInventory("Flashlight");
light.GetInventory().CreateAttachment("Battery9V");
EntityAI gun = player.GetInventory().CreateInInventory("AKM"); // Weapon
gun.GetInventory().CreateAttachment("AK_RailHndgrd"); // Weapon Attachment
ItemBase gunlight = gun.GetInventory().CreateAttachment("UniversalLight"); // Weapon Attachment (Universal Light)
gunlight.GetInventory().CreateAttachment("Battery9V"); // Add battery to Universal Light
addMags(player, "Mag_AKM_30Rnd", 4); // Magazines
ItemBase melee = player.GetInventory().CreateInInventory(meleeArray.GetRandomElement()); // Melee
player.SetQuickBarEntityShortcut(gun, 0, true);
player.SetQuickBarEntityShortcut(melee, 1, true);
return gun;
}
// VIP Loadout: Silver
EntityAI vipLoadOutSilver(PlayerBase player)
{
ref TStringArray hatArray = {"BaseballCap_CMMG_Pink","BaseballCap_Pink","BaseballCap_Red","BaseballCap_Blue"};
ref TStringArray topArray = {"Sweater_Red","Sweater_Blue","Sweater_Gray","Sweater_Green"};
ref TStringArray pantsArray = {"Jeans_Blue","Jeans_BlueDark","Jeans_Grey","Jeans_Brown","Jeans_Black","Jeans_Green"};
ref TStringArray vestArray = {""};
ref TStringArray glassesArray = {""};
ref TStringArray shoesArray = {"CombatBoots_Grey","CombatBoots_Beige","CombatBoots_Brown","CombatBoots_Black","CombatBoots_Green"};
ref TStringArray maskArray = {""};
ref TStringArray glovesArray = {"WorkingGloves_Brown"};
ref TStringArray foodArray = {"BakedBeansCan"};
ref TStringArray drinkArray = {"SodaCan_Cola"};
ref TStringArray backpackArray = {"DryBag_Yellow","DryBag_Orange","DryBag_Red","DryBag_Blue","DryBag_Black","DryBag_Green"};
ref TStringArray knifeArray = {"HuntingKnife"};
ref TStringArray meleeArray = {"FirefighterAxe"};
player.GetInventory().CreateInInventory(hatArray.GetRandomElement());
player.GetInventory().CreateInInventory(topArray.GetRandomElement());
player.GetInventory().CreateInInventory(pantsArray.GetRandomElement());
player.GetInventory().CreateInInventory(vestArray.GetRandomElement());
player.GetInventory().CreateInInventory(glassesArray.GetRandomElement());
player.GetInventory().CreateInInventory(shoesArray.GetRandomElement());
player.GetInventory().CreateInInventory(maskArray.GetRandomElement());
player.GetInventory().CreateInInventory(glovesArray.GetRandomElement());
player.GetInventory().CreateInInventory(foodArray.GetRandomElement());
player.GetInventory().CreateInInventory(drinkArray.GetRandomElement());
player.GetInventory().CreateInInventory(backpackArray.GetRandomElement());
player.GetInventory().CreateInInventory(knifeArray.GetRandomElement());
ItemBase rags = player.GetInventory().CreateInInventory("Rag");
rags.SetQuantity(4);
ItemBase light = player.GetInventory().CreateInInventory("Flashlight");
light.GetInventory().CreateAttachment("Battery9V");
EntityAI gun = player.GetInventory().CreateInInventory("AKS74U"); // Weapon
addMags(player, "Mag_AK74_30Rnd", 2); // Magazines
ItemBase melee = player.GetInventory().CreateInInventory(meleeArray.GetRandomElement()); // Melee
player.SetQuickBarEntityShortcut(gun, 0, true);
player.SetQuickBarEntityShortcut(melee, 1, true);
return gun;
}
// VIP Loadout: Gold
EntityAI vipLoadOutGold(PlayerBase player)
{
ref TStringArray hatArray = {"BaseballCap_CMMG_Pink","BaseballCap_Pink","BaseballCap_Red","BaseballCap_Blue"};
ref TStringArray topArray = {"Sweater_Red","Sweater_Blue","Sweater_Gray","Sweater_Green"};
ref TStringArray pantsArray = {"Jeans_Blue","Jeans_BlueDark","Jeans_Grey","Jeans_Brown","Jeans_Black","Jeans_Green"};
ref TStringArray vestArray = {""};
ref TStringArray glassesArray = {""};
ref TStringArray shoesArray = {"CombatBoots_Grey","CombatBoots_Beige","CombatBoots_Brown","CombatBoots_Black","CombatBoots_Green"};
ref TStringArray maskArray = {""};
ref TStringArray glovesArray = {"WorkingGloves_Brown"};
ref TStringArray foodArray = {"BakedBeansCan"};
ref TStringArray drinkArray = {"SodaCan_Cola"};
ref TStringArray backpackArray = {"DryBag_Yellow","DryBag_Orange","DryBag_Red","DryBag_Blue","DryBag_Black","DryBag_Green"};
ref TStringArray knifeArray = {"HuntingKnife"};
ref TStringArray meleeArray = {"FirefighterAxe"};
player.GetInventory().CreateInInventory(hatArray.GetRandomElement());
player.GetInventory().CreateInInventory(topArray.GetRandomElement());
player.GetInventory().CreateInInventory(pantsArray.GetRandomElement());
player.GetInventory().CreateInInventory(vestArray.GetRandomElement());
player.GetInventory().CreateInInventory(glassesArray.GetRandomElement());
player.GetInventory().CreateInInventory(shoesArray.GetRandomElement());
player.GetInventory().CreateInInventory(maskArray.GetRandomElement());
player.GetInventory().CreateInInventory(glovesArray.GetRandomElement());
player.GetInventory().CreateInInventory(foodArray.GetRandomElement());
player.GetInventory().CreateInInventory(drinkArray.GetRandomElement());
player.GetInventory().CreateInInventory(backpackArray.GetRandomElement());
player.GetInventory().CreateInInventory(knifeArray.GetRandomElement());
ItemBase rags = player.GetInventory().CreateInInventory("Rag");
rags.SetQuantity(4);
ItemBase light = player.GetInventory().CreateInInventory("Flashlight");
light.GetInventory().CreateAttachment("Battery9V");
EntityAI gun = player.GetInventory().CreateInInventory("AKS74U"); // Weapon
addMags(player, "Mag_AK74_30Rnd", 2); // Magazines
ItemBase melee = player.GetInventory().CreateInInventory(meleeArray.GetRandomElement()); // Melee
player.SetQuickBarEntityShortcut(gun, 0, true);
player.SetQuickBarEntityShortcut(melee, 1, true);
return gun;
}
// Non-VIP Loadout (Default Loadout)
EntityAI randomLoadOut(PlayerBase player)
{
ref TStringArray hatArray = {"BaseballCap_CMMG_Pink","BaseballCap_Pink","BaseballCap_Red"};
ref TStringArray topArray = {"Sweater_Red","Sweater_Blue","Sweater_Gray","Sweater_Green"};
ref TStringArray pantsArray = {"Jeans_Blue","Jeans_BlueDark","Jeans_Grey","Jeans_Brown","Jeans_Black","Jeans_Green"};
ref TStringArray vestArray = {""};
ref TStringArray glassesArray = {""};
ref TStringArray shoesArray = {"CombatBoots_Grey","CombatBoots_Beige","CombatBoots_Brown","CombatBoots_Black","CombatBoots_Green"};
ref TStringArray maskArray = {""};
ref TStringArray glovesArray = {"WorkingGloves_Brown"};
ref TStringArray foodArray = {"BakedBeansCan"};
ref TStringArray drinkArray = {"SodaCan_Cola"};
ref TStringArray backpackArray = {"DryBag_Yellow","DryBag_Orange","DryBag_Red","DryBag_Blue","DryBag_Black","DryBag_Green"};
ref TStringArray knifeArray = {"HuntingKnife"};
ref TStringArray meleeArray = {"FirefighterAxe"};
player.GetInventory().CreateInInventory(hatArray.GetRandomElement());
player.GetInventory().CreateInInventory(topArray.GetRandomElement());
player.GetInventory().CreateInInventory(pantsArray.GetRandomElement());
player.GetInventory().CreateInInventory(vestArray.GetRandomElement());
player.GetInventory().CreateInInventory(glassesArray.GetRandomElement());
player.GetInventory().CreateInInventory(shoesArray.GetRandomElement());
player.GetInventory().CreateInInventory(maskArray.GetRandomElement());
player.GetInventory().CreateInInventory(glovesArray.GetRandomElement());
player.GetInventory().CreateInInventory(foodArray.GetRandomElement());
player.GetInventory().CreateInInventory(drinkArray.GetRandomElement());
player.GetInventory().CreateInInventory(backpackArray.GetRandomElement());
player.GetInventory().CreateInInventory(knifeArray.GetRandomElement());
ItemBase rags = player.GetInventory().CreateInInventory("Rag");
rags.SetQuantity(4);
ItemBase light = player.GetInventory().CreateInInventory("Flashlight");
light.GetInventory().CreateAttachment("Battery9V");
EntityAI gun = player.GetInventory().CreateInInventory("AKS74U"); // Weapon
addMags(player, "Mag_AK74_30Rnd", 2); // Magazines
ItemBase melee = player.GetInventory().CreateInInventory(meleeArray.GetRandomElement()); // Melee
player.SetQuickBarEntityShortcut(gun, 0, true);
player.SetQuickBarEntityShortcut(melee, 1, true);
return gun;
}
override void StartingEquipSetup(PlayerBase player, bool clothesChosen)
{
if ( !GetExpansionSettings().GetSpawn().StartingClothing.EnableCustomClothing )
{
player.RemoveAllItems();
if (adminMembers.Find(GetUserID(player)) != -1 || adminMembers.Find(GetUserSteamID(player)) != -1 ) {
adminLoadOut(player);
} else if (modMembers.Find(GetUserID(player)) != -1 || modMembers.Find(GetUserSteamID(player)) != -1 ) {
modLoadOut(player);
} else if (vipMembersSilver.Find(GetUserID(player)) != -1 || vipMembersSilver.Find(GetUserSteamID(player)) != -1 ) {
vipLoadOutSilver(player);
} else if (vipMembersGold.Find(GetUserID(player)) != -1 || vipMembersGold.Find(GetUserSteamID(player)) != -1 ) {
vipLoadOutGold(player);
} else {
randomLoadOut(player);
}
}
}
string GetUserID(PlayerBase player)
{
if ( player.GetIdentity() )
return player.GetIdentity().GetPlainId();
return "OFFLINE";
}
string GetUserSteamID(PlayerBase player)
{
if ( player.GetIdentity() )
return player.GetIdentity().GetId();
return "OFFLINE";
}
};
Mission CreateCustomMission(string path)
{
return new CustomMission();
}