Added array element selection with Get/SetEntProp* on arrays (bug 4160, r=fyren).
This commit is contained in:
+31
-10
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* vim: set ts=4 :
|
||||
* =============================================================================
|
||||
* SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
|
||||
* SourceMod (C)2004-2011 AlliedModders LLC. All rights reserved.
|
||||
* =============================================================================
|
||||
*
|
||||
* This file is part of the SourceMod/SourcePawn SDK.
|
||||
@@ -504,10 +504,11 @@ stock GetEntSendPropOffs(ent, const String:prop[], bool:actual=false)
|
||||
* @param size Number of bytes to write (valid values are 1, 2, or 4).
|
||||
* This value is auto-detected, and the size parameter is
|
||||
* only used as a fallback in case detection fails.
|
||||
* @param element Element # (starting from 0) if property is an array.
|
||||
* @return Value at the given property offset.
|
||||
* @error Invalid entity or property not found.
|
||||
*/
|
||||
native GetEntProp(entity, PropType:type, const String:prop[], size=4);
|
||||
native GetEntProp(entity, PropType:type, const String:prop[], size=4, element=0);
|
||||
|
||||
/**
|
||||
* Sets an integer value in an entity's property.
|
||||
@@ -518,13 +519,15 @@ native GetEntProp(entity, PropType:type, const String:prop[], size=4);
|
||||
* @param entity Entity/edict index.
|
||||
* @param type Property type.
|
||||
* @param prop Property name.
|
||||
* @param value Value to set.
|
||||
* @param size Number of bytes to write (valid values are 1, 2, or 4).
|
||||
* This value is auto-detected, and the size parameter is
|
||||
* only used as a fallback in case detection fails.
|
||||
* @param element Element # (starting from 0) if property is an array.
|
||||
* @error Invalid entity or offset out of reasonable bounds.
|
||||
* @noreturn
|
||||
*/
|
||||
native SetEntProp(entity, PropType:type, const String:prop[], any:value, size=4);
|
||||
native SetEntProp(entity, PropType:type, const String:prop[], any:value, size=4, element=0);
|
||||
|
||||
/**
|
||||
* Retrieves a float value from an entity's property.
|
||||
@@ -535,10 +538,11 @@ native SetEntProp(entity, PropType:type, const String:prop[], any:value, size=4)
|
||||
* @param entity Entity/edict index.
|
||||
* @param type Property type.
|
||||
* @param prop Property name.
|
||||
* @param element Element # (starting from 0) if property is an array.
|
||||
* @return Value at the given property offset.
|
||||
* @error Invalid entity or offset out of reasonable bounds.
|
||||
*/
|
||||
native Float:GetEntPropFloat(entity, PropType:type, const String:prop[]);
|
||||
native Float:GetEntPropFloat(entity, PropType:type, const String:prop[], element=0);
|
||||
|
||||
/**
|
||||
* Sets a float value in an entity's property.
|
||||
@@ -550,10 +554,11 @@ native Float:GetEntPropFloat(entity, PropType:type, const String:prop[]);
|
||||
* @param type Property type.
|
||||
* @param prop Property name.
|
||||
* @param value Value to set.
|
||||
* @param element Element # (starting from 0) if property is an array.
|
||||
* @noreturn
|
||||
* @error Invalid entity or offset out of reasonable bounds.
|
||||
*/
|
||||
native SetEntPropFloat(entity, PropType:type, const String:prop[], Float:value);
|
||||
native SetEntPropFloat(entity, PropType:type, const String:prop[], Float:value, element=0);
|
||||
|
||||
/**
|
||||
* Retrieves an entity index from an entity's property.
|
||||
@@ -564,12 +569,13 @@ native SetEntPropFloat(entity, PropType:type, const String:prop[], Float:value);
|
||||
* @param entity Entity/edict index.
|
||||
* @param type Property type.
|
||||
* @param prop Property name.
|
||||
* @param element Element # (starting from 0) if property is an array.
|
||||
* @return Entity index at the given property.
|
||||
* If there is no entity, or the entity is not valid,
|
||||
* then -1 is returned.
|
||||
* @error Invalid entity or offset out of reasonable bounds.
|
||||
*/
|
||||
native GetEntPropEnt(entity, PropType:type, const String:prop[]);
|
||||
native GetEntPropEnt(entity, PropType:type, const String:prop[], element=0);
|
||||
|
||||
/**
|
||||
* Sets an entity index in an entity's property.
|
||||
@@ -581,10 +587,11 @@ native GetEntPropEnt(entity, PropType:type, const String:prop[]);
|
||||
* @param type Property type.
|
||||
* @param prop Property name.
|
||||
* @param other Entity index to set, or -1 to unset.
|
||||
* @param element Element # (starting from 0) if property is an array.
|
||||
* @noreturn
|
||||
* @error Invalid entity or offset out of reasonable bounds.
|
||||
*/
|
||||
native SetEntPropEnt(entity, PropType:type, const String:prop[], other);
|
||||
native SetEntPropEnt(entity, PropType:type, const String:prop[], other, element=0);
|
||||
|
||||
/**
|
||||
* Retrieves a vector of floats from an entity, given a named network property.
|
||||
@@ -596,11 +603,12 @@ native SetEntPropEnt(entity, PropType:type, const String:prop[], other);
|
||||
* @param type Property type.
|
||||
* @param prop Property name.
|
||||
* @param vec Vector buffer to store data in.
|
||||
* @param element Element # (starting from 0) if property is an array.
|
||||
* @noreturn
|
||||
* @error Invalid entity, property not found, or property not
|
||||
* actually a vector data type.
|
||||
*/
|
||||
native GetEntPropVector(entity, PropType:type, const String:prop[], Float:vec[3]);
|
||||
native GetEntPropVector(entity, PropType:type, const String:prop[], Float:vec[3], element=0);
|
||||
|
||||
/**
|
||||
* Sets a vector of floats in an entity, given a named network property.
|
||||
@@ -612,11 +620,12 @@ native GetEntPropVector(entity, PropType:type, const String:prop[], Float:vec[3]
|
||||
* @param type Property type.
|
||||
* @param prop Property name.
|
||||
* @param vec Vector to set.
|
||||
* @param element Element # (starting from 0) if property is an array.
|
||||
* @noreturn
|
||||
* @error Invalid entity, property not found, or property not
|
||||
* actually a vector data type.
|
||||
*/
|
||||
native SetEntPropVector(entity, PropType:type, const String:prop[], const Float:vec[3]);
|
||||
native SetEntPropVector(entity, PropType:type, const String:prop[], const Float:vec[3], element=0);
|
||||
|
||||
/**
|
||||
* Gets a network property as a string.
|
||||
@@ -626,10 +635,11 @@ native SetEntPropVector(entity, PropType:type, const String:prop[], const Float:
|
||||
* @param prop Property to use.
|
||||
* @param buffer Destination string buffer.
|
||||
* @param maxlen Maximum length of output string buffer.
|
||||
* @param element Element # (starting from 0) if property is an array.
|
||||
* @return Number of non-null bytes written.
|
||||
* @error Invalid entity, offset out of reasonable bounds, or property is not a valid string.
|
||||
*/
|
||||
native GetEntPropString(entity, PropType:type, const String:prop[], String:buffer[], maxlen);
|
||||
native GetEntPropString(entity, PropType:type, const String:prop[], String:buffer[], maxlen, element=0);
|
||||
|
||||
/**
|
||||
* Sets a network property as a string.
|
||||
@@ -646,6 +656,17 @@ native GetEntPropString(entity, PropType:type, const String:prop[], String:buffe
|
||||
*/
|
||||
native SetEntPropString(entity, PropType:type, const String:prop[], const String:buffer[]);
|
||||
|
||||
/**
|
||||
* Retrieves the count of values that an entity property's array can store.
|
||||
*
|
||||
* @param entity Entity/edict index.
|
||||
* @param type Property type.
|
||||
* @param prop Property name.
|
||||
* @return Size of array (in elements) or 1 if property is not an array.
|
||||
* @error Invalid entity or property not found.
|
||||
*/
|
||||
native GetEntPropArraySize(entity, PropType:type, const String:prop[]);
|
||||
|
||||
/**
|
||||
* Copies an array of cells from an entity at a given offset.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user