scripting/dm_equipment.sp
changeset 172 f7f4cb013eaf
parent 92 52cc55d67b2f
     1.1 --- a/scripting/dm_equipment.sp	Thu Feb 13 12:03:34 2014 -0500
     1.2 +++ b/scripting/dm_equipment.sp	Thu Feb 13 12:42:56 2014 -0500
     1.3 @@ -32,9 +32,6 @@
     1.4  
     1.5  /** Plugin Stuff */
     1.6  new Handle:cssdm_enable_equipment;					/** cssdm_enable_equipment cvar */
     1.7 -new g_ArmorOffset = -1;								/* m_ArmorValue offset */
     1.8 -new g_NVOffset = -1;								/* m_bHasNightVision offset */
     1.9 -new g_HealthOffset = -1;							/* m_iHealth offset */
    1.10  new Handle:g_SpawnTimers[MAXPLAYERS+1];				/* Post-spawn timers */
    1.11  new Handle:g_hPrimaryMenu = INVALID_HANDLE;			/* Priamry menu Handle */
    1.12  new Handle:g_hSecondaryMenu = INVALID_HANDLE;		/* Secondary menu Handle */
    1.13 @@ -114,10 +111,6 @@
    1.14  	cssdm_enable_equipment = CreateConVar("cssdm_enable_equipment", "1", "Sets whether the equipment plugin is enabled");
    1.15  	HookConVarChange(cssdm_enable_equipment, OnEquipmentEnableChange);
    1.16  	
    1.17 -	g_ArmorOffset = FindSendPropOffs("CCSPlayer", "m_ArmorValue");
    1.18 -	g_NVOffset = FindSendPropOffs("CCSPlayer", "m_bHasNightVision");
    1.19 -	g_HealthOffset = FindSendPropOffs("CCSPlayer", "m_iHealth");
    1.20 -	
    1.21  	g_hEquipMenu = CreateMenu(Menu_EquipHandler, MenuAction_DrawItem|MenuAction_DisplayItem);
    1.22  	SetMenuTitle(g_hEquipMenu, "Weapon Options:");
    1.23  	SetMenuExitButton(g_hEquipMenu, false);
    1.24 @@ -199,8 +192,8 @@
    1.25  	{
    1.26  		if (g_ArmorAmount > 0)
    1.27  		{
    1.28 -			GivePlayerItem(client, "item_assaultsuit");
    1.29 -			GivePlayerItem(client, "item_assaultsuit");
    1.30 +			GivePlayerItem(client, "item_kevlar");
    1.31 +			GivePlayerItem(client, "item_kevlar");
    1.32  			SetClientArmor(client, g_ArmorAmount);
    1.33  		}
    1.34  		if (g_HealthAmount > 0)
    1.35 @@ -209,8 +202,13 @@
    1.36  		}
    1.37  		if (g_Helmets)
    1.38  		{
    1.39 -			GivePlayerItem(client, "item_kevlar");
    1.40 -			GivePlayerItem(client, "item_kevlar");
    1.41 +			if (g_ArmorAmount > 0)
    1.42 +			{
    1.43 +				GivePlayerItem(client, "item_assaultsuit");
    1.44 +				GivePlayerItem(client, "item_assaultsuit");
    1.45 +				SetClientArmor(client, g_ArmorAmount);
    1.46 +			}
    1.47 +			GiveHelmet(client);
    1.48  		}
    1.49  		GiveGrenades(client, g_Flashes, g_HEs, g_Smokes, g_Decoy);
    1.50  		if (g_NightVision)
    1.51 @@ -231,8 +229,8 @@
    1.52  		}
    1.53  		if (g_BotArmor > 0)
    1.54  		{
    1.55 -			GivePlayerItem(client, "item_assaultsuit");
    1.56 -			GivePlayerItem(client, "item_assaultsuit");
    1.57 +			GivePlayerItem(client, "item_kevlar");
    1.58 +			GivePlayerItem(client, "item_kevlar");
    1.59  			SetClientArmor(client, g_BotArmor);
    1.60  		} else {
    1.61  			/* Make sure bot didn't buy armor */
    1.62 @@ -244,8 +242,13 @@
    1.63  		}
    1.64  		if (g_BotHelmets)
    1.65  		{
    1.66 -			GivePlayerItem(client, "item_kevlar");
    1.67 -			GivePlayerItem(client, "item_kevlar");
    1.68 +			if (g_BotArmor > 0)
    1.69 +			{
    1.70 +				GivePlayerItem(client, "item_assaultsuit");
    1.71 +				GivePlayerItem(client, "item_assaultsuit");
    1.72 +				SetClientArmor(client, g_BotArmor);
    1.73 +			}
    1.74 +			GiveHelmet(client);
    1.75  		}
    1.76  		if (g_bIsGo && g_BotTaser)
    1.77  		{
    1.78 @@ -894,22 +897,12 @@
    1.79  
    1.80  SetClientArmor(client, armor)
    1.81  {
    1.82 -	if (g_ArmorOffset == -1)
    1.83 -	{
    1.84 -		return;
    1.85 -	}
    1.86 -	
    1.87 -	SetEntData(client, g_ArmorOffset, armor, 4, true);
    1.88 +	SetEntProp(client, Prop_Send, "m_ArmorValue", armor);
    1.89  }
    1.90  
    1.91  SetClientHealth(client, health)
    1.92  {
    1.93 -	if (g_HealthOffset == -1)
    1.94 -	{
    1.95 -		return;
    1.96 -	}
    1.97 -	
    1.98 -	SetEntData(client, g_HealthOffset, health, 4, true);
    1.99 +	SetEntProp(client, Prop_Send, "m_iHealth", health);
   1.100  }
   1.101  
   1.102  GiveGrenades(client, flashnum, bool:he, bool:smoke, bool:decoy)
   1.103 @@ -939,11 +932,9 @@
   1.104  
   1.105  GiveNightVision(client)
   1.106  {
   1.107 -	if (g_NVOffset == -1)
   1.108 -	{
   1.109 -		return;
   1.110 -	}
   1.111 -	
   1.112 -	SetEntData(client, g_NVOffset, true, 1, true);
   1.113 +	SetEntProp(client, Prop_Send, "m_bHasNightVision", true);
   1.114  }
   1.115 -
   1.116 +GiveHelmet(client)
   1.117 +{
   1.118 +	SetEntProp(client, Prop_Send, "m_bHasHelmet", true);
   1.119 +}
   1.120 \ No newline at end of file