Since I see that there is alot of problems with Props data types I have made a small include file that may help to detect a correct prop data type (Prop_Data or Prop_Send)
The Function:
PHP Code:
stock FindPropType(entity,const String:prop[],PropSend=-1,PropData=-1)
Testing/Using :
PHP Code:
#include <sourcemod>
#include <sdktools>
#include <proptype>
public OnPluginStart()
{
RegAdminCmd("sm_test1",Test,ADMFLAG_ROOT);
}
public Action:Test(client,args)
{
PrintToServer("%i",FindPropType(1,"m_iMaxHealth"));
PrintToServer("%i",FindPropType(1,"movetype"));
PrintToServer("%i",FindPropType(-1,"movetype"));
PrintToServer("%i",FindPropType(1,"asdasfsaffa"));
PrintToServer("%i",FindPropType(1,"m_fEffects"));
}
Sever return:
Code Itself:
PHP Code:
#define PROPTYPE_FAILED -3
#define PROPTYPE_WRONGPROP -2
#define PROPTYPE_BADENT -1
#define PROPTYPE_BOTH 0
#define PROPTYPE_SEND 1
#define PROPTYPE_DATA 2
/**
* Finds the correct Prop type.
*
* @param entity Entity that scanned for given prop.
* @param prop Prop to scan.
* @param PropSend Optional offest of Send prop if found.
* @param PropData Optional offest of Data prop if found.
* @return PropType define -3 function failed -2 wrong prop -1 bad entity 0 prop found on both 1 prop type is send 2 prop type is data
*/
stock FindPropType(entity,const String:prop[],PropSend=-1,PropData=-1)
{
if(!IsValidEntity(entity))
return PROPTYPE_BADENT;
new bool:NetClsName;
decl String:NetClass[50]="empty";
NetClsName=GetEntityNetClass(entity,NetClass,sizeof(NetClass))
PropData=FindDataMapOffs(entity,prop);
if(NetClsName)
{
PropSend=FindSendPropOffs(NetClass,prop);
if(PropSend!=-1&&PropData!=-1)
{
return PROPTYPE_BOTH;
}
else if(PropSend!=-1)
return PROPTYPE_SEND;
else if(PropData!=-1)
return PROPTYPE_DATA;
else if(PropData==-1&&PropSend==-1)
return PROPTYPE_WRONGPROP;
}
else
if(PropData!=-1)
return PROPTYPE_DATA;
return PROPTYPE_FAILED;
}
Change Log:
0.1 First release
Credits:
To me

SourceMod devs
Ask/Report/Use