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 g_ArmorOffset = -1; /* m_ArmorValue offset */
36 new g_NVOffset = -1; /* m_bHasNightVision offset */
37 new g_HealthOffset = -1; /* m_iHealth offset */
38 new Handle:g_SpawnTimers[MAXPLAYERS+1]; /* Post-spawn timers */
39 new Handle:g_hPrimaryMenu = INVALID_HANDLE; /* Priamry menu Handle */
40 new Handle:g_hSecondaryMenu = INVALID_HANDLE; /* Secondary menu Handle */
41 new Handle:g_hEquipMenu = INVALID_HANDLE; /* Main equipment menu */
42 new bool:g_IsEnabled = false; /* Whether the plugin should work */
43 new g_PrimaryChoices[MAXPLAYERS+1]; /* Primary weapon selections */
44 new g_SecondaryChoices[MAXPLAYERS+1]; /* Secondary weapon selections */
45 new bool:g_GunMenuEnabled[MAXPLAYERS+1]; /* Whether the gun menu is enabled */
46 new bool:g_GunMenuAvailable[MAXPLAYERS+1]; /* Whether the gun menu is available */
49 new g_PrimaryList[CSSDM_MAX_WEAPONS];
50 new g_SecondaryList[CSSDM_MAX_WEAPONS];
51 new g_PrimaryCount = 0;
52 new g_SecondaryCount = 0;
53 new g_PrimaryMenu = CSSDM_GUNMENU_YES;
54 new g_SecondaryMenu = CSSDM_GUNMENU_YES;
55 new bool:g_AllowBuy = false;
56 new g_ArmorAmount = 100;
57 new bool:g_Helmets = true;
59 new bool:g_Smokes = false;
60 new bool:g_HEs = false;
61 new bool:g_NightVision = false;
62 new bool:g_DefuseKits = true;
63 new bool:g_AllowGunCommand = true;
64 new g_HealthAmount = 100;
67 new g_BotPrimaryList[CSSDM_MAX_WEAPONS];
68 new g_BotSecondaryList[CSSDM_MAX_WEAPONS];
69 new g_BotPrimaryCount = 0;
70 new g_BotSecondaryCount = 0;
72 new bool:g_BotHelmets = false;
74 new bool:g_BotSmokes = false;
75 new bool:g_BotHEs = false;
76 new bool:g_BotDefuseKits = true;
77 new g_BotHealthAmount = 100;
80 public Plugin:myinfo =
82 name = "CS:S DM Equipment",
83 author = "AlliedModders LLC",
84 description = "Adds gun menu/equipment to CS:S DM",
85 version = CSSDM_VERSION,
86 url = "http://www.bailopan.net/cssdm/"
93 public OnPluginStart()
95 LoadTranslations("cssdm.phrases");
97 RegConsoleCmd("say", Command_Say);
98 RegConsoleCmd("say_team", Command_Say);
100 cssdm_enable_equipment = CreateConVar("cssdm_enable_equipment", "1", "Sets whether the equipment plugin is enabled");
101 HookConVarChange(cssdm_enable_equipment, OnEquipmentEnableChange);
103 g_ArmorOffset = FindSendPropOffs("CCSPlayer", "m_ArmorValue");
104 g_NVOffset = FindSendPropOffs("CCSPlayer", "m_bHasNightVision");
105 g_HealthOffset = FindSendPropOffs("CCSPlayer", "m_iHealth");
107 g_hEquipMenu = CreateMenu(Menu_EquipHandler, MenuAction_DrawItem);
108 SetMenuTitle(g_hEquipMenu, "Weapon Options:");
109 SetMenuExitButton(g_hEquipMenu, false);
110 AddMenuItem(g_hEquipMenu, "", "New weapons");
111 AddMenuItem(g_hEquipMenu, "", "Same weapons");
112 AddMenuItem(g_hEquipMenu, "", "Same weapons every time");
113 AddMenuItem(g_hEquipMenu, "", "Random weapons");
114 AddMenuItem(g_hEquipMenu, "", "Random weapons every time");
117 public OnEquipmentEnableChange(Handle:convar, const String:oldValue[], const String:newValue[])
119 g_IsEnabled = StringToInt(newValue) ? true : false;
122 public OnConfigsExecuted()
126 if ((g_IsEnabled = LoadConfigFile("cfg/cssdm/cssdm.equip.txt")) == false)
128 LogError("[CSSDM] Could not find equipment file \"%s\"", "cfg/cssdm/cssdm.equip.txt");
132 if (!GetConVarInt(cssdm_enable_equipment))
138 /** See if there is a map version */
140 decl String:path[255];
141 GetCurrentMap(map, sizeof(map));
142 Format(path, sizeof(path), "cfg/cssdm/maps/%s.equip.txt", map);
144 if (FileExists(path))
146 LoadConfigFile(path);
150 public Action:DM_OnClientDeath(client)
152 if (g_SpawnTimers[client] != INVALID_HANDLE)
154 KillTimer(g_SpawnTimers[client]);
155 g_SpawnTimers[client] = INVALID_HANDLE;
157 g_GunMenuAvailable[client] = true;
160 public OnClientPutInServer(client)
162 g_GunMenuEnabled[client] = true;
163 g_GunMenuAvailable[client] = true;
164 g_PrimaryChoices[client] = -1;
165 g_SecondaryChoices[client] = -1;
168 public OnClientDisconnect(client)
170 if (g_SpawnTimers[client] != INVALID_HANDLE)
172 KillTimer(g_SpawnTimers[client]);
173 g_SpawnTimers[client] = INVALID_HANDLE;
177 public DM_OnClientSpawned(client)
184 if (!IsFakeClient(client))
186 if (g_ArmorAmount > 0)
188 GivePlayerItem(client, "item_assaultsuit");
189 GivePlayerItem(client, "item_assaultsuit");
190 SetClientArmor(client, g_ArmorAmount);
192 if (g_HealthAmount > 0)
194 SetClientHealth(client, g_HealthAmount);
198 GivePlayerItem(client, "item_kevlar");
199 GivePlayerItem(client, "item_kevlar");
201 GiveGrenades(client, g_Flashes, g_HEs, g_Smokes);
204 GiveNightVision(client);
209 /* See if we'll need to strip this bot */
210 if (g_BotSecondaryCount || g_BotPrimaryCount)
212 DM_StripBotItems(client);
216 GivePlayerItem(client, "item_assaultsuit");
217 GivePlayerItem(client, "item_assaultsuit");
218 SetClientArmor(client, g_BotArmor);
220 /* Make sure bot didn't buy armor */
221 SetClientArmor(client, 0);
223 if (g_BotHealthAmount > 0)
225 SetClientHealth(client, g_BotHealthAmount);
229 GivePlayerItem(client, "item_kevlar");
230 GivePlayerItem(client, "item_kevlar");
232 GiveGrenades(client, g_BotFlashes, g_BotHEs, g_BotSmokes);
234 if (!g_AllowBuy && g_SpawnTimers[client] == INVALID_HANDLE)
236 /* Small delay - we want to avoid ResetHUD */
237 g_SpawnTimers[client] = CreateTimer(0.1, PlayerPostSpawn, client);
241 public Action:PlayerPostSpawn(Handle:timer, any:client)
243 g_SpawnTimers[client] = INVALID_HANDLE;
250 if (IsFakeClient(client))
252 if (g_BotSecondaryCount > 0)
255 if (g_BotSecondaryCount == 1)
257 index = g_BotSecondaryList[0];
259 index = GetRandomInt(0, g_BotSecondaryCount-1);
260 index = g_BotSecondaryList[index];
262 decl String:classname[64];
263 DM_GetWeaponClassname(index, classname, sizeof(classname));
264 GivePlayerItem(client, classname);
266 if (g_BotPrimaryCount > 0)
269 if (g_BotPrimaryCount == 1)
271 index = g_BotPrimaryList[0];
273 index = GetRandomInt(0, g_BotPrimaryCount-1);
274 index = g_BotPrimaryList[index];
276 decl String:classname[64];
277 DM_GetWeaponClassname(index, classname, sizeof(classname));
278 GivePlayerItem(client, classname);
280 if (g_BotDefuseKits && GetClientTeam(client) == CSSDM_TEAM_CT)
282 GivePlayerItem(client, "item_defuser");
285 if (g_DefuseKits && GetClientTeam(client) == CSSDM_TEAM_CT)
287 GivePlayerItem(client, "item_defuser");
291 /* First, check if we should only be giving one of something automatically */
292 if ((g_SecondaryMenu == CSSDM_GUNMENU_RANDOM || g_SecondaryMenu == CSSDM_GUNMENU_YES)
293 && g_SecondaryCount == 1)
295 GiveSecondary(client, 0);
297 } else if (g_PrimaryMenu == CSSDM_GUNMENU_RANDOM && g_PrimaryCount > 1) {
298 GivePrimary(client, g_PrimaryCount);
302 if ((g_PrimaryMenu == CSSDM_GUNMENU_RANDOM || g_PrimaryMenu == CSSDM_GUNMENU_YES)
303 && g_PrimaryCount == 1)
305 GivePrimary(client, 0);
307 } else if (g_SecondaryMenu == CSSDM_GUNMENU_RANDOM && g_SecondaryCount > 1) {
308 GiveSecondary(client, g_SecondaryCount);
312 /* If we've already given two weapons, there is no need for a menu. */
318 if (g_GunMenuEnabled[client])
320 DisplayMenu(g_hEquipMenu, client, MENU_TIME_FOREVER);
322 GiveBothFromChoices(client);
329 public Action:Command_Say(client, args)
333 return Plugin_Continue;
336 new String:text[192];
337 GetCmdArg(1, text, sizeof(text));
339 if (strcmp(text, "guns") == 0)
341 if (!g_AllowGunCommand)
343 PrintToChat(client, "[CSSDM] %t", "GunsMenuDisabled");
344 return Plugin_Handled;
347 if (!ChooseFromSecondary() && !ChooseFromPrimary())
349 PrintToChat(client, "[CSSDM] %t", "GunsMenuNotAvailable");
350 return Plugin_Handled;
353 if (g_GunMenuEnabled[client])
355 PrintToChat(client, "[CSSDM] %t", "GunsMenuAlreadyEnabled");
356 return Plugin_Handled;
359 g_GunMenuEnabled[client] = true;
360 if (!g_GunMenuAvailable[client])
362 PrintToChat(client, "[CSSDM] %t", "GunsMenuReactivated");
364 DisplayMenu(g_hEquipMenu, client, MENU_TIME_FOREVER);
367 return Plugin_Handled;
370 return Plugin_Continue;
373 public Action:OnClientCommand(client, args)
375 if (!ShouldRun() || g_AllowBuy)
377 return Plugin_Continue;
381 GetCmdArg(0, cmd, sizeof(cmd));
383 if (StrEqual(cmd, "buy")
384 || StrEqual(cmd, "autobuy")
385 || StrEqual(cmd, "rebuy")
386 || StrEqual(cmd, "buyequip")
387 || StrEqual(cmd, "buymenu"))
389 return Plugin_Handled;
392 return Plugin_Continue;
395 public Menu_EquipHandler(Handle:menu, MenuAction:action, param1, param2)
402 if (action == MenuAction_DrawItem)
404 if (param2 == 1 || param2 == 2)
406 if (g_PrimaryChoices[param1] == -1 && g_SecondaryChoices[param1] == -1)
408 return ITEMDRAW_DISABLED;
411 return ITEMDRAW_DEFAULT;
413 else if (action == MenuAction_Select)
417 if (ChooseFromSecondary())
419 DisplayMenu(g_hSecondaryMenu, param1, MENU_TIME_FOREVER);
420 } else if (ChooseFromPrimary()) {
421 DisplayMenu(g_hPrimaryMenu, param1, MENU_TIME_FOREVER);
423 } else if (param2 == 1) {
424 GiveBothFromChoices(param1);
425 } else if (param2 == 2) {
426 GiveBothFromChoices(param1);
427 g_GunMenuEnabled[param1] = false;
428 PrintToChat(param1, "[CSSDM] %t", "SayGunsNotify");
429 } else if (param2 == 3) {
430 GivePrimary(param1, g_PrimaryCount);
431 GiveSecondary(param1, g_SecondaryCount);
432 } else if (param2 == 4) {
433 GivePrimary(param1, g_PrimaryCount);
434 GiveSecondary(param1, g_SecondaryCount);
435 GiveBothFromChoices(param1);
436 g_GunMenuEnabled[param1] = false;
437 PrintToChat(param1, "[CSSDM] %t", "SayGunsNotify");
439 g_GunMenuAvailable[param1] = false;
445 public Menu_PrimaryHandler(Handle:menu, MenuAction:action, param1, param2)
452 if (action == MenuAction_DrawItem)
454 return ITEMDRAW_DEFAULT;
456 else if (action == MenuAction_Select)
458 GivePrimary(param1, param2);
464 public Menu_SecondaryHandler(Handle:menu, MenuAction:action, param1, param2)
471 if (action == MenuAction_DrawItem)
473 return ITEMDRAW_DEFAULT;
475 else if (action == MenuAction_Select)
477 GiveSecondary(param1, param2);
478 if (ChooseFromPrimary())
480 DisplayMenu(g_hPrimaryMenu, param1, MENU_TIME_FOREVER);
483 else if (action == MenuAction_Cancel
484 && param2 == MenuCancel_Exit)
486 if (ChooseFromPrimary())
488 DisplayMenu(g_hPrimaryMenu, param1, MENU_TIME_FOREVER);
495 bool:ChooseFromPrimary()
497 return (g_PrimaryMenu == CSSDM_GUNMENU_YES
498 && g_PrimaryCount > 1);
501 bool:ChooseFromSecondary()
503 return (g_SecondaryMenu == CSSDM_GUNMENU_YES
504 && g_SecondaryCount > 1);
507 GiveWeapon(client, index)
509 new DmWeaponType:type = DM_GetWeaponType(index);
511 new entity = DM_GetClientWeapon(client, type);
514 DM_DropWeapon(client, entity);
518 DM_GetWeaponClassname(index, cls, sizeof(cls));
520 return GivePlayerItem(client, cls);
523 GiveBothFromChoices(client)
525 if (ChooseFromPrimary())
527 GivePrimary(client, g_PrimaryChoices[client]);
530 if (ChooseFromSecondary())
532 GiveSecondary(client, g_SecondaryChoices[client]);
537 * Gives a primary weapon to a client.
538 * If the list_index is > the count, we choose one randomly.
539 * This is a hack so we can append "Random" to the choice list.
541 GivePrimary(client, list_index)
549 if (list_index >= g_PrimaryCount)
551 if (g_PrimaryCount > 1)
553 weapon_index = GetRandomInt(0, g_PrimaryCount-1);
554 weapon_index = g_PrimaryList[weapon_index];
555 } else if (g_PrimaryCount == 1) {
556 weapon_index = g_PrimaryList[0];
561 weapon_index = g_PrimaryList[list_index];
564 g_PrimaryChoices[client] = list_index;
566 GiveWeapon(client, weapon_index);
570 * Gives a secondary weapon to a client.
571 * If the list_index is > the count, we choose one randomly.
572 * This is a hack so we can append "Random" to the choice list.
574 GiveSecondary(client, list_index)
582 if (list_index >= g_SecondaryCount)
584 if (g_SecondaryCount > 1)
586 weapon_index = GetRandomInt(0, g_SecondaryCount-1);
587 weapon_index = g_SecondaryList[weapon_index];
588 } else if (g_SecondaryCount == 1) {
589 weapon_index = g_SecondaryList[0];
594 weapon_index = g_SecondaryList[list_index];
597 g_SecondaryChoices[client] = list_index;
599 GiveWeapon(client, weapon_index);
604 return (DM_IsRunning() && g_IsEnabled);
607 bool:KvGetYesOrNo(Handle:kv, const String:key[], bool:curdefault)
609 decl String:value[12];
610 KvGetString(kv, key, value, sizeof(value), curdefault ? "yes" : "no");
611 return (strcmp(value, "yes") == 0);
614 KvGetGunMenu(Handle:kv, const String:key[], def)
616 decl String:sdef[12];
617 if (def == CSSDM_GUNMENU_YES)
619 strcopy(sdef, sizeof(sdef), "yes");
620 } else if (def == CSSDM_GUNMENU_RANDOM) {
621 strcopy(sdef, sizeof(sdef), "random");
623 strcopy(sdef, sizeof(sdef), "no");
626 decl String:value[12];
627 KvGetString(kv, key, value, sizeof(value), sdef);
629 if (strcmp(value, "yes") == 0)
631 return CSSDM_GUNMENU_YES;
632 } else if (strcmp(value, "random") == 0) {
633 return CSSDM_GUNMENU_RANDOM;
636 return CSSDM_GUNMENU_NO;
641 g_PrimaryMenu = CSSDM_GUNMENU_YES;
642 g_SecondaryMenu = CSSDM_GUNMENU_YES;
649 g_NightVision = false;
651 g_HealthAmount = 100;
652 g_AllowGunCommand = true;
655 bool:LoadConfigFile(const String:path[])
657 new Handle:kv = CreateKeyValues("Equipment");
658 if (!FileToKeyValues(kv, path))
663 decl String:value[255];
666 if (KvJumpToKey(kv, "Settings"))
668 g_AllowGunCommand = KvGetYesOrNo(kv, "guns_command", g_AllowGunCommand);
672 /* Load menu options */
673 if (KvJumpToKey(kv, "Menus"))
675 g_PrimaryMenu = KvGetGunMenu(kv, "primary", g_PrimaryMenu);
676 g_SecondaryMenu = KvGetGunMenu(kv, "secondary", g_SecondaryMenu);
677 g_AllowBuy = KvGetYesOrNo(kv, "buy", g_AllowBuy);
681 /* Load automatic stuff */
682 if (KvJumpToKey(kv, "AutoItems"))
684 g_ArmorAmount = KvGetNum(kv, "armor", g_ArmorAmount);
685 g_Flashes = KvGetNum(kv, "flashbangs", g_Flashes);
686 g_Helmets = KvGetYesOrNo(kv, "helmet", g_Helmets);
687 g_Smokes = KvGetYesOrNo(kv, "smokegrenade", g_Smokes);
688 g_HEs = KvGetYesOrNo(kv, "hegrenade", g_HEs);
689 g_NightVision = KvGetYesOrNo(kv, "nightvision", g_NightVision);
690 g_DefuseKits = KvGetYesOrNo(kv, "defusekits", g_DefuseKits);
691 g_HealthAmount = KvGetNum(kv, "health", g_HealthAmount);
696 if (KvJumpToKey(kv, "BotItems"))
698 /* Clear out old lists first */
699 g_BotPrimaryCount = 0;
700 g_BotSecondaryCount = 0;
702 if (KvGotoFirstSubKey(kv, false))
706 KvGetSectionName(kv, value, sizeof(value));
707 if (strcmp(value, "weapon") == 0)
709 KvGetString(kv, NULL_STRING, value, sizeof(value));
710 new index = DM_GetWeaponID(value);
713 new DmWeaponType:type = DM_GetWeaponType(index);
714 if (type == DmWeapon_Primary && g_BotPrimaryCount < CSSDM_MAX_WEAPONS)
716 g_BotPrimaryList[g_BotPrimaryCount++] = index;
717 } else if (type == DmWeapon_Secondary && g_BotSecondaryCount < CSSDM_MAX_WEAPONS) {
718 g_BotSecondaryList[g_BotSecondaryCount++] = index;
721 } else if (strcmp(value, "armor") == 0) {
722 g_BotArmor = KvGetNum(kv, NULL_STRING, 100);
723 } else if (strcmp(value, "helmet") == 0) {
724 g_BotHelmets = KvGetYesOrNo(kv, NULL_STRING, true);
725 } else if (strcmp(value, "flashbangs") == 0) {
726 g_BotFlashes = KvGetNum(kv, NULL_STRING);
727 } else if (strcmp(value, "smokegrenade") == 0) {
728 g_BotSmokes = KvGetYesOrNo(kv, NULL_STRING, false);
729 } else if (strcmp(value, "hegrenade") == 0) {
730 g_BotHEs = KvGetYesOrNo(kv, NULL_STRING, false);
731 } else if (strcmp(value, "defusekits") == 0) {
732 g_BotDefuseKits = KvGetYesOrNo(kv, NULL_STRING, true);
733 } else if (strcmp(value, "health") == 0) {
734 g_BotHealthAmount = KvGetNum(kv, NULL_STRING, 100);
736 } while (KvGotoNextKey(kv, false));
742 /* Load secondary weapons */
743 if (KvJumpToKey(kv, "SecondaryMenu"))
745 /* Clear out old list first */
746 g_SecondaryCount = 0;
748 if (KvGotoFirstSubKey(kv, false))
752 KvGetSectionName(kv, value, sizeof(value));
753 if (strcmp(value, "weapon") == 0)
755 KvGetString(kv, NULL_STRING, value, sizeof(value));
756 new index = DM_GetWeaponID(value);
757 if (index != -1 && DM_GetWeaponType(index) == DmWeapon_Secondary)
759 g_SecondaryList[g_SecondaryCount++] = index;
762 } while (KvGotoNextKey(kv, false) && g_SecondaryCount < CSSDM_MAX_WEAPONS);
768 /* Load primary weapons */
769 if (KvJumpToKey(kv, "PrimaryMenu"))
771 /* Clear out old list first */
774 if (KvGotoFirstSubKey(kv, false))
778 KvGetSectionName(kv, value, sizeof(value));
779 if (strcmp(value, "weapon") == 0)
781 KvGetString(kv, NULL_STRING, value, sizeof(value));
782 new index = DM_GetWeaponID(value);
783 if (index != -1 && DM_GetWeaponType(index) == DmWeapon_Primary)
785 g_PrimaryList[g_PrimaryCount++] = index;
788 } while (KvGotoNextKey(kv, false) && g_PrimaryCount < CSSDM_MAX_WEAPONS);
796 /* Build the primary menu */
797 if (g_hPrimaryMenu != INVALID_HANDLE)
799 CloseHandle(g_hPrimaryMenu);
801 g_hPrimaryMenu = CreateMenu(Menu_PrimaryHandler, MenuAction_DrawItem);
802 SetMenuTitle(g_hPrimaryMenu, "Primary weapon:");
803 for (new i=0; i<g_PrimaryCount; i++)
805 new index = g_PrimaryList[i];
806 DM_GetWeaponName(index, value, sizeof(value));
807 AddMenuItem(g_hPrimaryMenu, "", value);
809 AddMenuItem(g_hPrimaryMenu, "", "Random");
811 /* Build the secondary menu */
812 if (g_hSecondaryMenu != INVALID_HANDLE)
814 CloseHandle(g_hSecondaryMenu);
816 g_hSecondaryMenu = CreateMenu(Menu_SecondaryHandler, MenuAction_DrawItem);
817 SetMenuTitle(g_hSecondaryMenu, "Secondary weapon:");
818 for (new i=0; i<g_SecondaryCount; i++)
820 new index = g_SecondaryList[i];
821 DM_GetWeaponName(index, value, sizeof(value));
822 AddMenuItem(g_hSecondaryMenu, "", value);
824 AddMenuItem(g_hSecondaryMenu, "", "Random");
829 SetClientArmor(client, armor)
831 if (g_ArmorOffset == -1)
836 SetEntData(client, g_ArmorOffset, armor, 4, true);
839 SetClientHealth(client, health)
841 if (g_HealthOffset == -1)
846 SetEntData(client, g_HealthOffset, health, 4, true);
849 GiveGrenades(client, flashnum, bool:he, bool:smoke)
853 GivePlayerItem(client, "weapon_hegrenade");
855 for (new i=0; i<flashnum; i++)
857 GivePlayerItem(client, "weapon_flashbang");
861 GivePlayerItem(client, "weapon_smokegrenade");
865 GiveNightVision(client)
867 if (g_NVOffset == -1)
872 SetEntData(client, g_NVOffset, true, 1, true);