当前位置: 首页>>代码示例>>C++>>正文


C++ CHECK_ENTITY函数代码示例

本文整理汇总了C++中CHECK_ENTITY函数的典型用法代码示例。如果您正苦于以下问题:C++ CHECK_ENTITY函数的具体用法?C++ CHECK_ENTITY怎么用?C++ CHECK_ENTITY使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了CHECK_ENTITY函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: set_pdata_ehandle

static cell AMX_NATIVE_CALL set_pdata_ehandle(AMX *amx, cell *params)
{
	int index  = params[1];
	CHECK_ENTITY(index);

	int offset = params[2];
	CHECK_OFFSET(offset);

	int entity = params[3];
	CHECK_ENTITY(entity);

#if defined(__linux__)
	offset += params[4];
#elif defined(__APPLE__)
	// Use Linux offset in older plugins
	if (params[0] / sizeof(cell) == 4)
		offset += params[4];
	else
		offset += params[5];
#endif

	edict_t *pEntity = TypeConversion.id_to_edict(entity);

	set_pdata<edict_t*>(TypeConversion.id_to_edict(index), offset, pEntity);

	if (pEntity)
	{
		set_pdata<int>(TypeConversion.id_to_edict(index), offset +  4, pEntity->serialnumber);
	}

	return 1;
}
开发者ID:HamletEagle,项目名称:amxmodx,代码行数:32,代码来源:pdata.cpp

示例2: is_visible

static cell AMX_NATIVE_CALL is_visible(AMX *amx, cell *params)
{
	int src = params[1];
	int dest = params[2];
	CHECK_ENTITY(src);
	CHECK_ENTITY(dest);

	edict_t *pEntity = INDEXENT2(src);
	edict_t *pTarget = INDEXENT2(dest);

	if (pTarget->v.flags & FL_NOTARGET)
		return 0;

	Vector vLooker = pEntity->v.origin + pEntity->v.view_ofs;
	Vector vTarget = pTarget->v.origin + pTarget->v.view_ofs;

    TraceResult tr;

	TRACE_LINE(vLooker, vTarget, FALSE, pEntity, &tr);

	if (tr.fInOpen && tr.fInWater)
		return 0;
	else if (tr.flFraction == 1.0)
		return 1;
	
	return 0;
}
开发者ID:9iky6,项目名称:amxmodx,代码行数:27,代码来源:engine.cpp

示例3: Call_Void_Vector_Entvar_Entvar_Float_Int_Int

cell Call_Void_Vector_Entvar_Entvar_Float_Int_Int(AMX *amx, cell *params)
{
	SETUP(6);

	Vector v3;

	float *fl3=(float *)MF_GetAmxAddr(amx, params[3]);
	v3.x=fl3[0];
	v3.y=fl3[1];
	v3.z=fl3[2];

	int id4=*MF_GetAmxAddr(amx, params[4]);
	int id5=*MF_GetAmxAddr(amx, params[5]);
	float f6=amx_ctof2(*MF_GetAmxAddr(amx, params[6]));
	int i7=*MF_GetAmxAddr(amx, params[7]);
	int i8=*MF_GetAmxAddr(amx, params[8]);

	CHECK_ENTITY(id4);
	CHECK_ENTITY(id5);

	entvars_t *ev4=&(INDEXENT_NEW(id4)->v);
	entvars_t *ev5=&(INDEXENT_NEW(id5)->v);

#if defined(_WIN32)
	reinterpret_cast<void (__fastcall *)(void *, int, Vector, entvars_t *, entvars_t *, float, int, int)>(__func)(pv, 0, v3, ev4, ev5, f6, i7, i8);
#elif defined(__linux__) || defined(__APPLE__)
	reinterpret_cast<void (*)(void *, Vector, entvars_t *, entvars_t *, float, int, int)>(__func)(pv, v3, ev4, ev5, f6, i7, i8);
#endif

	return 1;
}
开发者ID:reuben,项目名称:amxmodx,代码行数:31,代码来源:call_funcs.cpp

