From f2bcff69a9fc263151d4770de69761f1a8be3ecb Mon Sep 17 00:00:00 2001 From: Berni Date: Sat, 9 Apr 2011 00:29:46 -0400 Subject: [PATCH] Added GetEntityClassname stock (bug 4798, r=dvander). --- plugins/include/entity.inc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/plugins/include/entity.inc b/plugins/include/entity.inc index 143cce76..78da4e72 100644 --- a/plugins/include/entity.inc +++ b/plugins/include/entity.inc @@ -162,6 +162,21 @@ native SetEdictFlags(edict, flags); */ native bool:GetEdictClassname(edict, String:clsname[], maxlength); +/** + * Retrieves the classname of an entity. + * This is like GetEdictClassname(), except it works for ALL + * entities, not just edicts. + * + * @param edict Index of the entity. + * @param clsname Buffer to store the classname. + * @param maxlength Maximum length of the buffer. + * @return True on success, false if there is no classname set. + */ +stock bool:GetEntityClassname(entity, String:clsname[], maxlength) +{ + return !!GetEntPropString(entity, Prop_Data, "m_iClassname", clsname, maxlength); +} + /** * Retrieves an entity's networkable serverclass name. * This is not the same as the classname and is used for networkable state changes.