Merge pull request #439 from alliedmodders/propinfo
Deprecate FindSendPropOffs and FindDataMapOffs
This commit is contained in:
commit
c1f8ebf65c
@ -403,17 +403,13 @@ native SetEntDataString(entity, offset, const String:buffer[], maxlen, bool:chan
|
||||
* @param prop Property name.
|
||||
* @return An offset, or -1 on failure.
|
||||
*/
|
||||
#pragma deprecated Use FindSendPropInfo instead, or HasEntProp if you just want to check for existence.
|
||||
native FindSendPropOffs(const String:cls[], const String:prop[]);
|
||||
|
||||
/**
|
||||
* Given a ServerClass name, finds a networkable send property offset.
|
||||
* This information is cached for future calls.
|
||||
*
|
||||
* Note: This function will correctly compute nested offsets, unlike
|
||||
* FindSendPropOffs(). YOU SHOULD NOT use this function to self-compute
|
||||
* nested offsets. For example, it is okay to add indexes for arrays,
|
||||
* but not to add DT_LocalPlayer to m_nDisguiseClass.
|
||||
*
|
||||
* @param cls Classname.
|
||||
* @param prop Property name.
|
||||
* @param type Optional parameter to store the type.
|
||||
@ -445,6 +441,7 @@ native FindSendPropInfo(const String:cls[],
|
||||
* divisible by 8 (including 0 if unknown).
|
||||
* @return An offset, or -1 on failure.
|
||||
*/
|
||||
#pragma deprecated Use FindDataMapInfo instead, or HasEntProp if you just want to check for existence.
|
||||
native FindDataMapOffs(entity,
|
||||
const String:prop[],
|
||||
&PropFieldType:type=PropFieldType:0,
|
||||
@ -482,21 +479,49 @@ native FindDataMapInfo(entity,
|
||||
*/
|
||||
stock GetEntSendPropOffs(ent, const String:prop[], bool:actual=false)
|
||||
{
|
||||
decl String:cls[64];
|
||||
new String:cls[64];
|
||||
|
||||
if (!GetEntityNetClass(ent, cls, sizeof(cls)))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
new local;
|
||||
new offset = FindSendPropInfo(cls, prop, _, _, local);
|
||||
|
||||
if (actual)
|
||||
{
|
||||
return FindSendPropInfo(cls, prop);
|
||||
return offset;
|
||||
} else {
|
||||
return local;
|
||||
}
|
||||
else
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if an entity property exists on an entity.
|
||||
*
|
||||
* @param entity Entity/edict index.
|
||||
* @param type Property type.
|
||||
* @param prop Property name.
|
||||
* @return Whether the property exists on the entity.
|
||||
* @error Invalid entity.
|
||||
*/
|
||||
stock bool:HasEntProp(entity, PropType:type, const String:prop[])
|
||||
{
|
||||
return FindSendPropOffs(cls, prop);
|
||||
if (type == Prop_Data) {
|
||||
return (FindDataMapInfo(entity, prop) != -1);
|
||||
}
|
||||
|
||||
if (type != Prop_Send) {
|
||||
return false;
|
||||
}
|
||||
|
||||
new String:cls[64];
|
||||
if (!GetEntityNetClass(entity, cls, sizeof(cls))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return (FindSendPropInfo(cls, prop) != -1);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user