plugins/include/entity_prop_stocks.inc
changeset 1834 74d7a2edeb49
parent 1828 0df571678652
child 1837 652038bb27e6
     1.1 --- a/plugins/include/entity_prop_stocks.inc	Fri Jan 04 16:20:25 2008 +0000
     1.2 +++ b/plugins/include/entity_prop_stocks.inc	Sun Jan 06 01:35:24 2008 +0000
     1.3 @@ -80,83 +80,86 @@
     1.4  /**
     1.5   * Gets an entity's movetype.
     1.6   *
     1.7 - * @param index		Entity index
     1.8 - * @return		Movetype, see enum above
     1.9 + * @param entity	Entity index.
    1.10 + * @return			Movetype, see enum above.
    1.11 + * @error			Invalid entity index, or lack of mod compliance.
    1.12   */
    1.13 -stock GetEntityMovetype(index)
    1.14 +stock GetEntityMovetype(entity)
    1.15  {
    1.16 -	new offset = GetEntSendPropOffs(index, "movetype");
    1.17 -	return GetEntData(index, offset, 1);
    1.18 +	new offset = GetEntSendPropOffs(entity, "movetype");
    1.19 +	return GetEntData(entity, offset, 1);
    1.20  }
    1.21  
    1.22  /**
    1.23   * Sets an entity's movetype.
    1.24   *
    1.25 - * @param index		Entity index
    1.26 - * @param mt		Movetype, see enum above
    1.27 + * @param entity	Entity index.
    1.28 + * @param mt		Movetype, see enum above.
    1.29   * @noreturn
    1.30 + * @error			Invalid entity index, or lack of mod compliance.
    1.31   */
    1.32 -stock SetEntityMovetype(index, mt)
    1.33 +stock SetEntityMovetype(entity, mt)
    1.34  {
    1.35 -	new offset = GetEntSendPropOffs(index, "movetype");
    1.36 -	SetEntData(index, offset, mt, 1, true);
    1.37 +	new offset = GetEntSendPropOffs(entity, "movetype");
    1.38 +	SetEntData(entity, offset, mt, 1, true);
    1.39  }
    1.40  
    1.41  /**
    1.42   * Sets an entity's color.
    1.43   *
    1.44 - * @param index		Entity index
    1.45 + * @param entity	Entity index
    1.46   * @param r 		Amount of red (0-255)
    1.47   * @param g 		Amount of green (0-255)
    1.48   * @param b 		Amount of blue (0-255)
    1.49   * @param a 		Amount of alpha (0-255)
    1.50   * @noreturn
    1.51 + * @error			Invalid entity index, or lack of mod compliance.
    1.52   */
    1.53 -stock SetEntityRenderColor(index, r=255, g=255, b=255, a=255)
    1.54 +stock SetEntityRenderColor(entity, r=255, g=255, b=255, a=255)
    1.55  {
    1.56 -	new offset = GetEntSendPropOffs(index, "m_clrRender");
    1.57 -	SetEntData(index, offset, r, 1, true);
    1.58 -	SetEntData(index, offset + 1, g, 1, true);
    1.59 -	SetEntData(index, offset + 2, b, 1, true);
    1.60 -	SetEntData(index, offset + 3, a, 1, true);
    1.61 +	new offset = GetEntSendPropOffs(entity, "m_clrRender");
    1.62 +	SetEntData(entity, offset, r, 1, true);
    1.63 +	SetEntData(entity, offset + 1, g, 1, true);
    1.64 +	SetEntData(entity, offset + 2, b, 1, true);
    1.65 +	SetEntData(entity, offset + 3, a, 1, true);
    1.66  }
    1.67  
    1.68  /**
    1.69   * Gets an entity's gravity.
    1.70   *
    1.71 - * @param index		Entity index
    1.72 - * @return		Entity's m_flGravity value
    1.73 + * @param entity 	Entity index.
    1.74 + * @return			Entity's m_flGravity value.
    1.75 + * @error			Invalid entity index, or lack of mod compliance.
    1.76   */
    1.77 -stock Float:GetEntityGravity(index)
    1.78 +stock Float:GetEntityGravity(entity)
    1.79  {
    1.80 -	new offset = FindDataMapOffs(index, "m_flGravity");
    1.81 -	return GetEntDataFloat(index, offset);	
    1.82 +	return GetEntPropFloat(entity, Prop_Data, "m_flGravity");
    1.83  }
    1.84  
    1.85  /**
    1.86   * Sets an entity's gravity.
    1.87   *
    1.88 - * @param index		Entity index
    1.89 - * @param amount	Gravity to set. Default = 800
    1.90 + * @param entity	Entity index.
    1.91 + * @param amount	Gravity to set (default = 800).
    1.92   * @noreturn
    1.93 + * @error			Invalid entity index, or lack of mod compliance.
    1.94   */
    1.95 -stock SetEntityGravity(index, Float:amount)
    1.96 +stock SetEntityGravity(entity, Float:amount)
    1.97  {
    1.98 -	new offset = FindDataMapOffs(index, "m_flGravity");
    1.99 -	SetEntDataFloat(index, offset, amount, true);	
   1.100 +	SetEntPropFloat(entity, Prop_Data, "m_flGravity", amount);
   1.101  }
   1.102  
   1.103  /**
   1.104   * Sets an entity's health
   1.105   *
   1.106 - * @param index		Entity index
   1.107 - * @param amount	Health
   1.108 + * @param entity	Entity index.
   1.109 + * @param amount	Health amount.
   1.110   * @noreturn
   1.111 + * @error			Invalid entity index, or lack of mod compliance.
   1.112   */
   1.113 -stock SetEntityHealth(index, amount)
   1.114 +stock SetEntityHealth(entity, amount)
   1.115  {
   1.116 -	SetEntProp(client, Prop_Send, "m_iHealth", amount, 4)
   1.117 -	SetEntProp(client, Prop_Data, "m_iHealth", amount, 4)
   1.118 +	SetEntProp(entity, Prop_Send, "m_iHealth", amount);
   1.119  }
   1.120  
   1.121  /**
   1.122 @@ -164,9 +167,11 @@
   1.123   *
   1.124   * @param client	Client index
   1.125   * @return			Bitsum of buttons
   1.126 + * @error			Invalid client index, client not in game, 
   1.127 + *					or lack of mod compliance.
   1.128   */
   1.129  stock GetClientButtons(client)
   1.130  {
   1.131 -	new offset = FindDataMapOffs(client, "m_nButtons");
   1.132 -	return GetEntData(client, offset, 4);
   1.133 -}
   1.134 \ No newline at end of file
   1.135 +	return GetEntProp(client, Prop_Data, "m_nButtons");
   1.136 +}
   1.137 +