示例4: entity_range

static cell AMX_NATIVE_CALL entity_range(AMX *amx, cell *params)
{
	int idxa = params[1];
	int idxb = params[2];

	CHECK_ENTITY(idxa);
	CHECK_ENTITY(idxb);

	edict_t *pEntA = INDEXENT2(idxa);
	edict_t *pEntB = INDEXENT2(idxb);

	REAL fRet = (pEntA->v.origin - pEntB->v.origin).Length();

	return amx_ftoc(fRet);
}
开发者ID:Chuvi-w,项目名称:amxmodx,代码行数:15,代码来源:entity.cpp

示例5: fake_touch

static cell AMX_NATIVE_CALL fake_touch(AMX *amx, cell *params)
{
	int iPtr = params[1];
	int iPtd = params[2];

	CHECK_ENTITY(iPtr);
	CHECK_ENTITY(iPtd);

	edict_t *pToucher = INDEXENT2(iPtr);
	edict_t *pTouched = INDEXENT2(iPtd);

	MDLL_Touch(pToucher, pTouched);

	return 1;
}
开发者ID:Chuvi-w,项目名称:amxmodx,代码行数:15,代码来源:entity.cpp

示例6: force_use

static cell AMX_NATIVE_CALL force_use(AMX *amx, cell *params)
{
	int iPtr = params[1];
	int iPtd = params[2];

	CHECK_ENTITY(iPtr);
	CHECK_ENTITY(iPtd);

	edict_t *pUser = INDEXENT2(iPtr);
	edict_t *pUsed = INDEXENT2(iPtd);

	MDLL_Use(pUsed, pUser);

	return 1;
}
开发者ID:Chuvi-w,项目名称:amxmodx,代码行数:15,代码来源:entity.cpp

示例7: GetModelCollisionBox

// GetModelCollisionBox( index, Float:mins[3], Float:maxs[3] );
static cell AMX_NATIVE_CALL GetModelCollisionBox(AMX *amx, cell *params)
{
	int entityIndex = params[1];

	CHECK_ENTITY(entityIndex);

	edict_t *pEdict = INDEXENT2(entityIndex);

	if (!FNullEnt(pEdict))
	{
		studiohdr_t *pStudiohdr = static_cast<studiohdr_t*>(GET_MODEL_PTR(pEdict));

		if (!pStudiohdr)
		{
			MF_LogError(amx, AMX_ERR_NATIVE, "Could not find the model pointer for the entity.");
			return 0;
		}

		cell *cmins = MF_GetAmxAddr(amx, params[2]);
		cell *cmaxs = MF_GetAmxAddr(amx, params[3]);

		cmins[0] = amx_ftoc(pStudiohdr->bbmin.x);
		cmins[1] = amx_ftoc(pStudiohdr->bbmin.y);
		cmins[2] = amx_ftoc(pStudiohdr->bbmin.z);

		cmaxs[0] = amx_ftoc(pStudiohdr->bbmax.x);
		cmaxs[1] = amx_ftoc(pStudiohdr->bbmax.y);
		cmaxs[2] = amx_ftoc(pStudiohdr->bbmax.z);

		return 1;
	}

	return 0;
};
开发者ID:Chuvi-w,项目名称:amxmodx,代码行数:35,代码来源:misc.cpp

示例8: Call_Int_Vector_Cbase

cell Call_Int_Vector_Cbase(AMX *amx, cell *params)
{
	SETUP(2);

	Vector v3;
	float *fl3=(float *)MF_GetAmxAddr(amx, params[3]);
	v3.x=fl3[0];
	v3.y=fl3[1];
	v3.z=fl3[2];

	int id4=*MF_GetAmxAddr(amx, params[4]);
	CHECK_ENTITY(id4);
	void *p4=IndexToPrivate(id4);

#if defined(_WIN32)
	int ret=reinterpret_cast<int (__fastcall *)(void *, int, Vector, void*)>(__func)(pv, 0, v3, p4);
#elif defined(__linux__) || defined(__APPLE__)
	int ret=reinterpret_cast<int (*)(void *, Vector, void*)>(__func)(pv, v3, p4);
#endif

	fl3[0]=v3.x;
	fl3[1]=v3.y;
	fl3[2]=v3.z;

	return ret;
}
开发者ID:reuben,项目名称:amxmodx,代码行数:26,代码来源:call_funcs.cpp

