1.1 --- a/scripting/dm_equipment.sp Sun Jun 24 22:10:00 2007 +0000
1.2 +++ b/scripting/dm_equipment.sp Mon Jun 25 19:17:11 2007 +0000
1.3 @@ -30,7 +30,7 @@
1.4 #define CSSDM_GUNMENU_RANDOM 2
1.5
1.6 /** Plugin Stuff */
1.7 -new Handle:g_hEquipCfg = INVALID_HANDLE; /* cssdm_equip_cfg cvar */
1.8 +new Handle:cssdm_enable_equipment; /** cssdm_enable_equipment cvar */
1.9 new g_ArmorOffset = -1; /* m_ArmorValue offset */
1.10 new g_NVOffset = -1; /* m_bHasNightVision offset */
1.11 new g_HealthOffset = -1; /* m_iHealth offset */
1.12 @@ -94,7 +94,7 @@
1.13 RegConsoleCmd("say", Command_Say);
1.14 RegConsoleCmd("say_team", Command_Say);
1.15
1.16 - g_hEquipCfg = CreateConVar("cssdm_equip_cfg", "cssdm.equip.txt", "CS:S DM Equipment Config File");
1.17 + cssdm_enable_equipment = CreateConVar("cssdm_enable_equipment", "1", "Sets whether the equipment plugin is enabled");
1.18 g_ArmorOffset = FindSendPropOffs("CCSPlayer", "m_ArmorValue");
1.19 g_NVOffset = FindSendPropOffs("CCSPlayer", "m_bHasNightVision");
1.20 g_HealthOffset = FindSendPropOffs("CCSPlayer", "m_iHealth");
1.21 @@ -113,34 +113,27 @@
1.22 {
1.23 LoadDefaults();
1.24
1.25 - decl String:cvar[64];
1.26 - GetConVarString(g_hEquipCfg, cvar, sizeof(cvar));
1.27 -
1.28 - if (cvar[0] == '\0')
1.29 + if (!GetConVarInt(cssdm_enable_equipment))
1.30 {
1.31 + g_IsEnabled = false;
1.32 + return;
1.33 + }
1.34 +
1.35 + if ((g_IsEnabled = LoadConfigFile("cfg/cssdm/cssdm.equip.txt")) == false)
1.36 + {
1.37 + LogError("[CSSDM] Could not find equipment file \"%s\"", "cfg/cssdm/cssdm.equip.txt");
1.38 return;
1.39 }
1.40
1.41 + /** See if there is a map version */
1.42 + decl String:map[64];
1.43 decl String:path[255];
1.44 - Format(path, sizeof(path), "cfg/cssdm/%s", cvar);
1.45 -
1.46 - if ((g_IsEnabled = LoadConfigFile(path)) == false)
1.47 - {
1.48 - LogError("[CSSDM] Could not find equipment file \"%s\"", path);
1.49 - return;
1.50 - }
1.51 + GetCurrentMap(map, sizeof(map));
1.52 + Format(path, sizeof(path), "cfg/cssdm/%s/cssdm.equip.txt", map);
1.53
1.54 - if (strcmp(cvar, "cssdm.equip.txt") == 0)
1.55 + if (FileExists(path))
1.56 {
1.57 - /** See if there is a map version */
1.58 - decl String:map[64];
1.59 - GetCurrentMap(map, sizeof(map));
1.60 - Format(path, sizeof(path), "cfg/cssdm/%s/cssdm.equip.txt", map);
1.61 -
1.62 - if (FileExists(path))
1.63 - {
1.64 - LoadConfigFile(path);
1.65 - }
1.66 + LoadConfigFile(path);
1.67 }
1.68 }
1.69