plugins/include/tf2_stocks.inc
changeset 3308 d76e338633dc
parent 3269 2139ba334ae0
child 3310 1cb4908e3495
     1.1 --- a/plugins/include/tf2_stocks.inc	Fri Jun 24 00:53:17 2011 -0400
     1.2 +++ b/plugins/include/tf2_stocks.inc	Fri Jun 24 02:01:03 2011 -0400
     1.3 @@ -122,7 +122,10 @@
     1.4  	TF_CUSTOM_FISH_KILL,
     1.5  	TF_CUSTOM_TRIGGER_HURT,
     1.6  	TF_CUSTOM_DECAPITATION_BOSS,
     1.7 -	TF_CUSTOM_STICKBOMB_EXPLOSION
     1.8 +	TF_CUSTOM_STICKBOMB_EXPLOSION,
     1.9 +	TF_CUSTOM_AEGIS_ROUND,
    1.10 +	TF_CUSTOM_FLARE_EXPLOSION,
    1.11 +	TF_CUSTOM_BOOTS_STOP,
    1.12  };
    1.13  
    1.14  // Weapon codes as used in some events, such as player_death
    1.15 @@ -202,7 +205,10 @@
    1.16  	TF_WEAPON_HANDGUN_SCOUT_PRIMARY,
    1.17  	TF_WEAPON_BAT_FISH,
    1.18  	TF_WEAPON_CROSSBOW,
    1.19 -	TF_WEAPON_STICKBOMB
    1.20 +	TF_WEAPON_STICKBOMB,
    1.21 +	TF_WEAPON_HANDGUN_SCOUT_SEC,
    1.22 +	TF_WEAPON_SODA_POPPER,
    1.23 +	TF_WEAPON_SNIPERRIFLE_DECAP,
    1.24  };
    1.25  
    1.26  // TF2 Weapon Slots for GetPlayerWeaponSlot
    1.27 @@ -412,12 +418,54 @@
    1.28   * @param client		Player's index.
    1.29   * @return				Player's condition bits
    1.30   */
    1.31 +#pragma deprecated Use TF2_IsPlayerInCondition instead.
    1.32  stock TF2_GetPlayerConditionFlags(client)
    1.33  {
    1.34  	return GetEntProp(client, Prop_Send, "m_nPlayerCond")|GetEntProp(client, Prop_Send, "_condition_bits");
    1.35  }
    1.36  
    1.37  /**
    1.38 + * Check whether or not a condition is set on a player
    1.39 + *
    1.40 + * @param client		Player's index.
    1.41 + * @return				True if set, false otherwise
    1.42 + */
    1.43 +stock bool:TF2_IsPlayerInCondition(client, TFCond:cond)
    1.44 +{
    1.45 +	// Conditions are stored in a uint64 now. We need to check each 32-bit segment.
    1.46 +	if (_:cond < 32)
    1.47 +	{
    1.48 +		new bit = (1 << (_:cond - 32));
    1.49 +		if ((GetEntProp(client, Prop_Send, "m_nPlayerCond") & bit) == bit)
    1.50 +		{
    1.51 +			return true;
    1.52 +		}
    1.53 +		
    1.54 +		if ((GetEntProp(client, Prop_Send, "_condition_bits") & bit) == bit)
    1.55 +		{
    1.56 +			return true;
    1.57 +		}
    1.58 +	}
    1.59 +	else
    1.60 +	{
    1.61 +		new bit = 1 << _:cond;		
    1.62 +		new offset = FindSendPropInfo("CTFPlayer", "m_nPlayerCond");
    1.63 +		
    1.64 +		if (offset <= 0)
    1.65 +		{
    1.66 +			ThrowError("Could not find m_nPlayerCond offset from CTFPlayer");
    1.67 +		}
    1.68 +		
    1.69 +		if ((GetEntData(client, (offset+4)) & bit) == bit)
    1.70 +		{
    1.71 +			return true;
    1.72 +		}
    1.73 +	}
    1.74 +	
    1.75 +	return false;
    1.76 +}
    1.77 +
    1.78 +/**
    1.79   * Gets an entity's object type.
    1.80   *
    1.81   * @param entity		Entity index.