示例9: set_pdata_vector

static cell AMX_NATIVE_CALL set_pdata_vector(AMX *amx, cell *params)
{
	int index = params[1];
	CHECK_ENTITY(index);

	int offset = params[2];
	CHECK_OFFSET(offset);

#if defined(__linux__)
	offset += params[4];
#elif defined(__APPLE__)
	// Use Linux offset in older plugins
	if (params[0] / sizeof(cell) == 4)
		offset += params[4];
	else
		offset += params[5];
#endif

	cell *pcvec = MF_GetAmxAddr(amx, params[3]);

	Vector vec(amx_ctof(pcvec[0]), amx_ctof(pcvec[1]), amx_ctof(pcvec[2]));

	set_pdata<Vector>(TypeConversion.id_to_edict(index), offset, vec);

	return 1;
}
开发者ID:HamletEagle,项目名称:amxmodx,代码行数:26,代码来源:pdata.cpp

示例10: Call_Int_Cbase_pVector

cell Call_Int_Cbase_pVector(AMX *amx, cell *params)
{
	SETUP(2);

	int id3=*MF_GetAmxAddr(amx, params[3]);
	CHECK_ENTITY(id3);
	void *pv1=(INDEXENT_NEW(id3)->pvPrivateData);

	Vector v4;
	float *fl4=(float *)MF_GetAmxAddr(amx, params[4]);
	v4.x=fl4[0];
	v4.y=fl4[1];
	v4.z=fl4[2];

#if defined(_WIN32)
	int ret = reinterpret_cast<int (__fastcall *)(void*, int, void *, Vector *)>(__func)(pv, 0, pv1, &v4);
#elif defined(__linux__) || defined(__APPLE__)
	int ret = reinterpret_cast<int (*)(void *, void *, Vector *)>(__func)(pv, pv1, &v4);
#endif

	fl4[0]=v4.x;
	fl4[1]=v4.y;
	fl4[2]=v4.z;

	return ret;
}
开发者ID:reuben,项目名称:amxmodx,代码行数:26,代码来源:call_funcs.cpp

示例11: Call_Vector_Float_Cbase_Int

cell Call_Vector_Float_Cbase_Int(AMX *amx, cell *params)
{
	SETUP(4);

	float f3=amx_ctof2(*MF_GetAmxAddr(amx, params[3]));
	int id4=*MF_GetAmxAddr(amx, params[4]);
	int i5=*MF_GetAmxAddr(amx, params[5]);
	
	CHECK_ENTITY(id4);

	void *p4=IndexToPrivate(id4);

#if defined(_WIN32)
	Vector ret;
	reinterpret_cast<void(__fastcall *)(void *, int, Vector*, float, void *, int)>(__func)(pv, 0, &ret, f3, p4, i5);
#elif defined(__linux__) || defined(__APPLE__)
	Vector ret = reinterpret_cast<Vector(*)(void *, float, void *, int)>(__func)(pv, f3, p4, i5);
#endif

	float *out = (float *)MF_GetAmxAddr(amx, params[6]);
	out[0] = ret.x;
	out[1] = ret.y;
	out[2] = ret.z;

	return 1;
}
开发者ID:reuben,项目名称:amxmodx,代码行数:26,代码来源:call_funcs.cpp

示例12: Call_Void_Entvar_Float_Vector_Trace_Int

