Change SetEntData to SetEntProp, Fix giving helmet wrongly.
3 * Adds preset spawning to CS:S DM.
4 * This file is part of CS:S DM, Copyright (C) 2005-2007 AlliedModders LLC
5 * by David "BAILOPAN" Anderson, http://www.bailopan.net/cssdm/
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
29 #define CSSDM_GUNMENU_NO 0
30 #define CSSDM_GUNMENU_YES 1
31 #define CSSDM_GUNMENU_RANDOM 2
34 new Handle:cssdm_enable_equipment; /** cssdm_enable_equipment cvar */
35 new Handle:g_SpawnTimers[MAXPLAYERS+1]; /* Post-spawn timers */
36 new Handle:g_hPrimaryMenu = INVALID_HANDLE; /* Priamry menu Handle */
37 new Handle:g_hSecondaryMenu = INVALID_HANDLE; /* Secondary menu Handle */
38 new Handle:g_hEquipMenu = INVALID_HANDLE; /* Main equipment menu */
39 new bool:g_IsEnabled = false; /* Whether the plugin should work */
40 new g_PrimaryChoices[MAXPLAYERS+1]; /* Primary weapon selections */
41 new g_SecondaryChoices[MAXPLAYERS+1]; /* Secondary weapon selections */
42 new bool:g_GunMenuEnabled[MAXPLAYERS+1]; /* Whether the gun menu is enabled */
43 new bool:g_GunMenuAvailable[MAXPLAYERS+1]; /* Whether the gun menu is available */
44 new bool:g_bIsGo = false; /* Are we running on CS:GO? */
47 new g_PrimaryList[CSSDM_MAX_WEAPONS];
48 new g_SecondaryList[CSSDM_MAX_WEAPONS];
49 new g_PrimaryCount = 0;
50 new g_SecondaryCount = 0;
51 new g_PrimaryMenu = CSSDM_GUNMENU_YES;
52 new g_SecondaryMenu = CSSDM_GUNMENU_YES;
53 new bool:g_AllowBuy = false;
54 new g_ArmorAmount = 100;
55 new bool:g_Helmets = true;
57 new bool:g_Smokes = false;
58 new bool:g_HEs = false;
59 new bool:g_NightVision = false;
60 new bool:g_DefuseKits = true;
61 new bool:g_AllowGunCommand = true;
62 new g_HealthAmount = 100;
64 new bool:g_Decoy = false;
65 new bool:g_Taser = true;
68 new g_BotPrimaryList[CSSDM_MAX_WEAPONS];
69 new g_BotSecondaryList[CSSDM_MAX_WEAPONS];
70 new g_BotPrimaryCount = 0;
71 new g_BotSecondaryCount = 0;
73 new bool:g_BotHelmets = false;
75 new bool:g_BotSmokes = false;
76 new bool:g_BotHEs = false;
77 new bool:g_BotDefuseKits = true;
78 new g_BotHealthAmount = 100;
80 new bool:g_BotDecoy = false;
81 new bool:g_BotTaser = true;
84 public Plugin:myinfo =
86 name = "CS:S DM Equipment",
87 author = "AlliedModders LLC",
88 description = "Adds gun menu/equipment to CS:S DM",
89 version = CSSDM_VERSION,
90 url = "http://www.bailopan.net/cssdm/"
97 public OnPluginStart()
100 GetGameFolderName(game, sizeof(game));
101 if (StrEqual(game, "csgo", false))
106 LoadTranslations("cssdm.phrases");
108 RegConsoleCmd("say", Command_Say);
109 RegConsoleCmd("say_team", Command_Say);
111 cssdm_enable_equipment = CreateConVar("cssdm_enable_equipment", "1", "Sets whether the equipment plugin is enabled");
112 HookConVarChange(cssdm_enable_equipment, OnEquipmentEnableChange);
114 g_hEquipMenu = CreateMenu(Menu_EquipHandler, MenuAction_DrawItem|MenuAction_DisplayItem);
115 SetMenuTitle(g_hEquipMenu, "Weapon Options:");
116 SetMenuExitButton(g_hEquipMenu, false);
117 AddMenuItem(g_hEquipMenu, "", "New weapons");
118 AddMenuItem(g_hEquipMenu, "", "Same weapons");
119 AddMenuItem(g_hEquipMenu, "", "Same weapons every time");
120 AddMenuItem(g_hEquipMenu, "", "Random weapons");
121 AddMenuItem(g_hEquipMenu, "", "Random weapons every time");
124 public OnEquipmentEnableChange(Handle:convar, const String:oldValue[], const String:newValue[])
126 g_IsEnabled = StringToInt(newValue) ? true : false;
129 public OnConfigsExecuted()
133 if ((g_IsEnabled = LoadConfigFile("cfg/cssdm/cssdm.equip.txt")) == false)
135 LogError("[CSSDM] Could not find equipment file \"%s\"", "cfg/cssdm/cssdm.equip.txt");
139 if (!GetConVarInt(cssdm_enable_equipment))
145 /** See if there is a map version */
147 decl String:path[255];
148 GetCurrentMap(map, sizeof(map));
149 Format(path, sizeof(path), "cfg/cssdm/maps/%s.equip.txt", map);
151 if (FileExists(path))
153 LoadConfigFile(path);
157 public Action:DM_OnClientDeath(client)
159 if (g_SpawnTimers[client] != INVALID_HANDLE)
161 KillTimer(g_SpawnTimers[client]);
162 g_SpawnTimers[client] = INVALID_HANDLE;
164 g_GunMenuAvailable[client] = true;
167 public OnClientPutInServer(client)
169 g_GunMenuEnabled[client] = true;
170 g_GunMenuAvailable[client] = true;
171 g_PrimaryChoices[client] = -1;
172 g_SecondaryChoices[client] = -1;
175 public OnClientDisconnect(client)
177 if (g_SpawnTimers[client] != INVALID_HANDLE)
179 KillTimer(g_SpawnTimers[client]);
180 g_SpawnTimers[client] = INVALID_HANDLE;
184 public DM_OnClientSpawned(client)
191 if (!IsFakeClient(client))
193 if (g_ArmorAmount > 0)
195 GivePlayerItem(client, "item_kevlar");
196 GivePlayerItem(client, "item_kevlar");
197 SetClientArmor(client, g_ArmorAmount);
199 if (g_HealthAmount > 0)
201 SetClientHealth(client, g_HealthAmount);
205 if (g_ArmorAmount > 0)
207 GivePlayerItem(client, "item_assaultsuit");
208 GivePlayerItem(client, "item_assaultsuit");
209 SetClientArmor(client, g_ArmorAmount);
213 GiveGrenades(client, g_Flashes, g_HEs, g_Smokes, g_Decoy);
216 GiveNightVision(client);
218 if (g_bIsGo && g_Taser)
220 GivePlayerItem(client, "weapon_taser");
225 /* See if we'll need to strip this bot */
226 if (g_BotSecondaryCount || g_BotPrimaryCount)
228 DM_StripBotItems(client);
232 GivePlayerItem(client, "item_kevlar");
233 GivePlayerItem(client, "item_kevlar");
234 SetClientArmor(client, g_BotArmor);
236 /* Make sure bot didn't buy armor */
237 SetClientArmor(client, 0);
239 if (g_BotHealthAmount > 0)
241 SetClientHealth(client, g_BotHealthAmount);
247 GivePlayerItem(client, "item_assaultsuit");
248 GivePlayerItem(client, "item_assaultsuit");
249 SetClientArmor(client, g_BotArmor);
253 if (g_bIsGo && g_BotTaser)
255 GivePlayerItem(client, "weapon_taser");
257 GiveGrenades(client, g_BotFlashes, g_BotHEs, g_BotSmokes, g_BotDecoy);
259 if (!g_AllowBuy && g_SpawnTimers[client] == INVALID_HANDLE)
261 /* Small delay - we want to avoid ResetHUD */
262 g_SpawnTimers[client] = CreateTimer(0.1, PlayerPostSpawn, client);
266 public Action:PlayerPostSpawn(Handle:timer, any:client)
268 g_SpawnTimers[client] = INVALID_HANDLE;
275 if (IsFakeClient(client))
277 if (g_BotSecondaryCount > 0)
280 if (g_BotSecondaryCount == 1)
282 index = g_BotSecondaryList[0];
284 index = GetRandomInt(0, g_BotSecondaryCount-1);
285 index = g_BotSecondaryList[index];
287 decl String:classname[64];
288 DM_GetWeaponClassname(index, classname, sizeof(classname));
289 GivePlayerItem(client, classname);
291 if (g_BotPrimaryCount > 0)
294 if (g_BotPrimaryCount == 1)
296 index = g_BotPrimaryList[0];
298 index = GetRandomInt(0, g_BotPrimaryCount-1);
299 index = g_BotPrimaryList[index];
301 decl String:classname[64];
302 DM_GetWeaponClassname(index, classname, sizeof(classname));
303 GivePlayerItem(client, classname);
305 if (g_BotDefuseKits && GetClientTeam(client) == CSSDM_TEAM_CT)
307 GivePlayerItem(client, "item_defuser");
310 if (g_DefuseKits && GetClientTeam(client) == CSSDM_TEAM_CT)
312 GivePlayerItem(client, "item_defuser");
316 /* First, check if we should only be giving one of something automatically */
317 if ((g_SecondaryMenu == CSSDM_GUNMENU_RANDOM || g_SecondaryMenu == CSSDM_GUNMENU_YES)
318 && g_SecondaryCount == 1)
320 GiveSecondary(client, 0);
322 } else if (g_PrimaryMenu == CSSDM_GUNMENU_RANDOM && g_PrimaryCount > 1) {
323 GivePrimary(client, g_PrimaryCount);
327 if ((g_PrimaryMenu == CSSDM_GUNMENU_RANDOM || g_PrimaryMenu == CSSDM_GUNMENU_YES)
328 && g_PrimaryCount == 1)
330 GivePrimary(client, 0);
332 } else if (g_SecondaryMenu == CSSDM_GUNMENU_RANDOM && g_SecondaryCount > 1) {
333 GiveSecondary(client, g_SecondaryCount);
337 /* If we've already given two weapons, there is no need for a menu. */
343 if (g_GunMenuEnabled[client])
345 DisplayMenu(g_hEquipMenu, client, MENU_TIME_FOREVER);
347 GiveBothFromChoices(client);
354 public Action:Command_Say(client, args)
358 return Plugin_Continue;
361 new String:text[192];
362 GetCmdArg(1, text, sizeof(text));
364 if (strcmp(text, "guns") == 0)
366 if (!g_AllowGunCommand)
368 PrintToChat(client, "[CSSDM] %t", "GunsMenuDisabled");
369 return Plugin_Handled;
372 if (!ChooseFromSecondary() && !ChooseFromPrimary())
374 PrintToChat(client, "[CSSDM] %t", "GunsMenuNotAvailable");
375 return Plugin_Handled;
378 if (g_GunMenuEnabled[client])
380 PrintToChat(client, "[CSSDM] %t", "GunsMenuAlreadyEnabled");
381 return Plugin_Handled;
384 g_GunMenuEnabled[client] = true;
385 if (!g_GunMenuAvailable[client])
387 PrintToChat(client, "[CSSDM] %t", "GunsMenuReactivated");
389 DisplayMenu(g_hEquipMenu, client, MENU_TIME_FOREVER);
392 return Plugin_Handled;
395 return Plugin_Continue;
398 public Action:OnClientCommand(client, args)
400 if (!ShouldRun() || g_AllowBuy)
402 return Plugin_Continue;
406 GetCmdArg(0, cmd, sizeof(cmd));
408 if (StrEqual(cmd, "buy")
409 || StrEqual(cmd, "autobuy")
410 || StrEqual(cmd, "rebuy")
411 || StrEqual(cmd, "buyequip")
412 || StrEqual(cmd, "buymenu"))
414 return Plugin_Handled;
417 return Plugin_Continue;
420 public Menu_EquipHandler(Handle:menu, MenuAction:action, param1, param2)
427 if (action == MenuAction_DrawItem)
429 if (param2 == 1 || param2 == 2)
431 if (g_PrimaryChoices[param1] == -1 && g_SecondaryChoices[param1] == -1)
433 return ITEMDRAW_DISABLED;
436 return ITEMDRAW_DEFAULT;
438 else if (action == MenuAction_Select)
442 if (ChooseFromSecondary())
444 DisplayMenu(g_hSecondaryMenu, param1, MENU_TIME_FOREVER);
445 } else if (ChooseFromPrimary()) {
446 DisplayMenu(g_hPrimaryMenu, param1, MENU_TIME_FOREVER);
448 } else if (param2 == 1) {
449 GiveBothFromChoices(param1);
450 } else if (param2 == 2) {
451 GiveBothFromChoices(param1);
452 g_GunMenuEnabled[param1] = false;
453 PrintToChat(param1, "[CSSDM] %t", "SayGunsNotify");
454 } else if (param2 == 3) {
455 GivePrimary(param1, g_PrimaryCount);
456 GiveSecondary(param1, g_SecondaryCount);
457 } else if (param2 == 4) {
458 GivePrimary(param1, g_PrimaryCount);
459 GiveSecondary(param1, g_SecondaryCount);
460 GiveBothFromChoices(param1);
461 g_GunMenuEnabled[param1] = false;
462 PrintToChat(param1, "[CSSDM] %t", "SayGunsNotify");
464 g_GunMenuAvailable[param1] = false;
466 else if (action == MenuAction_DisplayItem)
469 decl String:info[12], String:lang_phrase[32];
471 if (!GetMenuItem(menu, param2, info, sizeof(info), style, lang_phrase, sizeof(lang_phrase)))
476 decl String:t_phrase[64];
477 Format(t_phrase, sizeof(t_phrase), "%T", lang_phrase, param1);
479 return RedrawMenuItem(t_phrase);
485 public Menu_PrimaryHandler(Handle:menu, MenuAction:action, param1, param2)
492 if (action == MenuAction_DrawItem)
494 return ITEMDRAW_DEFAULT;
496 else if (action == MenuAction_Select)
498 GivePrimary(param1, param2);
500 else if (action == MenuAction_Display)
502 new Handle:hPanel = Handle:param2;
503 decl String:title[128];
505 Format(title, sizeof(title), "%T:", "Primary weapon", param1);
507 SetPanelTitle(hPanel, title);
513 public Menu_SecondaryHandler(Handle:menu, MenuAction:action, param1, param2)
520 if (action == MenuAction_DrawItem)
522 return ITEMDRAW_DEFAULT;
524 else if (action == MenuAction_Select)
526 GiveSecondary(param1, param2);
527 if (ChooseFromPrimary())
529 DisplayMenu(g_hPrimaryMenu, param1, MENU_TIME_FOREVER);
532 else if (action == MenuAction_Cancel
533 && param2 == MenuCancel_Exit)
535 if (ChooseFromPrimary())
537 DisplayMenu(g_hPrimaryMenu, param1, MENU_TIME_FOREVER);
540 else if (action == MenuAction_Display)
542 new Handle:hPanel = Handle:param2;
543 decl String:title[128];
545 Format(title, sizeof(title), "%T:", "Secondary weapon", param1);
547 SetPanelTitle(hPanel, title);
553 bool:ChooseFromPrimary()
555 return (g_PrimaryMenu == CSSDM_GUNMENU_YES
556 && g_PrimaryCount > 1);
559 bool:ChooseFromSecondary()
561 return (g_SecondaryMenu == CSSDM_GUNMENU_YES
562 && g_SecondaryCount > 1);
565 GiveWeapon(client, index)
567 if (!IsPlayerAlive(client))
572 new DmWeaponType:type = DM_GetWeaponType(index);
574 new entity = DM_GetClientWeapon(client, type);
577 DM_DropWeapon(client, entity);
581 DM_GetWeaponClassname(index, cls, sizeof(cls));
583 GivePlayerItem(client, cls);
586 GiveBothFromChoices(client)
588 if (ChooseFromPrimary())
590 GivePrimary(client, g_PrimaryChoices[client]);
593 if (ChooseFromSecondary())
595 GiveSecondary(client, g_SecondaryChoices[client]);
600 * Gives a primary weapon to a client.
601 * If the list_index is > the count, we choose one randomly.
602 * This is a hack so we can append "Random" to the choice list.
604 GivePrimary(client, list_index)
612 if (list_index >= g_PrimaryCount)
614 if (g_PrimaryCount > 1)
616 weapon_index = GetRandomInt(0, g_PrimaryCount-1);
617 weapon_index = g_PrimaryList[weapon_index];
618 } else if (g_PrimaryCount == 1) {
619 weapon_index = g_PrimaryList[0];
624 weapon_index = g_PrimaryList[list_index];
627 g_PrimaryChoices[client] = list_index;
629 GiveWeapon(client, weapon_index);
633 * Gives a secondary weapon to a client.
634 * If the list_index is > the count, we choose one randomly.
635 * This is a hack so we can append "Random" to the choice list.
637 GiveSecondary(client, list_index)
645 if (list_index >= g_SecondaryCount)
647 if (g_SecondaryCount > 1)
649 weapon_index = GetRandomInt(0, g_SecondaryCount-1);
650 weapon_index = g_SecondaryList[weapon_index];
651 } else if (g_SecondaryCount == 1) {
652 weapon_index = g_SecondaryList[0];
657 weapon_index = g_SecondaryList[list_index];
660 g_SecondaryChoices[client] = list_index;
662 GiveWeapon(client, weapon_index);
667 return (DM_IsRunning() && g_IsEnabled);
670 bool:KvGetYesOrNo(Handle:kv, const String:key[], bool:curdefault)
672 decl String:value[12];
673 KvGetString(kv, key, value, sizeof(value), curdefault ? "yes" : "no");
674 return (strcmp(value, "yes") == 0);
677 KvGetGunMenu(Handle:kv, const String:key[], def)
679 decl String:sdef[12];
680 if (def == CSSDM_GUNMENU_YES)
682 strcopy(sdef, sizeof(sdef), "yes");
683 } else if (def == CSSDM_GUNMENU_RANDOM) {
684 strcopy(sdef, sizeof(sdef), "random");
686 strcopy(sdef, sizeof(sdef), "no");
689 decl String:value[12];
690 KvGetString(kv, key, value, sizeof(value), sdef);
692 if (strcmp(value, "yes") == 0)
694 return CSSDM_GUNMENU_YES;
695 } else if (strcmp(value, "random") == 0) {
696 return CSSDM_GUNMENU_RANDOM;
699 return CSSDM_GUNMENU_NO;
704 g_PrimaryMenu = CSSDM_GUNMENU_YES;
705 g_SecondaryMenu = CSSDM_GUNMENU_YES;
712 g_NightVision = false;
714 g_HealthAmount = 100;
715 g_AllowGunCommand = true;
718 bool:LoadConfigFile(const String:path[])
720 new Handle:kv = CreateKeyValues("Equipment");
721 if (!FileToKeyValues(kv, path))
726 decl String:value[255];
729 if (KvJumpToKey(kv, "Settings"))
731 g_AllowGunCommand = KvGetYesOrNo(kv, "guns_command", g_AllowGunCommand);
735 /* Load menu options */
736 if (KvJumpToKey(kv, "Menus"))
738 g_PrimaryMenu = KvGetGunMenu(kv, "primary", g_PrimaryMenu);
739 g_SecondaryMenu = KvGetGunMenu(kv, "secondary", g_SecondaryMenu);
740 g_AllowBuy = KvGetYesOrNo(kv, "buy", g_AllowBuy);
744 /* Load automatic stuff */
745 if (KvJumpToKey(kv, "AutoItems"))
747 g_ArmorAmount = KvGetNum(kv, "armor", g_ArmorAmount);
748 g_Flashes = KvGetNum(kv, "flashbangs", g_Flashes);
749 g_Helmets = KvGetYesOrNo(kv, "helmet", g_Helmets);
750 g_Smokes = KvGetYesOrNo(kv, "smokegrenade", g_Smokes);
751 g_HEs = KvGetYesOrNo(kv, "hegrenade", g_HEs);
752 g_NightVision = KvGetYesOrNo(kv, "nightvision", g_NightVision);
753 g_DefuseKits = KvGetYesOrNo(kv, "defusekits", g_DefuseKits);
754 g_HealthAmount = KvGetNum(kv, "health", g_HealthAmount);
755 g_Decoy = KvGetYesOrNo(kv, "decoy", g_Decoy);
756 g_Taser = KvGetYesOrNo(kv, "taser", g_Taser);
761 if (KvJumpToKey(kv, "BotItems"))
763 /* Clear out old lists first */
764 g_BotPrimaryCount = 0;
765 g_BotSecondaryCount = 0;
767 if (KvGotoFirstSubKey(kv, false))
771 KvGetSectionName(kv, value, sizeof(value));
772 if (strcmp(value, "weapon") == 0)
774 KvGetString(kv, NULL_STRING, value, sizeof(value));
775 new index = DM_GetWeaponID(value);
778 new DmWeaponType:type = DM_GetWeaponType(index);
779 if (type == DmWeapon_Primary && g_BotPrimaryCount < CSSDM_MAX_WEAPONS)
781 g_BotPrimaryList[g_BotPrimaryCount++] = index;
782 } else if (type == DmWeapon_Secondary && g_BotSecondaryCount < CSSDM_MAX_WEAPONS) {
783 g_BotSecondaryList[g_BotSecondaryCount++] = index;
786 } else if (strcmp(value, "armor") == 0) {
787 g_BotArmor = KvGetNum(kv, NULL_STRING, 100);
788 } else if (strcmp(value, "helmet") == 0) {
789 g_BotHelmets = KvGetYesOrNo(kv, NULL_STRING, true);
790 } else if (strcmp(value, "flashbangs") == 0) {
791 g_BotFlashes = KvGetNum(kv, NULL_STRING);
792 } else if (strcmp(value, "smokegrenade") == 0) {
793 g_BotSmokes = KvGetYesOrNo(kv, NULL_STRING, false);
794 } else if (strcmp(value, "hegrenade") == 0) {
795 g_BotHEs = KvGetYesOrNo(kv, NULL_STRING, false);
796 } else if (strcmp(value, "defusekits") == 0) {
797 g_BotDefuseKits = KvGetYesOrNo(kv, NULL_STRING, true);
798 } else if (strcmp(value, "health") == 0) {
799 g_BotHealthAmount = KvGetNum(kv, NULL_STRING, 100);
800 } else if (strcmp(value, "decoy") == 0) {
801 g_BotDecoy = KvGetYesOrNo(kv, NULL_STRING, false);
802 } else if (strcmp(value, "taser") == 0) {
803 g_BotTaser = KvGetYesOrNo(kv, NULL_STRING, true);
805 } while (KvGotoNextKey(kv, false));
811 /* Load secondary weapons */
812 if (KvJumpToKey(kv, "SecondaryMenu"))
814 /* Clear out old list first */
815 g_SecondaryCount = 0;
817 if (KvGotoFirstSubKey(kv, false))
821 KvGetSectionName(kv, value, sizeof(value));
822 if (strcmp(value, "weapon") == 0)
824 KvGetString(kv, NULL_STRING, value, sizeof(value));
825 new index = DM_GetWeaponID(value);
826 if (index != -1 && DM_GetWeaponType(index) == DmWeapon_Secondary)
828 g_SecondaryList[g_SecondaryCount++] = index;
831 } while (KvGotoNextKey(kv, false) && g_SecondaryCount < CSSDM_MAX_WEAPONS);
837 /* Load primary weapons */
838 if (KvJumpToKey(kv, "PrimaryMenu"))
840 /* Clear out old list first */
843 if (KvGotoFirstSubKey(kv, false))
847 KvGetSectionName(kv, value, sizeof(value));
848 if (strcmp(value, "weapon") == 0)
850 KvGetString(kv, NULL_STRING, value, sizeof(value));
851 new index = DM_GetWeaponID(value);
852 if (index != -1 && DM_GetWeaponType(index) == DmWeapon_Primary)
854 g_PrimaryList[g_PrimaryCount++] = index;
857 } while (KvGotoNextKey(kv, false) && g_PrimaryCount < CSSDM_MAX_WEAPONS);
865 /* Build the primary menu */
866 if (g_hPrimaryMenu != INVALID_HANDLE)
868 CloseHandle(g_hPrimaryMenu);
870 g_hPrimaryMenu = CreateMenu(Menu_PrimaryHandler, MenuAction_DrawItem|MenuAction_Display);
871 SetMenuTitle(g_hPrimaryMenu, "Primary weapon:");
872 for (new i=0; i<g_PrimaryCount; i++)
874 new index = g_PrimaryList[i];
875 DM_GetWeaponName(index, value, sizeof(value));
876 AddMenuItem(g_hPrimaryMenu, "", value);
878 AddMenuItem(g_hPrimaryMenu, "", "Random");
880 /* Build the secondary menu */
881 if (g_hSecondaryMenu != INVALID_HANDLE)
883 CloseHandle(g_hSecondaryMenu);
885 g_hSecondaryMenu = CreateMenu(Menu_SecondaryHandler, MenuAction_DrawItem|MenuAction_Display);
886 SetMenuTitle(g_hSecondaryMenu, "Secondary weapon:");
887 for (new i=0; i<g_SecondaryCount; i++)
889 new index = g_SecondaryList[i];
890 DM_GetWeaponName(index, value, sizeof(value));
891 AddMenuItem(g_hSecondaryMenu, "", value);
893 AddMenuItem(g_hSecondaryMenu, "", "Random");
898 SetClientArmor(client, armor)
900 SetEntProp(client, Prop_Send, "m_ArmorValue", armor);
903 SetClientHealth(client, health)
905 SetEntProp(client, Prop_Send, "m_iHealth", health);
908 GiveGrenades(client, flashnum, bool:he, bool:smoke, bool:decoy)
910 if (!IsPlayerAlive(client))
917 GivePlayerItem(client, "weapon_hegrenade");
919 for (new i=0; i<flashnum; i++)
921 GivePlayerItem(client, "weapon_flashbang");
925 GivePlayerItem(client, "weapon_smokegrenade");
927 if (g_bIsGo && decoy)
929 GivePlayerItem(client, "weapon_decoy");
933 GiveNightVision(client)
935 SetEntProp(client, Prop_Send, "m_bHasNightVision", true);
939 SetEntProp(client, Prop_Send, "m_bHasHelmet", true);