plugins/include/entity.inc
changeset 823 78982602de6f
parent 694 b9b2cbe6352e
child 826 d26a924fbdbe
     1.1 --- a/plugins/include/entity.inc	Mon May 21 01:54:17 2007 +0000
     1.2 +++ b/plugins/include/entity.inc	Mon May 21 02:13:47 2007 +0000
     1.3 @@ -675,3 +675,43 @@
     1.4   * @error				Invalid entity, offset out of reasonable bounds, or property is not a valid string.
     1.5   */
     1.6  native SetEntPropString(entity, PropType:type, const String:prop[], const String:buffer[]);
     1.7 +
     1.8 +/**
     1.9 + * Copies an array of cells from an entity at a given offset.
    1.10 + *
    1.11 + * @param entity		Entity index.
    1.12 + * @param offset		Offset to use.
    1.13 + * @param array			Array to read into.
    1.14 + * @param arraySize		Number of values to read.
    1.15 + * @param dataSize		Size of each value in bytes (1, 2, or 4).
    1.16 + * @noreturn
    1.17 + * @error				Invalid entity or offset out of reasonable bounds.
    1.18 + */
    1.19 +stock GetEntDataArray(entity, offset, value, array[], arraySize, dataSize=4)
    1.20 +{
    1.21 +	for (new i=0; i<arraySize; i++)
    1.22 +	{
    1.23 +		array[i] = GetEntData(entity, offset, dataSize)
    1.24 +	}
    1.25 +}
    1.26 +
    1.27 +
    1.28 +/**
    1.29 + * Copies an array of cells to an entity at a given offset.
    1.30 + *
    1.31 + * @param entity		Entity index.
    1.32 + * @param offset		Offset to use.
    1.33 + * @param array			Array of values to copy.
    1.34 + * @param arraySize		Number of values to copy.
    1.35 + * @param dataSize		Size of each value in bytes (1, 2, or 4).
    1.36 + * @param changeState	True to set the network state as changed; false otherwise.
    1.37 + * @noreturn
    1.38 + * @error				Invalid entity or offset out of reasonable bounds.
    1.39 + */
    1.40 +stock SetEntDataArray(entity, offset, value, const array[], arraySize, dataSize=4, bool:changeState=false)
    1.41 +{
    1.42 +	for (new i=0; i<arraySize; i++)
    1.43 +	{
    1.44 +		SetEntData(entity, offset, array[i], dataSize, changeState)
    1.45 +	}
    1.46 +}