cell Call_Void_Entvar_Float_Vector_Trace_Int(AMX *amx, cell *params)
{
	SETUP(5);

	int id3=*MF_GetAmxAddr(amx, params[3]);
	float f4=amx_ctof2(*MF_GetAmxAddr(amx, params[4]));
	Vector v5;
	TraceResult *tr6=reinterpret_cast<TraceResult *>(*MF_GetAmxAddr(amx, params[6]));
	int i7=*MF_GetAmxAddr(amx, params[7]);

	float *fl5=(float *)MF_GetAmxAddr(amx, params[5]);
	v5.x=fl5[0];
	v5.y=fl5[1];
	v5.z=fl5[2];

	if (tr6==NULL)
	{
		MF_LogError(amx, AMX_ERR_NATIVE, "Null traceresult provided.");

		return 0;
	}

	CHECK_ENTITY(id3);

	entvars_t *ev3=&(INDEXENT_NEW(id3)->v);
#if defined(_WIN32)
	reinterpret_cast<void (__fastcall *)(void *, int, entvars_t *, float, Vector, TraceResult *, int)>(__func)(pv, 0, ev3, f4, v5, tr6, i7);
#elif defined(__linux__) || defined(__APPLE__)
	reinterpret_cast<void (*)(void *, entvars_t *, float, Vector, TraceResult *, int)>(__func)(pv, ev3, f4, v5, tr6, i7);
#endif

	return 1;
}
开发者ID:reuben,项目名称:amxmodx,代码行数:33,代码来源:call_funcs.cpp

示例13: SetModelCollisionBox

// SetModelCollisionBox( index );
static cell AMX_NATIVE_CALL SetModelCollisionBox(AMX *amx, cell *params)
{
	int entityIndex = params[1];

	CHECK_ENTITY(entityIndex);

	edict_t *pentModel = INDEXENT2(entityIndex);

	if (!FNullEnt(pentModel))
	{
		studiohdr_t *pStudiohdr = static_cast<studiohdr_t*>(GET_MODEL_PTR(pentModel));

		if (!pStudiohdr)
		{
			MF_LogError(amx, AMX_ERR_NATIVE, "Could not find the model pointer for the entity.");
			return 0;
		}

		SET_SIZE(pentModel, pStudiohdr->bbmin, pStudiohdr->bbmax);

		return 1;
	}

	return 0;
};
开发者ID:Chuvi-w,项目名称:amxmodx,代码行数:26,代码来源:misc.cpp

示例14: Call_Void_Cbase_pVector_Float

cell Call_Void_Cbase_pVector_Float(AMX *amx, cell *params)
{
	SETUP(3);

	int id3=*MF_GetAmxAddr(amx, params[3]);
	CHECK_ENTITY(id3);

	void *i3=IndexToPrivate(id3);

	Vector v4;
	float *fl4=(float *)MF_GetAmxAddr(amx, params[4]);
	v4.x=fl4[0];
	v4.y=fl4[1];
	v4.z=fl4[2];

	float f5=amx_ctof2(*MF_GetAmxAddr(amx, params[5]));

#if defined(_WIN32)
	reinterpret_cast<void (__fastcall *)(void*, int, void *, Vector *, float)>(__func)(pv, 0, i3, &v4, f5);
#elif defined(__linux__) || defined(__APPLE__)
	reinterpret_cast<void (*)(void *, void *, Vector *, float)>(__func)(pv, i3, &v4, f5);
#endif

	fl4[0]=v4.x;
	fl4[1]=v4.y;
	fl4[2]=v4.z;

	return 1;
}
开发者ID:reuben,项目名称:amxmodx,代码行数:29,代码来源:call_funcs.cpp

示例15: get_keyvalue

static cell AMX_NATIVE_CALL get_keyvalue(AMX *amx, cell *params)
{
	int idx = params[1];
	CHECK_ENTITY(idx);
	edict_t *pEntity = INDEXENT2(idx);
	int iLength=0;
	char *char1 = MF_GetAmxString(amx, params[2], 1, &iLength);
	return MF_SetAmxString(amx, params[3], INFO_KEY_VALUE(INFO_KEY_BUFFER(pEntity),char1), params[4]); 
}
开发者ID:Chuvi-w,项目名称:amxmodx,代码行数:9,代码来源:entity.cpp


注:本文中的CHECK_ENTITY函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。