-
Notifications
You must be signed in to change notification settings - Fork 3
/
rpg_job_garbagecollector.sp
551 lines (460 loc) · 17.6 KB
/
rpg_job_garbagecollector.sp
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
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
/*
T-RP
Copyright (C) 2017 Christian Ziegler
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma semicolon 1
#define PLUGIN_AUTHOR "Totenfluch"
#define PLUGIN_VERSION "1.00"
#include <sourcemod>
#include <sdktools>
#include <cstrike>
#include <map_workshop_functions>
#include <rpg_jobs_core>
#include <rpg_npc_core>
#include <rpg_inventory_core>
#include <smlib>
#include <tConomy>
#include <rpg_perks>
#include <tStocks>
#pragma newdecls required
#define MAX_GARBAGE 1024
int g_iSpeedTimeLeft[MAXPLAYERS + 1];
enum garbage {
Float:gXPos,
Float:gYPos,
Float:gZPos,
bool:gIsActive
}
int g_eGarbageSpawnPoints[MAX_GARBAGE][garbage];
int g_iLoadedGarbage = 0;
int g_iActiveGarbage = 0;
int g_iBlueGlow;
int g_iBaseGarbageSpawns = 10;
int g_iMaxGarbageSpawns = 20;
ArrayList randomNumbers;
int g_iPlayerPrevButtons[MAXPLAYERS + 1];
char g_cTrash[3][64];
public Plugin myinfo =
{
name = "[T-RP] Job: Garbage Collector",
author = PLUGIN_AUTHOR,
description = "Add the Garbage collector to the T-RP",
version = PLUGIN_VERSION,
url = "https://totenfluch.de"
};
public void OnPluginStart() {
RegAdminCmd("sm_garbagespawns", addSpawnPoints, ADMFLAG_ROOT, "Opens the Menu to add Garbage spawnpoints");
HookEvent("round_start", onRoundStart);
jobs_registerJob("Garbage Collector", "Collect Garbage and put it in the Trash Cans", 20, 300, 2.068);
npc_registerNpcType("Garbagerman Recruiter");
resetAmountVars();
}
public void OnMapStart() {
resetAmountVars();
PrecacheModel("models/props_junk/trashcluster01a_corner.mdl", true);
PrecacheModel("models/props/de_train/hr_t/trash_c/hr_clothes_pile.mdl", true);
PrecacheModel("models/props/de_train/hr_t/trash_b/hr_food_pile_02.mdl", true);
strcopy(g_cTrash[0], 64, "models/props_junk/trashcluster01a_corner.mdl");
strcopy(g_cTrash[1], 64, "models/props/de_train/hr_t/trash_c/hr_clothes_pile.mdl");
strcopy(g_cTrash[2], 64, "models/props/de_train/hr_t/trash_b/hr_food_pile_02.mdl");
CreateTimer(1.0, refreshTimer, _, TIMER_REPEAT | TIMER_FLAG_NO_MAPCHANGE);
for (int i = 0; i < MAX_GARBAGE; i++) {
g_eGarbageSpawnPoints[g_iLoadedGarbage][gXPos] = -1.0;
g_eGarbageSpawnPoints[g_iLoadedGarbage][gYPos] = -1.0;
g_eGarbageSpawnPoints[g_iLoadedGarbage][gZPos] = -1.0;
g_eGarbageSpawnPoints[g_iLoadedGarbage][gIsActive] = false;
}
g_iLoadedGarbage = 0;
g_iBlueGlow = PrecacheModel("sprites/blueglow1.vmt");
loadGarbageSpawnPoints();
}
public void onRoundStart(Handle event, const char[] name, bool dontBroadcast) {
for (int i = 0; i < MAX_GARBAGE; i++) {
g_eGarbageSpawnPoints[i][gIsActive] = false;
}
randomNumbers = CreateArray(g_iBaseGarbageSpawns, g_iBaseGarbageSpawns);
ClearArray(randomNumbers);
for (int i = 0; i < g_iLoadedGarbage; i++) {
PushArrayCell(randomNumbers, i);
}
for (int i = 0; i < MAX_GARBAGE; i++) {
int index1 = GetRandomInt(0, (g_iLoadedGarbage - 1));
int index2 = GetRandomInt(0, (g_iLoadedGarbage - 1));
if (GetArraySize(randomNumbers) > 0)
SwapArrayItems(randomNumbers, index1, index2);
}
int spawns = 0;
if (g_iBaseGarbageSpawns > g_iLoadedGarbage)
spawns = g_iLoadedGarbage;
else
spawns = g_iBaseGarbageSpawns;
for (int i = 0; i < spawns; i++) {
int spawnId = GetArrayCell(randomNumbers, 0);
RemoveFromArray(randomNumbers, 0);
spawnGarbage(spawnId);
}
}
public void spawnGarbage(int id) {
int trashEnt = CreateEntityByName("prop_dynamic_override");
if (trashEnt == -1)
return;
char modelPath[128];
Format(modelPath, sizeof(modelPath), g_cTrash[GetRandomInt(0, 2)]);
SetEntityModel(trashEnt, modelPath);
DispatchKeyValue(trashEnt, "Solid", "2");
SetEntProp(trashEnt, Prop_Send, "m_nSolidType", 2);
SetEntProp(trashEnt, Prop_Data, "m_CollisionGroup", COLLISION_GROUP_NONE);
char cId[8];
IntToString(id, cId, sizeof(cId));
SetEntPropString(trashEnt, Prop_Data, "m_iName", cId);
DispatchSpawn(trashEnt);
float pos[3];
pos[0] = g_eGarbageSpawnPoints[id][gXPos];
pos[1] = g_eGarbageSpawnPoints[id][gYPos];
pos[2] = g_eGarbageSpawnPoints[id][gZPos];
TeleportEntity(trashEnt, pos, NULL_VECTOR, NULL_VECTOR);
Entity_SetGlobalName(trashEnt, "Garbage");
g_eGarbageSpawnPoints[id][gIsActive] = true;
g_iActiveGarbage++;
}
public Action refreshTimer(Handle Timer) {
for (int i = 1; i < MAXPLAYERS; i++) {
if (g_iSpeedTimeLeft[i] > 0)
g_iSpeedTimeLeft[i]--;
else if (g_iSpeedTimeLeft[i] == 0) {
g_iSpeedTimeLeft[i] = -1;
removeSpeed(i);
}
}
if (randomNumbers == INVALID_HANDLE)
return;
int active = getActiveGarbage();
if (active == g_iLoadedGarbage)
return;
if (active >= g_iMaxGarbageSpawns)
return;
if (active < g_iBaseGarbageSpawns) {
if (GetArraySize(randomNumbers) > 0) {
int spawnId = GetArrayCell(randomNumbers, 0);
RemoveFromArray(randomNumbers, 0);
spawnGarbage(spawnId);
return;
}
}
if (active >= g_iBaseGarbageSpawns && active < g_iMaxGarbageSpawns) {
if (GetArraySize(randomNumbers) > 0) {
if (GetRandomInt(0, 20) == 7) {
int spawnId = GetArrayCell(randomNumbers, 0);
RemoveFromArray(randomNumbers, 0);
spawnGarbage(spawnId);
}
}
}
}
public Action OnPlayerRunCmd(int client, int &iButtons, int &iImpulse, float fVelocity[3], float fAngles[3], int &iWeapon, int &tickcount) {
if (IsClientInGame(client) && IsPlayerAlive(client)) {
if (!(g_iPlayerPrevButtons[client] & IN_USE) && iButtons & IN_USE) {
if (jobs_isActiveJob(client, "Garbage Collector")) {
int ent = GetClientAimTarget(client, false);
if (IsValidEntity(ent)) {
if (HasEntProp(ent, Prop_Data, "m_iName") && HasEntProp(ent, Prop_Data, "m_iGlobalname")) {
char entName[256];
Entity_GetGlobalName(ent, entName, sizeof(entName));
if (StrEqual(entName, "Garbage")) {
float garbagePos[3];
float clientPos[3];
GetClientAbsOrigin(client, clientPos);
GetEntPropVector(ent, Prop_Data, "m_vecOrigin", garbagePos);
if (GetVectorDistance(clientPos, garbagePos) > 45.0) {
g_iPlayerPrevButtons[client] = iButtons;
return;
}
char cGarbageId[128];
GetEntPropString(ent, Prop_Data, "m_iName", cGarbageId, sizeof(cGarbageId));
int garbageId = StringToInt(cGarbageId);
pickupGarbage(client, ent, garbageId);
}
}
}
}
}
g_iPlayerPrevButtons[client] = iButtons;
}
}
public void pickupGarbage(int client, int ent, int garbageId) {
if (IsValidEntity(ent))
AcceptEntityInput(ent, "kill");
PushArrayCell(randomNumbers, garbageId);
g_eGarbageSpawnPoints[garbageId][gIsActive] = false;
inventory_givePlayerItem(client, "Garbage", 10, "", "Junk", "Garbage Collector", 1, "Collected");
int extraChance = perks_hasPerk(client, "Double Garbage 4") ? 80 :
perks_hasPerk(client, "Double Garbage 3") ? 60 :
perks_hasPerk(client, "Double Garbage 2") ? 40 :
perks_hasPerk(client, "Double Garbage 1") ? 20 : 0;
if (GetRandomInt(0, 100) < extraChance)
inventory_givePlayerItem(client, "Garbage", 10, "", "Junk", "Garbage Collector", 1, "Collected (Double Perk)");
int rareChance = perks_hasPerk(client, "Rare Loot 4") ? 5 :
perks_hasPerk(client, "Rare Loot 3") ? 3 :
perks_hasPerk(client, "Rare Loot 2") ? 2 :
perks_hasPerk(client, "Rare Loot 1") ? 1 : 0;
if (GetRandomInt(0, 100) < rareChance) {
int which = GetRandomInt(0, 4);
if (which == 0)
inventory_givePlayerItem(client, "Lockpick", 0, "", "Criminal", "Criminal", 1, "Collected (Rare Perk)");
else if (which == 1)
inventory_givePlayerItem(client, "weapon_flashbang", 0, "", "Weapon", "Weapon", 1, "Collected (Rare Perk)");
else if (which == 2)
inventory_givePlayerItem(client, "weapon_hegrenade", 0, "", "Weapon", "Weapon", 1, "Collected (Rare Perk)");
else if (which == 3)
inventory_givePlayerItem(client, "weapon_smokegrenade", 0, "", "Weapon", "Weapon", 1, "Collected (Rare Perk)");
else if (which == 4)
inventory_givePlayerItem(client, "weapon_molotov", 0, "", "Weapon", "Weapon", 1, "Collected (Rare Perk)");
}
if (perks_hasPerk(client, "Weapon Drop Chance")) {
if (GetRandomInt(0, 100) == 1) {
int which = GetRandomInt(0, 3);
if (which == 0)
inventory_givePlayerItem(client, "weapon_p2000", 5, "", "Weapon", "Weapon", 1, "Collected (Weapon Perk)");
else if (which == 1)
inventory_givePlayerItem(client, "weapon_usp", 5, "", "Weapon", "Weapon", 1, "Collected (Weapon Perk)");
else if (which == 2)
inventory_givePlayerItem(client, "weapon_glock", 5, "", "Weapon", "Weapon", 1, "Collected (Weapon Perk)");
else if (which == 3)
inventory_givePlayerItem(client, "weapon_deagle", 5, "", "Weapon", "Weapon", 1, "Collected (Weapon Perk)");
}
}
if (perks_hasPerk(client, "Pickup Speed Boost 1")) {
PrintToChat(client, "[-T-] Increased your Speed for 3s...");
SetEntPropFloat(client, Prop_Data, "m_flLaggedMovementValue", 1.1);
g_iSpeedTimeLeft[client] = 3;
} else if (perks_hasPerk(client, "Pickup Speed Boost 2")) {
PrintToChat(client, "[-T-] Increased your Speed for 5s...");
SetEntPropFloat(client, Prop_Data, "m_flLaggedMovementValue", 1.15);
g_iSpeedTimeLeft[client] = 5;
}
g_iActiveGarbage--;
}
public void removeSpeed(int client) {
if (!isValidClient(client))
return;
if (GetEntPropFloat(client, Prop_Data, "m_flLaggedMovementValue") <= 1.0)
return;
SetEntPropFloat(client, Prop_Data, "m_flLaggedMovementValue", 1.0);
}
public void loadGarbageSpawnPoints()
{
char sRawMap[PLATFORM_MAX_PATH];
char sMap[64];
GetCurrentMap(sRawMap, sizeof(sRawMap));
RemoveMapPath(sRawMap, sMap, sizeof(sMap));
char sPath[PLATFORM_MAX_PATH];
BuildPath(Path_SM, sPath, sizeof(sPath), "configs/rpg_garbage/%s.txt", sMap);
Handle hFile = OpenFile(sPath, "r");
char sBuffer[512];
char sDatas[3][32];
if (hFile != INVALID_HANDLE)
{
while (ReadFileLine(hFile, sBuffer, sizeof(sBuffer)))
{
ExplodeString(sBuffer, ";", sDatas, 3, 32);
g_eGarbageSpawnPoints[g_iLoadedGarbage][gXPos] = StringToFloat(sDatas[0]);
g_eGarbageSpawnPoints[g_iLoadedGarbage][gYPos] = StringToFloat(sDatas[1]);
g_eGarbageSpawnPoints[g_iLoadedGarbage][gZPos] = StringToFloat(sDatas[2]);
g_iLoadedGarbage++;
}
CloseHandle(hFile);
}
PrintToServer("Loaded %i Garbage Spawn Points", g_iLoadedGarbage);
}
public void saveGarbageSpawnPoints()
{
char sRawMap[PLATFORM_MAX_PATH];
char sMap[64];
GetCurrentMap(sRawMap, sizeof(sRawMap));
RemoveMapPath(sRawMap, sMap, sizeof(sMap));
CreateDirectory("configs/rpg_garbage", 511);
char sPath[PLATFORM_MAX_PATH];
BuildPath(Path_SM, sPath, sizeof(sPath), "configs/rpg_garbage/%s.txt", sMap);
Handle hFile = OpenFile(sPath, "w");
if (hFile != INVALID_HANDLE)
{
for (int i = 0; i < g_iLoadedGarbage; i++) {
WriteFileLine(hFile, "%.2f;%.2f;%.2f;", g_eGarbageSpawnPoints[i][gXPos], g_eGarbageSpawnPoints[i][gYPos], g_eGarbageSpawnPoints[i][gZPos]);
}
CloseHandle(hFile);
}
if (!FileExists(sPath))
LogError("Couldn't save item spawns to file: \"%s\".", sPath);
}
public void AddLootSpawn(int client)
{
float pos[3];
GetClientAbsOrigin(client, pos);
TE_SetupGlowSprite(pos, g_iBlueGlow, 10.0, 1.0, 235);
TE_SendToAll();
g_eGarbageSpawnPoints[g_iLoadedGarbage][gXPos] = pos[0];
g_eGarbageSpawnPoints[g_iLoadedGarbage][gYPos] = pos[1];
g_eGarbageSpawnPoints[g_iLoadedGarbage][gZPos] = pos[2];
g_iLoadedGarbage++;
PrintToChat(client, "Added new loot spawn at %.2f:%.2f:%.2f, for type: rpg_garbage", pos[0], pos[1], pos[2]);
saveGarbageSpawnPoints();
}
public Action addSpawnPoints(int client, int args) {
addSpawnPointsMenu(client, args);
return Plugin_Handled;
}
public Action addSpawnPointsMenu(int client, int args)
{
char garbageText[64];
Format(garbageText, sizeof(garbageText), "Spawn: Garbage (%i)", g_iLoadedGarbage);
Handle panel = CreatePanel();
SetPanelTitle(panel, "Add a Spawnpoint");
DrawPanelText(panel, "x-x-x-x-x-x-x-x-x-x");
DrawPanelItem(panel, garbageText);
DrawPanelText(panel, "-------------");
DrawPanelItem(panel, "Show Spawns");
DrawPanelItem(panel, "Close");
DrawPanelText(panel, "x-x-x-x-x-x-x-x-x-x");
SendPanelToClient(panel, client, addSpawnPointsMenuHandler, 30);
CloseHandle(panel);
return Plugin_Handled;
}
public int addSpawnPointsMenuHandler(Handle menu, MenuAction action, int client, int item) {
if (action == MenuAction_Select) {
if (item == 1) {
AddLootSpawn(client);
addSpawnPointsMenu(client, 0);
} else if (item == 2) {
ShowSpawns();
addSpawnPointsMenu(client, 0);
}
}
if (action == MenuAction_End) {
delete menu;
}
}
public void ShowSpawns() {
for (int i = 0; i < g_iLoadedGarbage; i++) {
float pos[3];
pos[0] = g_eGarbageSpawnPoints[i][gXPos];
pos[1] = g_eGarbageSpawnPoints[i][gYPos];
pos[2] = g_eGarbageSpawnPoints[i][gZPos];
TE_SetupGlowSprite(pos, g_iBlueGlow, 10.0, 1.0, 235);
TE_SendToAll();
}
}
public int getActiveGarbage() {
int count = 0;
for (int i = 0; i < g_iLoadedGarbage; i++) {
if (g_eGarbageSpawnPoints[i][gIsActive])
count++;
}
return count;
}
public void OnNpcInteract(int client, char npcType[64], char UniqueId[128], int entIndex) {
if (!StrEqual(npcType, "Garbagerman Recruiter"))
return;
char activeJob[128];
jobs_getActiveJob(client, activeJob);
Menu panel = CreateMenu(JobPanelHandler);
if (StrEqual(activeJob, "") || !jobs_isActiveJob(client, "Garbage Collector")) {
SetMenuTitle(panel, "You already have a job! Want to quit it and becoma a Garbage Collector?");
AddMenuItem(panel, "x", "No");
AddMenuItem(panel, "x", "Not now.");
AddMenuItem(panel, "givejob", "Yes");
} else if (jobs_isActiveJob(client, "Garbage Collector")) {
SetMenuTitle(panel, "Welcome Garbageman!");
if (inventory_hasPlayerItem(client, "Garbage"))
AddMenuItem(panel, "recycle", "Hand in Garbage");
else
AddMenuItem(panel, "x", "Hand in Garbage", ITEMDRAW_DISABLED);
if (inventory_hasPlayerItem(client, "Garbage")) {
char sellAll[256];
int itemamount = inventory_getPlayerItemAmount(client, "Garbage");
Format(sellAll, sizeof(sellAll), "Recycle %i Garbage", itemamount);
AddMenuItem(panel, "recycleAll", sellAll);
}
AddMenuItem(panel, "skin1", "First Garbage Collector Skin [2](500$)", tConomy_getCurrency(client) >= 500 && jobs_getLevel(client) >= 2 ? ITEMDRAW_DEFAULT : ITEMDRAW_DISABLED);
if (tConomy_getCurrency(client) >= 15000 && jobs_getLevel(client) >= 20 && jobs_getActiveJob(client, "Garbage Collector"))
AddMenuItem(panel, "skin", "Buy Ellis Skin (15000$)[20]");
else
AddMenuItem(panel, "skin", "Buy Ellis Skin (15000$)[20]", ITEMDRAW_DISABLED);
}
DisplayMenu(panel, client, 60);
}
public int JobPanelHandler(Handle menu, MenuAction action, int client, int item) {
if (action == MenuAction_Select) {
char cValue[32];
GetMenuItem(menu, item, cValue, sizeof(cValue));
if (StrEqual(cValue, "givejob")) {
jobs_giveJob(client, "Garbage Collector");
} else if (StrEqual(cValue, "recycle")) {
if (inventory_hasPlayerItem(client, "Garbage")) {
tConomy_addCurrency(client, 75, "Recycled Garbage");
inventory_removePlayerItems(client, "Garbage", 1, "Recycled");
int xpAmount = 40;
if (perks_hasPerk(client, "More XP 3"))
xpAmount = RoundToCeil(float(xpAmount) * 1.15);
else if (perks_hasPerk(client, "More XP 2"))
xpAmount = RoundToCeil(float(xpAmount) * 1.1);
else if (perks_hasPerk(client, "More XP 1"))
xpAmount = RoundToCeil(float(xpAmount) * 1.05);
jobs_addExperience(client, xpAmount, "Garbage Collector");
}
} else if (StrEqual(cValue, "recycleAll")) {
int itemamount = inventory_getPlayerItemAmount(client, "Garbage");
if (inventory_removePlayerItems(client, "Garbage", itemamount, "Recycled Garbage (Mass)")) {
tConomy_addCurrency(client, 75 * itemamount, "Recycled Garbage");
int xpAmount = 40;
if (perks_hasPerk(client, "More XP 3"))
xpAmount = RoundToCeil(float(xpAmount) * 1.15);
else if (perks_hasPerk(client, "More XP 2"))
xpAmount = RoundToCeil(float(xpAmount) * 1.1);
else if (perks_hasPerk(client, "More XP 1"))
xpAmount = RoundToCeil(float(xpAmount) * 1.05);
jobs_addExperience(client, xpAmount * itemamount, "Garbage Collector");
}
} else if (StrEqual(cValue, "skin") && tConomy_getCurrency(client) >= 15000 && jobs_getLevel(client) >= 20 && jobs_isActiveJob(client, "Garbage Collector")) {
tConomy_removeCurrency(client, 15000, "Bought Skin");
inventory_givePlayerItem(client, "Ellis", 0, "", "Skin", "Skin", 1, "Bought from Garbage Collector");
} else if (StrEqual(cValue, "skin1") && tConomy_getCurrency(client) >= 500 && jobs_getLevel(client) >= 2 && jobs_isActiveJob(client, "Garbage Collector")) {
tConomy_removeCurrency(client, 500, "Bought Skin");
inventory_givePlayerItem(client, "Dustman", 0, "", "Skin", "Skin", 1, "Bought from Garbage Collector");
}
}
if (action == MenuAction_End) {
delete menu;
}
}
public void OnClientPostAdminCheck(int client) {
resetAmountVars();
g_iSpeedTimeLeft[client] = -1;
}
public void resetAmountVars() {
int amount;
if ((amount = GetRealClientCount()) != 0) {
g_iMaxGarbageSpawns = amount;
amount /= 3;
g_iBaseGarbageSpawns = amount <= 3 ? 3:amount;
} else {
g_iBaseGarbageSpawns = 1;
g_iMaxGarbageSpawns = 5;
}
}
public int GetRealClientCount() {
int total = 0;
for (int i = 1; i <= MaxClients; i++)
if (IsClientConnected(i) && !IsFakeClient(i))
total++;
return total;
}